GitHub Action
get action job id
v1.7
Latest version
GitHub official has not provide access to the job id by using existing API.
This tool could help you to get job id easier.
Create a workflow *.yml
file in your repositories .github/workflows
directory.
jobs:
get-job-id:
runs-on: ubuntu-latest
name: 'SET-A-NEW-NAME' # change SET-A-NEW-NAME
steps:
- name: set id
id: set-job-id
uses: ayachensiyuan/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
job-name: 'SET-A-NEW-NAME' # must be the same as 'get-job-id.name'
# get id
- name: get id
run: echo "The current job id is ${{ steps.set-job-id.outputs.jobId }}"
jobs:
get-job-id:
runs-on: ubuntu-latest
strategy:
matrix:
cases: ['case1', 'case2', 'case3', 'case4'] # matrix cases
name: ${{ matrix.cases }}
steps:
- name: set id
id: set-job-id
uses: ayachensiyuan/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
job-name: ${{ matrix.cases }} # must be the same as 'get-job-id.name'
# get id
- name: get id
run: echo "The current job id is ${{ steps.set-job-id.outputs.jobId }}"
⚠️ Make sure 'name' field value must be the same as 'job-name' field value. And name must be unique name.
The scripts and documentation in this project are released under the MIT License.