Skip to content

Reusable Workflows - predefined variables load for the called job #2577

@orizerah

Description

@orizerah

Describe the bug
The environment variables that the runner loads contain information only about the called job and not about the caller.
For example: Assuming we have a workflow with a job build, which uses another workflow with a job called test, the job name in GitHub will be build / test, but the value of GITHUB_JOB will be test.
This denies me from having access in runtime to data about the job.

To Reproduce
Steps to reproduce the behavior:
Go to a GitHub repository and create 2 workflows:
called.yaml

name: Called
on: workflow_call
jobs:
  child:
    runs-on: ubuntu-latest
    steps:
       - name: Print Envs
         runs: prinenv

caller.yaml

name: Caller
on: workflow_dispatch
jobs:
  parent:
  uses: ./.github/workflows/called.yaml

Expected behavior
There should be a GITHUB_JOB_ID env with the correct job id
The GITHUB_JOB env should include the full name of the actual job.

Runner Version and Platform

ubuntu-latest

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions