Skip to content

qoomon/actions--context

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Repository files navigation

Enhanced Job Context   Actions

This action provides an enhanced job context for GitHub Actions.

Note

If you're missing a context value feel free to open a feature request

Usage

Important

For usage within a reusable workflow, see Usage within Reusable Workflows

jobs:
  example:
    runs-on: ubuntu-latest
    environment: playground
    steps:
      - uses: qoomon/actions--context@v2
        id: context

      - run: |
          echo "Current Environment: ${{ steps.context.outputs.environment }}"
          echo "Job Logs: ${{ steps.context.outputs.job_log_url }}"

Outputs

outputs:
  job:
    description: The workflow job name of the current job.
  job_id:
    description: The workflow run job id of the current job.
  job_log_url:
    description: The HTML url of the job log for the current job.

  run_id:
    description: The workflow run id of the current job.
  run_attempt:
    description: The workflow run attempt of the current job.
  run_number:
    description: The workflow run number of the current job. Same as `github.run_number`.

  environment:
    description: The environment of the current job.
  environment_url:
    description: The environment HTML url of the current job.

  deployment_id:
    description: The deployment id of the current job.
  deployment_url:
    description: The deployment HTML url of the current job.
  deployment_workflow_url:
    description: The deployment workflow HTML url of the current job.
  deployment_log_url:
    description: The deployment log HTML url of the current job.

Usage within Named Jobs

jobs:
  example:
    name: Example Job
    runs-on: ubuntu-latest
    steps:
      - uses: qoomon/actions--context@v2
        id: context
        with:
          job-name: Example Job

Usage within Reusable Workflows

Main Workflow
jobs:
  reusable-job:
    strategy:
      matrix:
        node-version: [ 22.x, 20.x ]
    uses: ./.github/workflows/example-reusable.yml
    with:
      # IMPORTANT ensure first value match the surrounding job name
      # IMPORTANT If the surrounding workflow is a reusable workflow itself, append ', ${{ inputs.workflow-context }}'
      workflow-context: reusable-job, ${{ toJSON(matrix) }}
Reusable workflow
on:
  workflow_call:
    inputs:
      workflow-context:
        type: string

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
      - uses: qoomon/actions--context@v2
        id: context
        with:
          workflow-context: ${{ inputs.workflow-context }}

Release New Action Version

  • Trigger the Release workflow
    • The workflow will create a new release with the given version and also move the related major version tag e.g. v1 to point to this new release