Skip to content

Commit 8b0d832

Browse files
committed
fix: commit sha for manual trigger
1 parent 4dad94c commit 8b0d832

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
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_EVENT_WORKFLOW_RUN_HEAD_SHA" ] || [ -z "$GITHUB_TOKEN" ] || [ -z "$GITHUB_RUN_ID" ]; then
4+
if [ -z "$GITHUB_REPOSITORY" ] || [ -z "$COMMIT_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_EVENT_WORKFLOW_RUN_HEAD_SHA} \
72+
https://api.github.com/repos/${GITHUB_REPOSITORY}/statuses/${COMMIT_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: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,15 @@ jobs:
4747
- name: Checkout code
4848
uses: actions/checkout@v4
4949
with:
50-
ref: ${{ github.event.workflow_run.head_sha }}
50+
ref: ${{ env.COMMIT_SHA }}
5151

5252
- name: Set pending commit status
5353
id: set-pending-status
5454
run: |
5555
echo "timestamp=$(date +%s)" >> $GITHUB_OUTPUT
5656
curl -X POST -H "Authorization: Bearer ${{ github.token }}" \
5757
-H "Accept: application/vnd.github+json" \
58-
https://api.github.com/repos/${{ github.repository }}/statuses/${{ github.event.workflow_run.head_sha }} \
58+
https://api.github.com/repos/${{ github.repository }}/statuses/${{ env.COMMIT_SHA }} \
5959
-d "{\"state\": \"pending\", \"context\": \"Backend Tests : ${{env.BASE_URL}}\", \"target_url\": \"https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}\"}"
6060
6161
@@ -186,3 +186,4 @@ env:
186186
BASE_URL: https://${{inputs.deployment || 'govtool.cardanoapi.io/api' }}
187187
REPORT_NAME: govtool-backend
188188
GH_PAGES: ${{vars.GH_PAGES}}
189+
COMMIT_SHA: ${{ github.event.workflow_run.head_sha || github.sha }}

.github/workflows/test_integration_playwright.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,14 @@ jobs:
4949
steps:
5050
- uses: actions/checkout@v4
5151
with:
52-
ref: ${{ github.event.workflow_run.head_sha }}
52+
ref: ${{ env.COMMIT_SHA }}
5353
- name: Set pending commit status
5454
id: set-pending-status
5555
run: |
5656
echo "timestamp=$(date +%s)" >> $GITHUB_OUTPUT
5757
curl -X POST -H "Authorization: Bearer ${{ github.token }}" \
5858
-H "Accept: application/vnd.github+json" \
59-
https://api.github.com/repos/${{ github.repository }}/statuses/${{ github.event.workflow_run.head_sha }} \
59+
https://api.github.com/repos/${{ github.repository }}/statuses/${{ env.COMMIT_SHA }} \
6060
-d "{\"state\": \"pending\", \"context\": \"Playwright Tests : ${{env.HOST_URL}}\", \"target_url\": \"https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}\"}"
6161
6262
- uses: actions/setup-node@v4
@@ -225,3 +225,4 @@ env:
225225
HOST_URL: https://${{inputs.deployment || 'govtool.cardanoapi.io' }}
226226
REPORT_NAME: govtool-frontend
227227
GH_PAGES: ${{vars.GH_PAGES}}
228+
COMMIT_SHA: ${{ github.event.workflow_run.head_sha || github.sha }}

0 commit comments

Comments
 (0)