Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GitHub Action workflow_call does not use up to date input values

I am encountering a strange behaviour with GitHub Action workflow_call.

Basically, everything works fine after the initial setup, but when I edit the input parameters of the workflow files it does not use the updated values. Hard to explain in words, so let me show you an example.

Consider this basic setup:

File: start-pipeline.yml

name: Start Pipeline

on: 
  workflow_dispatch:
    inputs:
      release_type:
        required: true
        type: choice
        options:
        - patch
        - minor
        - major

jobs:
  call-sub-workflow:
    uses: codezalot/workflow-call-issue/.github/workflows/sub-workflow.yml@main
    with:
      release_type: ${{ github.event.inputs.release_type }}

File: sub-workflow.yml

name: Sub Workflow

on: 
  workflow_call:
    inputs:
      release_type:
        type: string
        required: true
 
jobs:
  my-job:
    runs-on: ubuntu-latest
    steps:
      - name: Print Inputs
        run: |
          echo "Release Type: ${{ github.event.inputs.release_type }}"

I then start the pipeline with the value patch and the sub-workflow prints the input just fine:

Result Pipeline #1

I then update the workflow files and add an additional input value like this:

File: start-pipeline.yml

...
jobs:
  call-sub-workflow:
    uses: codezalot/workflow-call-issue/.github/workflows/sub-workflow.yml@main
    with:
      release_type: ${{ github.event.inputs.release_type }}
      some_other_value: ${{ github.event.inputs.release_type }}

File: sub-workflow.yml

...
    inputs:
      ...
      some_other_value:
        type: string
        required: true
 
jobs:
...
        run: |
          echo "Release Type: ${{ github.event.inputs.release_type }}"
          echo "Release Type: ${{ github.event.inputs.some_other_value }}"

I then run the pipeline again, once with release_type patch, once with minor. The value some_other_value is missing however, see:

Result Pipeline #2

Result Pipeline #3.

I have been playing around with this issue for hours, but I do not understand what is going wrong. For it does seem to be using the latest SHA versions of the files, just the input parameters cause an issue.

Does anyone know what's going on here?

like image 329
codezalot Avatar asked Mar 08 '26 07:03

codezalot


1 Answers

According to the documentation: "When a workflow is triggered with the workflow_call event, the event payload in the called workflow is the same event payload from the calling workflow." In other words, the event parameter in the github context is the same for the called workflow as for the original workflow.

Consequently, there is no github.event.input.some_other_value parameter since the original workflow did not have this input. For inputs defined in a reusable workflow you can use the inputs context which contains the input properties passed to the reusable workflow.

To sum up, here is a working sub-workflow.yml file:

name: Sub Workflow

on: 
  workflow_call:
    inputs:
      release_type:
        type: string
        required: true
      some_other_value:
        type: string
        required: true

jobs:
  my-job:
    runs-on: ubuntu-latest
    steps:
      - name: Print Inputs
        run: |
          echo "Release Type: ${{ inputs.release_type }}"
          echo "Release Type: ${{ inputs.some_other_value }}"

Result:

result

like image 112
Matt Avatar answered Mar 11 '26 09:03

Matt