|
1 | 1 | name: "Count lines of code" |
2 | 2 | description: "Count lines of code" |
3 | 3 | inputs: |
4 | | - build_datetime: |
5 | | - description: "Build datetime, set by the CI/CD pipeline workflow" |
6 | | - required: true |
7 | | - build_timestamp: |
8 | | - description: "Build timestamp, set by the CI/CD pipeline workflow" |
9 | | - required: true |
10 | | - idp_aws_report_upload_account_id: |
11 | | - description: "IDP AWS account ID" |
12 | | - required: true |
13 | | - idp_aws_report_upload_region: |
14 | | - description: "IDP AWS account region" |
15 | | - required: true |
16 | | - idp_aws_report_upload_role_name: |
17 | | - description: "Role to upload the report" |
18 | | - required: true |
19 | | - idp_aws_report_upload_bucket_endpoint: |
20 | | - description: "Bucket endpoint for the report" |
21 | | - required: true |
| 4 | + build_datetime: |
| 5 | + description: "Build datetime, set by the CI/CD pipeline workflow" |
| 6 | + required: true |
| 7 | + build_timestamp: |
| 8 | + description: "Build timestamp, set by the CI/CD pipeline workflow" |
| 9 | + required: true |
| 10 | + idp_aws_report_upload_account_id: |
| 11 | + description: "IDP AWS account ID" |
| 12 | + required: true |
| 13 | + idp_aws_report_upload_region: |
| 14 | + description: "IDP AWS account region" |
| 15 | + required: true |
| 16 | + idp_aws_report_upload_role_name: |
| 17 | + description: "Role to upload the report" |
| 18 | + required: true |
| 19 | + idp_aws_report_upload_bucket_endpoint: |
| 20 | + description: "Bucket endpoint for the report" |
| 21 | + required: true |
22 | 22 | runs: |
23 | | - using: "composite" |
24 | | - steps: |
25 | | - - name: "Create CLOC report" |
26 | | - shell: bash |
27 | | - run: | |
28 | | - export BUILD_DATETIME=${{ inputs.build_datetime }} |
29 | | - ./scripts/reports/create-lines-of-code-report.sh |
30 | | - - name: "Compress CLOC report" |
31 | | - shell: bash |
32 | | - run: zip lines-of-code-report.json.zip lines-of-code-report.json |
33 | | - - name: "Upload CLOC report as an artefact" |
34 | | - if: ${{ !env.ACT }} |
35 | | - uses: actions/upload-artifact@v3 |
36 | | - with: |
37 | | - name: lines-of-code-report.json.zip |
38 | | - path: ./lines-of-code-report.json.zip |
39 | | - retention-days: 21 |
40 | | - - name: "Check prerequisites for sending the report" |
41 | | - shell: bash |
42 | | - id: check |
43 | | - run: | |
44 | | - echo "secrets_exist=${{ inputs.idp_aws_report_upload_role_name != '' && inputs.idp_aws_report_upload_bucket_endpoint != '' }}" >> $GITHUB_OUTPUT |
45 | | - - name: "Authenticate to send the report" |
46 | | - if: steps.check.outputs.secrets_exist == 'true' |
47 | | - uses: aws-actions/configure-aws-credentials@v2 |
48 | | - with: |
49 | | - role-to-assume: arn:aws:iam::${{ inputs.idp_aws_report_upload_account_id }}:role/${{ inputs.idp_aws_report_upload_role_name }} |
50 | | - aws-region: ${{ inputs.idp_aws_report_upload_region }} |
51 | | - - name: "Send the CLOC report to the central location" |
52 | | - shell: bash |
53 | | - if: steps.check.outputs.secrets_exist == 'true' |
54 | | - run: | |
55 | | - aws s3 cp \ |
56 | | - ./lines-of-code-report.json.zip \ |
57 | | - ${{ inputs.idp_aws_report_upload_bucket_endpoint }}/${{ inputs.build_timestamp }}-lines-of-code-report.json.zip |
| 23 | + using: "composite" |
| 24 | + steps: |
| 25 | + - name: "Create CLOC report" |
| 26 | + shell: bash |
| 27 | + run: | |
| 28 | + export BUILD_DATETIME=${{ inputs.build_datetime }} |
| 29 | + ./scripts/reports/create-lines-of-code-report.sh |
| 30 | + - name: "Compress CLOC report" |
| 31 | + shell: bash |
| 32 | + run: zip lines-of-code-report.json.zip lines-of-code-report.json |
| 33 | + - name: "Upload CLOC report as an artefact" |
| 34 | + if: ${{ !env.ACT }} |
| 35 | + uses: actions/upload-artifact@v4 |
| 36 | + with: |
| 37 | + name: lines-of-code-report.json.zip |
| 38 | + path: ./lines-of-code-report.json.zip |
| 39 | + retention-days: 21 |
| 40 | + - name: "Check prerequisites for sending the report" |
| 41 | + shell: bash |
| 42 | + id: check |
| 43 | + run: | |
| 44 | + echo "secrets_exist=${{ inputs.idp_aws_report_upload_role_name != '' && inputs.idp_aws_report_upload_bucket_endpoint != '' }}" >> $GITHUB_OUTPUT |
| 45 | + - name: "Authenticate to send the report" |
| 46 | + if: steps.check.outputs.secrets_exist == 'true' |
| 47 | + uses: aws-actions/configure-aws-credentials@v2 |
| 48 | + with: |
| 49 | + role-to-assume: arn:aws:iam::${{ inputs.idp_aws_report_upload_account_id }}:role/${{ inputs.idp_aws_report_upload_role_name }} |
| 50 | + aws-region: ${{ inputs.idp_aws_report_upload_region }} |
| 51 | + - name: "Send the CLOC report to the central location" |
| 52 | + shell: bash |
| 53 | + if: steps.check.outputs.secrets_exist == 'true' |
| 54 | + run: | |
| 55 | + aws s3 cp \ |
| 56 | + ./lines-of-code-report.json.zip \ |
| 57 | + ${{ inputs.idp_aws_report_upload_bucket_endpoint }}/${{ inputs.build_timestamp }}-lines-of-code-report.json.zip |
0 commit comments