GitHub Action
Job Context
Provides additional context for the currently running job. GitHub Actions provides a job
context but is missing some pieces including the job name and the job ID (the numeric value as used by the GitHub API).
The job-context
action requires that the job in which this action is used has a job name that is unique within the workflow file. By default job names are unique so this is only a problem if you specify a custom jobs.<job_key>.name
. If the job name is not unique within the workflow this action will fail and report the ambiguous job name.
Additionally, this job currently does not support job names which utilize GHA expressions using the contexts: needs
, vars
, or inputs
.
# CI.yaml
jobs:
demo:
name: Demo
# These permissions are needed to:
# - Use `job-context`: https://github.com/beacon-biosignals/job-context#permissions
permissions:
actions: read
contents: read
runs-on: ubuntu-latest
strategy:
matrix:
version:
- "1.0"
- "2.0"
steps:
- uses: beacon-biosignals/job-context@v1
id: job
- run: |
echo "job-name=${{ steps.job.outputs.name }} # e.g. Demo (1.0)
echo "job-id=${{ steps.job.outputs.id }} # e.g. 28842064821
The job-context
action does not support any inputs.
Name | Description | Example |
---|---|---|
name |
The rendered job name. |
|
id |
The numeric job ID as used by the GitHub API. Not be be confused with the workflow job key github.job . |
|
The following job permissions are required to run this action:
permissions:
actions: read # Required for non-public repositories
contents: read