Skip to content

Property job_workflow_sha in context github is not available #2417

@mbeckh

Description

@mbeckh

Describe the bug
The property github.job_workflow_sha is not set in a job using a reusable workflow.
Documentation at https://docs.github.com/en/actions/learn-github-actions/contexts#github-context states that "For jobs using a reusable workflow, the commit SHA for the reusable workflow file.".

To Reproduce
.github/workflows/test.yml:

name: Test
on:
  push:
jobs:
  test:
    uses: ./.github/workflows/reuse.yml

.github/workflows/reuse.yml:

name: Reuse
on:
  workflow_call:
jobs:
  reuse:
    runs-on: ubuntu-latest
    steps:
    - shell: bash
      run: echo 'github: ${{toJSON(github)}}'

The context github is printed, but there is no key job_workflow_sha. The output of ${{github.job_workflow_sha}} is empty.

The behavior is the same whether reuse.yml is in the same repository as test.yml or in a different repository.

Expected behavior
There is a key job_workflow_sha matching the commit SHA of the reusable workflow file as displayed in the job log under "Set up job" as "Uses: <owner>/<repository>/.github/workflows/reuse.yml@refs/heads/<branchname> (<SHA>)".

Runner Version and Platform

Runner version: 2.301.1
Platform: Ubuntu 22.04.1 LTS
Runner Image: ubuntu-22.04 20230129.2

What's not working?

The property job_workflow_sha is not available in the context github of the reusable workflow although the documentation states it should be there.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions