Skip to content

Commit 457a42b

Browse files
committed
fix: update commit status API to use workflow run head SHA
1 parent 52cbbaf commit 457a42b

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

.github/scripts/set_commit_status.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/bash
22

33
# Ensure required environment variables are set
4-
if [ -z "$GITHUB_REPOSITORY" ] || [ -z "$GITHUB_SHA" ] || [ -z "$GITHUB_TOKEN" ] || [ -z "$GITHUB_RUN_ID" ]; then
4+
if [ -z "$GITHUB_REPOSITORY" ] || [ -z "$GITHUB_EVENT_WORKFLOW_RUN_HEAD_SHA" ] || [ -z "$GITHUB_TOKEN" ] || [ -z "$GITHUB_RUN_ID" ]; then
55
echo "Missing required environment variables!"
66
exit 1
77
fi
@@ -69,7 +69,7 @@ fi
6969
# Send commit status update to GitHub
7070
curl -X POST -H "Authorization: Bearer ${GITHUB_TOKEN}" \
7171
-H "Accept: application/vnd.github+json" \
72-
https://api.github.com/repos/${GITHUB_REPOSITORY}/statuses/${GITHUB_SHA} \
72+
https://api.github.com/repos/${GITHUB_REPOSITORY}/statuses/${GITHUB_EVENT_WORKFLOW_RUN_HEAD_SHA} \
7373
-d "{\"state\": \"${TEST_STATUS}\", \"context\": \"${CONTEXT}\", \"description\": \"${DESCRIPTION}\", \"target_url\": \"${TARGET_URL}\"}"
7474

7575
echo "Commit status updated successfully!"

.github/workflows/test_backend.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ jobs:
5353
echo "timestamp=$(date +%s)" >> $GITHUB_OUTPUT
5454
curl -X POST -H "Authorization: Bearer ${{ github.token }}" \
5555
-H "Accept: application/vnd.github+json" \
56-
https://api.github.com/repos/${{ github.repository }}/statuses/${{ github.sha }} \
56+
https://api.github.com/repos/${{ github.repository }}/statuses/${{ github.event.workflow_run.head_sha }} \
5757
-d "{\"state\": \"pending\", \"context\": \"Backend Tests : ${{env.BASE_URL}}\", \"target_url\": \"https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}\"}"
5858
5959

.github/workflows/test_integration_playwright.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ jobs:
5454
echo "timestamp=$(date +%s)" >> $GITHUB_OUTPUT
5555
curl -X POST -H "Authorization: Bearer ${{ github.token }}" \
5656
-H "Accept: application/vnd.github+json" \
57-
https://api.github.com/repos/${{ github.repository }}/statuses/${{ github.sha }} \
57+
https://api.github.com/repos/${{ github.repository }}/statuses/${{ github.event.workflow_run.head_sha }} \
5858
-d "{\"state\": \"pending\", \"context\": \"Playwright Tests : ${{env.HOST_URL}}\", \"target_url\": \"https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}\"}"
5959
6060
- uses: actions/setup-node@v4

0 commit comments

Comments
 (0)