GHA reusable workflow succeeds with workflow_dispatch client but fails with push client

23 Views Asked by At

I have the following 3 GHA workflows. Note that reusable.yml lives in its own repo:

push-client.yml:

name: Execute on push

on:
  push: 

jobs:
  deploy: 
    uses: <my-org>/<reusable-workflow-repo>/.github/workflows/reusable.yml@main
    with:
      runner: 'WinRunner1'
      import-submodules: 'recursive'
    secrets:
      repo_token: ${{ secrets.REPO_READ_PAT }}

workflow-dispatch.yml:

name: Execute on manual click

on:
  workflow_dispatch:
    inputs:
      runner:
        required: true
        type: choice
        options:
          - 'WinRunner1'
          - 'WinRunner2'
      import-submodules:
        type: choice
        required: true
        options:
          - 'recursive' #All submodule levels
          - 'true' #Only first submodule level
          - 'false'

jobs:
  deploy: 
    #name: Call Reusable Workflow
    uses: <my-org>/<my-reusable-repo>/.github/workflows/reusable.yml@main
    with:
      runner: ${{ github.event.inputs.runner }}
      import-submodules: ${{ github.event.inputs.import-submodules }}
    secrets:
      repo_token: ${{ secrets.REPO_READ_PAT }}

reusable.yml:

name: Reusable 

on:
  workflow_call:
    inputs:
      runner:
        required: true
        type: string
      import-submodules:
        type: string
        required: true
    secrets:
      repo_token:
        description: 'PAT with access to caller repo + submodules. If no submodules, native GITHUB_TOKEN works.'
        required: true

jobs:
  checkout: 
    runs-on: ${{ github.event.inputs.runner }}
    steps:
      - name: Checkout Repository without Submodules
        uses: actions/checkout@v4
        if: ${{ github.event.inputs.import-submodules == 'false' }}
        with:
          token: ${{ secrets.REPO_TOKEN }}
      - name: Checkout Repository with Submodules
        uses: actions/checkout@v4
        if: ${{ github.event.inputs.import-submodules == 'true' }}
        with:
          submodules: true
          token: ${{ secrets.REPO_TOKEN }}
      - name: Checkout Repository with Recursive Submodules
        uses: actions/checkout@v4
        if: ${{ github.event.inputs.import-submodules == 'recursive' }}
        with:
          submodules: recursive
          token: ${{ secrets.REPO_TOKEN }}
      - name: Checkout reusable workflow's repo to access Python scripts hosted there
        uses: actions/checkout@v4
        with:
          repository: <my-org>/<reusable-workflow-repo>
          token: ${{ secrets.REPO_TOKEN }}
          path: reusable-workflow-repo

Why does workflow-dispatch.yml succeed but push-client.yml fails?

The error message from push-client.yml is: Error when evaluating 'runs-on' for job 'checkout'. <my-org>/<reusable-workflow-repo>/.github/workflows/reusable.yml@main (Line: 19, Col: 14): Unexpected value ''

In contrast, workflow-dispatch.yml passes 'WinRunner1' correctly, and reusable.yml executes as expected on the 'WinRunner1' runner machine.

0

There are 0 best solutions below