|
20 | 20 | id: authorization |
21 | 21 | uses: ./.github/actions/check-authorization |
22 | 22 |
|
23 | | - security-review: |
| 23 | + execute: |
24 | 24 | needs: authorize |
25 | 25 | runs-on: ubuntu-latest |
26 | 26 | environment: ${{ needs.authorize.outputs.approval-env }} |
|
36 | 36 | - name: Get AWS credentials |
37 | 37 | uses: aws-actions/configure-aws-credentials@v4 |
38 | 38 | with: |
39 | | - role-to-assume: arn:aws:iam::547182295936:role/SecurityReview-GitHubOIDCRole |
| 39 | + role-to-assume: arn:aws:iam::547182295936:role/SecurityReview-GitHubOIDCRole #TODO: migrate to production account |
40 | 40 | role-session-name: ${{ github.run_id }}-${{ github.run_attempt }} |
41 | 41 | aws-region: us-west-2 |
42 | 42 |
|
@@ -68,28 +68,17 @@ jobs: |
68 | 68 | REVIEW_STATUS=$(aws codebuild batch-get-builds --ids "${BUILD_ID}" --query 'builds[0].exportedEnvironmentVariables[?name==`REVIEW_STATUS`].value' --output text) |
69 | 69 | echo "blocking=$([[ "$REVIEW_STATUS" == "FAIL" ]] && echo true || echo false)" >> "$GITHUB_OUTPUT" |
70 | 70 |
|
71 | | - - name: Update commit status - pass |
72 | | - if: steps.codebuild.outputs.blocking == 'false' |
| 71 | + - name: Update commit status |
| 72 | + if: always() && steps.codebuild.outputs.blocking != 'skip' |
73 | 73 | shell: bash |
74 | 74 | env: |
75 | 75 | GH_TOKEN: ${{ github.token }} |
76 | 76 | STATUS_URL: ${{ github.api_url }}/repos/${{ github.repository }}/statuses/${{ github.event.pull_request.head.sha }} |
77 | 77 | REPORT_URL: https://d28bfvmis1skm5.cloudfront.net/${{ github.event.repository.name }}/pr-${{ github.event.pull_request.number }}/${{ github.event.pull_request.head.sha }}.html |
| 78 | + BLOCKING: ${{ steps.codebuild.outputs.blocking }} |
78 | 79 | run: | |
| 80 | + STATE=$([[ "$BLOCKING" == "true" ]] && echo "failure" || echo "success") |
79 | 81 | curl -sS -X POST \ |
80 | 82 | -H "Authorization: token ${GH_TOKEN}" \ |
81 | 83 | "${STATUS_URL}" \ |
82 | | - -d "{\"state\":\"success\",\"context\":\"security-review / report\",\"target_url\":\"${REPORT_URL}\"}" |
83 | | -
|
84 | | - - name: Update commit status - fail |
85 | | - if: steps.codebuild.outputs.blocking == 'true' |
86 | | - shell: bash |
87 | | - env: |
88 | | - GH_TOKEN: ${{ github.token }} |
89 | | - STATUS_URL: ${{ github.api_url }}/repos/${{ github.repository }}/statuses/${{ github.event.pull_request.head.sha }} |
90 | | - REPORT_URL: https://d28bfvmis1skm5.cloudfront.net/${{ github.event.repository.name }}/pr-${{ github.event.pull_request.number }}/${{ github.event.pull_request.head.sha }}.html |
91 | | - run: | |
92 | | - curl -sS -X POST \ |
93 | | - -H "Authorization: token ${GH_TOKEN}" \ |
94 | | - "${STATUS_URL}" \ |
95 | | - -d "{\"state\":\"failure\",\"context\":\"security-review / report\",\"target_url\":\"${REPORT_URL}\"}" |
| 84 | + -d "{\"state\":\"${STATE}\",\"context\":\"security-review / report\",\"target_url\":\"${REPORT_URL}\"}" |
0 commit comments