Skip to content

Commit

Permalink
Move job name to env
Browse files Browse the repository at this point in the history
  • Loading branch information
vmilosevic committed Oct 28, 2024
1 parent 782f2f8 commit dfc6c02
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,17 +65,18 @@ jobs:
- name: Set reusable strings
id: strings
shell: bash
env:
job-name: "${{ github.job }} (${{ matrix.build.runs-on }}, ${{ matrix.test_group_id }})"

run: |
echo "work-dir=$(pwd)" >> "$GITHUB_OUTPUT"
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, 1)
JOB_NAME="${{ github.job }} (${{ matrix.build.runs-on }}, ${{ matrix.test_group_id }})"
echo "Expected job name: $JOB_NAME"
echo "Expected job name: ${{ env.job-name }}"
JOB_ID=$(curl -s -H "Authorization: token $GH_TOKEN" \
"https://api.github.com/repos/tenstorrent/tt-forge-fe/actions/runs/11514644813/jobs" | \
jq -r '.jobs[] | select(.name | contains("'"${JOB_NAME}"'")) | .id ')
jq -r '.jobs[] | select(.name | contains("${{ env.job-name }}")) | .id ')
echo "Current job id: $JOB_ID"
echo "job-id=$JOB_ID" >> "$GITHUB_OUTPUT"
Expand Down

0 comments on commit dfc6c02

Please sign in to comment.