Passing in secrets to reusable workflow does not work without secrets in env
See original GitHub issueWe are trying out Github Actions and have run into a curious issue which we think is a bug. We have configured secrets at the organization level, and are trying to pass those secrets in to a reusable workflow as shown below:
name: example
on:
pull_request:
branches:
- gh-actions
jobs:
test:
uses: northvolt/example/.github/workflows/review-common.yml@gh-actions
secrets:
password: ${{ secrets.PASSWORD }}
This does not work. password
shows up blank in the reusable workflow instead of having the value of the secret.
If we instead add env: ${{ secrets }}
to the top-level of the manifest, all of a sudden the secret gets passed in to the workflow. This seems quite counterintuitive since passing in secrets should not be related to the env, and this behavior does not appear to be documented anywhere. In fact, this example of secrets in reusable workflows does not need an env
key set at the top-level.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:9
- Comments:18
Top Results From Across the Web
Environment Secrets are not available on Reusable ...
Problem : Passing an environment containing secrets to a reusable workflow is not enough to have the environment secrets avaiable.
Read more >Consuming Environment Secrets in Reusable Workflows
The documentation explains that reusable workflows can access secrets via the secrets keyword, and does mention environments, but it's not very ...
Read more >Referencing environment secrets in reusable workflows
I have been able to pass and reference organization and repository secrets in reusable workflows without any issues. The problem(bug) is ...
Read more >GitHub Actions fails to fetch secrets within reusable workflows
1. Explicitly add secrets to the reusable workflow – similar to inputs – and pass each of them individually from the parent workflow....
Read more >Simplify using secrets with reusable workflows
GitHub Actions simplifies using secrets with reusable workflows with the secrets: inherit keyword. Previously when passing secrets to a reusable ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
For future me:
secrets:inherit
fixed it for me: In the calling job:*edited typo
Spent hours on this dreaded issue. CircleCI is so much better when it comes to re-usability. Github Actions lack good documentation and features!