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