I want to get the exact jobId in the job I defined, but I use ${{github.job}} to get the name (deploy job). The exact address is this: https://github.com/xxxxx/my-repo/actions/runs/5888912298/job/15971069222
my code: (https://github.com/${owner}/${repo}/actions/runs/${context.runId}/job/${{github.job}})`
Get the exact jobId
GitHub doesn't official support retrieving Job ID
from inside the job at the moment.
But this is available as an api response from:
https://api.github.com/repos/$REPOSITORY/actions/runs/$RUN_ID/jobs
So you can have a step like:
job_url="https://api.github.com/repos/$REPOSITORY/actions/runs/$RUN_ID/jobs"
job_id=$(curl -s -H "Authorization: token ${{ env.token }}" $job_url | jq -r '.jobs[] | .id')
Notes:
RUN_ID
using ${{ github.run_id }}
.jq
to be able to parse the JSON response.