GitHub Actions: Write Docker container actions - required input is not passed to action

While running through the steps where I modify my action / workflow to start accepting inputs, I found that a Required input in the action.yml is not passed to the script if it’s not overriden in the workflow yml.

e.g.
action.yml

name: "my hello action"

description: "say hello with GitHub Actions"

inputs:
  firstGreeting:
    description: "who would you like to greet in the console"
    required: true
    default: "Hubot"

  secondGreeting:
    description: "another person to greet"
    required: true
    default: "Mona the Octocat"

  thirdGreeting:
    description: "a third greeting"
    required: false

runs:
  using: "docker"
  image: "Dockerfile"

firstGreeting is overriden in the workflow with “Learning Lab User” but the second greeting does not show up in the output.
I would expect to see:
Hello Learning Lab User
Hello Mona the Octocat

but instead I see
Hello Learning Lab User
Hello

If I specify secondGreeting in the workflow yml as an input, it works as expected, but the default value does not get passed to the Go script otherwise.

I came back to look at this while discussing Github Actions with a friend.
I realised that I had put the action.yml in the wrong place! I moved it to the actions/hello-world/ directory and it now works. My own fault, misread the instructions!

1 Like