Skip to content
box

GitHub Action

Job Context

v1.1.1 Latest version

Job Context

box

Job Context

Provides additional context for the currently running job

Installation

Copy and paste the following snippet into your .yml file.

              

- name: Job Context

uses: beacon-biosignals/[email protected]

Learn more about this action in beacon-biosignals/job-context

Choose a version

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).

Requirements

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.

Examples

# 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

Inputs

The job-context action does not support any inputs.

Outputs

Name Description Example
name The rendered job name.
Demo (1.0)
id The numeric job ID as used by the GitHub API. Not be be confused with the workflow job key github.job.
28842064821

Permissions

The following job permissions are required to run this action:

permissions:
  actions: read  # Required for non-public repositories
  contents: read