Skip to content

Commit

Permalink
Change JOB_NAME name
Browse files Browse the repository at this point in the history
  • Loading branch information
vmilosevic committed Oct 25, 2024
1 parent 627c5cd commit 6f5e09d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,12 @@ jobs:
echo "build-output-dir=$(pwd)/build" >> "$GITHUB_OUTPUT"
# Github job context unfortunately doesn't contain job_id, this is the workaround how to fetch it using GH API
# Example : build-and-test (runner, 2)
JOB_NAME="${{ github.job }} (${{ matrix.build.runs-on }}, ${{ matrix.test_group_id }})"
echo "Expected job name: $JOB_NAME"
JOB_ID=$(curl -s -H "Authorization: token ${{ github.token }}" \
"https://api.github.com/repos/${{ github.repository }}/actions/runs/${{ github.run_id }}/jobs" | \
jq -r '.jobs[] | select(.name | contains("${{ github.job }}")) | .id')
jq -r '.jobs[] | select(.name | contains("$JOB_NAME")) | .id')
echo "Current job id: $JOB_ID"
echo "job-id=$JOB_ID" >> "$GITHUB_OUTPUT"
Expand Down

0 comments on commit 6f5e09d

Please sign in to comment.