'GitHub Actions: How to view inputs for workflow_dispatch?

My idea here is to write my inputs from workflow_dispatch on each pipeline run. ![enter image description here.

For example, in Bitbucket pipelines input parameters shown after custom - enter image description here

Is there a way to do something similar for GitHub?



Solution 1:[1]

Although this does not directly answer your question, I'm adding it here because this is where I landed looking for the answer on how to output all my workflow inputs.

In my case I am using a workflow_dispatch trigger - YMMV if you are using a different trigger, but I suspect it would work the same way.

As with the other answer proposed, you will need to do this as a step within your job:

on:
  workflow_dispatch:
    inputs:
      myInput:
        default: "my input value"
jobs:
  myJob:
    steps:
      - name: Output Inputs
        run: echo "${{ toJSON(github.event.inputs) }}"

This will result in output you can view in your GitHub action execution output with the inputs serialized as JSON:

{
  "myInput": "my input value"
}

Solution 2:[2]

You cannot really alter how they will be displayed on the list I'm afraid.

All you can do is to log your input variables inside action itself, like this:

jobs:
  debugInputs:
    runs-on: ubuntu-latest
    steps:
    - run: |
        echo "Var1: ${{ github.event.inputs.var1 }}"
        echo "Var2: ${{ github.event.inputs.var2 }}" 

If you want to see them in summary, you can use a notice or warning message mark:

Solution 3:[3]

If you have only a few simple input values (from workflow_dispatch) then you can include them in the name of the job:

on:
  workflow_dispatch:
    inputs:
      my_value:
        description: 'My input value'
        required: true
        default: 'foo'
        type: string

jobs:
  my_job:
    name: "My job [my_value: ${{ github.event.inputs.my_value }}]"
    runs-on: ubuntu-latest

    steps:
    ....

This way you will be able to see the input directly in the GitHub UI.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Jon Peterson
Solution 2 Grzegorz Krukowski
Solution 3 briancaffey