Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Github actions/github-script not printing input

I have the following reusable

on:
  workflow_call:
    inputs:
      base_os:
        description: "The base os"
        type: string
        required: true


jobs:
  upstream-image-name:
    name: get the image name for the upstream image
    runs-on: ubuntu-latest

    steps:

      - name: get upstream image name
        id: upstream-image-name-step
        uses: actions/github-script@v6
        with:
          result-encoding: string
          script:
            console.log('base_os =', core.getInput('base_os'))

I am invoking it as follows

on:
  push:
    branches:
      - reusable-runtime

jobs:
  invoke-reusable:
    name: test invocation of reusable
    uses: Repo/Owner/.github/workflows/reusable_runtime.yaml@reusable-runtime
    with:
      base_os: debian

The logs

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Run actions/github-script@v6
base_os = 

What am I missing?

>Solution :

The core.getInput will not take directly inputs from the workflow inputs. You need to pass it through like this:

on:
  workflow_call:
    inputs:
      base_os:
        description: "The base os"
        type: string
        required: true


jobs:
  upstream-image-name:
    name: get the image name for the upstream image
    runs-on: ubuntu-latest

    steps:

      - name: get upstream image name
        id: upstream-image-name-step
        uses: actions/github-script@v6
        with:
          result-encoding: string
          base_os: ${{ inputs.base_os }}
          script:
            console.log('base_os =', core.getInput('base_os'))
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading