Skip to content

Commit 67e7cd8

Browse files
committed
Incorporate feedback
1 parent 19aa538 commit 67e7cd8

1 file changed

Lines changed: 7 additions & 18 deletions

File tree

.github/workflows/security-review.yml

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
id: authorization
2121
uses: ./.github/actions/check-authorization
2222

23-
security-review:
23+
execute:
2424
needs: authorize
2525
runs-on: ubuntu-latest
2626
environment: ${{ needs.authorize.outputs.approval-env }}
@@ -36,7 +36,7 @@ jobs:
3636
- name: Get AWS credentials
3737
uses: aws-actions/configure-aws-credentials@v4
3838
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
4040
role-session-name: ${{ github.run_id }}-${{ github.run_attempt }}
4141
aws-region: us-west-2
4242

@@ -68,28 +68,17 @@ jobs:
6868
REVIEW_STATUS=$(aws codebuild batch-get-builds --ids "${BUILD_ID}" --query 'builds[0].exportedEnvironmentVariables[?name==`REVIEW_STATUS`].value' --output text)
6969
echo "blocking=$([[ "$REVIEW_STATUS" == "FAIL" ]] && echo true || echo false)" >> "$GITHUB_OUTPUT"
7070
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'
7373
shell: bash
7474
env:
7575
GH_TOKEN: ${{ github.token }}
7676
STATUS_URL: ${{ github.api_url }}/repos/${{ github.repository }}/statuses/${{ github.event.pull_request.head.sha }}
7777
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 }}
7879
run: |
80+
STATE=$([[ "$BLOCKING" == "true" ]] && echo "failure" || echo "success")
7981
curl -sS -X POST \
8082
-H "Authorization: token ${GH_TOKEN}" \
8183
"${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

Comments
 (0)