Search code examples
github-actions

Is it possible to inherit GitHub secrets and pass additional secrets as well?


When calling a GitHub workflow, is it possible to use both "inherit" and also pass additional GitHub secrets?

E.g.

jobs:
  call-workflow:
    uses: ./.github/workflows/called-workflow.yml
    secrets:
      inherit: true
      ADDITIONAL_SECRET: ${{ secrets.ADDITIONAL_SECRET }}

Solution

  • This is not possible. Using the GitHub Actions for VSCode extension, I have tried this approach:

    secrets:
      inherit: true
      VERCEL_PROJECT_ID: "..."
    

    I got this error:

    Invalid secret, inherit is not defined in the referenced workflow.

    Then, I tried this approach:

    secrets: "inherit"
    secrets:
      VERCEL_PROJECT_ID: "prj_1hHpDxBdgIZYX1MSlwrXWFpMFOlm"
    

    And for this, I have gotten this error:

    secrets is already defined

    There's also this GitHub discussion that suggest that the choice between inherited secrets and explicit secrets is an either/ or kind of thing:

    https://github.com/orgs/community/discussions/23107#discussioncomment-5707861