@@ -25,6 +25,8 @@ permissions:
2525 pull-requests : write
2626 # Authenticate with GCP.
2727 id-token : write
28+ # Report commit status.
29+ statuses : write
2830
2931jobs :
3032 review :
3436 env :
3537 PR_NUMBER : ${{ github.event.workflow_run.pull_requests[0].number }}
3638 PREFIX : pr${{ github.event.workflow_run.pull_requests[0].number }}
39+ STATUS_PATH : repos/${{ github.repository }}/statuses/${{ github.event.workflow_run.pull_requests[0].head.sha }}
40+ STATUS_CONTEXT : pr-review-companion
41+ STATUS_TARGET : ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
3742 steps :
3843 - name : Download artifact
3944 uses : actions/download-artifact@v5
4954 if : hashFiles('build/') != ''
5055 run : echo "HAS_ARTIFACT=true" >> "$GITHUB_OUTPUT"
5156
57+ - name : Mark status as pending
58+ if : steps.check.outputs.HAS_ARTIFACT
59+ env :
60+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
61+ run : |
62+ gh api "$STATUS_PATH" \
63+ -f state=pending \
64+ -f context="$STATUS_CONTEXT" \
65+ -f description='Review deployment pending' \
66+ -f target_url="$STATUS_TARGET"
67+
5268 - name : Authenticate with GCP
5369 if : steps.check.outputs.HAS_ARTIFACT
5470 uses : google-github-actions/auth@v3
@@ -112,3 +128,25 @@ jobs:
112128 --pr-number="$PR_NUMBER" \
113129 --diff-file=$BUILD_OUT_ROOT/DIFF \
114130 $BUILD_OUT_ROOT
131+
132+ - name : Mark status as success
133+ if : steps.check.outputs.HAS_ARTIFACT && success()
134+ env :
135+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
136+ run : |
137+ gh api "$STATUS_PATH" \
138+ -f state=success \
139+ -f context="$STATUS_CONTEXT" \
140+ -f description='Review deployment succeeded' \
141+ -f target_url="$STATUS_TARGET"
142+
143+ - name : Mark status as failure
144+ if : steps.check.outputs.HAS_ARTIFACT && failure()
145+ env :
146+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
147+ run : |
148+ gh api "$STATUS_PATH" \
149+ -f state=failure \
150+ -f context="$STATUS_CONTEXT" \
151+ -f description='Review deployment failed' \
152+ -f target_url="$STATUS_TARGET"
0 commit comments