Invalid secret, github-token is not defined in the referenced workflow

I have the following GitHub Action setup for reuse:

I am reusing it here: mdn-minimalist/auto-merge.yml at 4c2fd5a9fe02c844788001064d72d98dc2ef801b · mdn/mdn-minimalist · GitHub

When the action on mdn-minimalist is run, I get the following error:

Invalid secret, github-token is not defined in the referenced workflow

I am kinda stumped as it definitely looks to be defined in the referenced workflow. Any ideas? Is there a naming convention that I am missing? Thing is, the auto-merge action expects a github-token property so, I cannot simply name it token. Thank you in advance.

The reusable workflow needs to declare which secrets can be passed to it, see the documentation on on.workflow_call.secrets. That’s missing in your reusable workflow, you probably need something like this:

on:
  workflow_call:
    secrets:
      GH_TOKEN:
        description: 'A token passed from the caller workflow'
        required: true

And also make sure to use the same name when passing the secret from the calling workflow.

1 Like

Oh brilliant! Thanks so much.

1 Like