-
Notifications
You must be signed in to change notification settings - Fork 65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
output token cannot be used across jobs #66
Comments
Hi, thanks for reporting this! This is a “necessity and sufficiency” issue: Setting I don’t think masking should be optional. Instead, we should document how to use tokens across jobs. There are a few workable techniques, such as ‘storing the token as a repository secret’ or ‘encrypting the token and outputting the (unmasked) encrypted value’. In your case, implementing one of these techniques would required you to add another step to your |
I think it would be great to document a working example of "use token across jobs" usecase in the README. And yes we should make clear that tokens cannot be passed as job output in clear text. I think the GitHub Actions documentation mentions it somewhere and suggests to use a secrets service, but I couldn't find it right now |
We're running into the same frustration. Our use case is to pass the token from one job to a reusable workflow which consumes it downstream. Our reusable workflow is a wrapper around terraform, so refactoring it to get the token for itself reduces the genericity of the workflow which is currently configured to take in a generic secret. We're currently working around this using a classic PAT which GH suggests shouldn't be neceessary. Here's the documentation that @gr2m is likely thinking about. It recommends sending the secret to hashicorp's vault and then fetching from it, which is not a light-weight approach for a secret which by definition is only valid for ten minutes. As a customer of GitHub Enterprise, I'd like to see GH relax the In the meantime, reading #55, it seems like @smockle may have a workable solution. Can you share how you're using the token you skip revoking? |
I think even when the token is not masked by our action, and not revoked in the post job, GitHub will still not permit you to set an output to token that it recognizes as such, I ran into this before. There is some kind of automated masking in place for tokens. |
I realized I didn't say thank you to everyone who has contributed to this action. We're beginning to eliminate our PATs in our org, and this is trusted and helpful, which is exactly what we need. Another use case we have is building container images. We have a reusable workflow for that, it needs to check out multiple internal repos to build the stuff and it can't because we can't pass the token from the job that fetches it to a build argument in the job that builds the stuff. Elaborating on the ask to relax the While I'm sure GH would prefer that there not be any tokens getting accidentally written to logs or exfiltrated, I suspect GH would be happier to have an app's 10 minute token get leaked than an individual or machine account's long lived PAT get leaked. |
can you try writing the token to an environment variable and see if that environment variable is accessible in other jobs? |
I assume by environment variable you're talking about using GITHUB_ENV? I tested that out in this repo using clear text data so it'd be easier to follow and I wasn't able to update an environment variable's value in one job and have it persist to the second :( Stepping through my test bench, I initially set environment variables for the workflow as a whole:
Then update it:
Then echo it in a second step to validate that it was updated:
And finally I echo it in a second job to see if I can pass the value down the line:
And unfortunately, I find that in the second job, |
Thank you for testing this. I reached out to the actions team, and unfortunately there is not a simple and safe solution to this problem. Feedback I got is
The only way I can think is to re-run the What exactly is your use case? |
thanks for the feedback! my computer was down for a little bit, so i'm still getting caught up 😅
the bit before the phrasing question (adjusted for context, if necessary) would be perfect haha
would it be possible to incorporate one of those suggestions into this action? |
I would rather not. This is not working for a reason. I would rather document a workaround and explain why it is necessary. I think in many cases I would recommend to use the action in each job, instead of passing the token via jobs outputs. |
i'm not a fan of copying one of those techniques from repo to repo, and there are a few cases where i'd rather not use the action in each job, so i'll most likely implement an action that suits more of my needs. this issue can be closed. thanks though! |
Hi everyone, I ran into this exact situation where I need to set up a token that can write to the registry. Before migrating to an organization, I used my own PAT, but now it's a bit more tricky, so we need a GitHub App. After reading these topics, I would like to confirm that for now the only viable solution is to call this action before each job that needs a token ? Thank you. |
Yes, that is correct. |
Current behavior
Output tokens cannot be used across jobs. This causes jobs that depend on said token to fail.
Using
skip-token-revoke
does not allow a token to be used across jobs, which is what this wording seems to imply.Possible solutions
action: 'revoke'
)Additional context
Action summary screenshot
The text was updated successfully, but these errors were encountered: