Referencing token from a different job

Hello

I have a workflow with a number of jobs, the first job uses an action that returns the temporary github app installation token for use with subsequent jobs which require privileges greater than what GITHUB_TOKEN gives you.

At the end of the workflow I need to clean up various things which relies on knowing the token generated in the first job. However I can’t find a way of passing the token output to another job - is that possible?

Or should I go down the path of creating a repository environment secret with the token value, and then reference that secret from jobs that need it?

Many thanks

:wave: Hey @biatwc,

Normally I’d recommend using job outputs to pass information between jobs, but that’s not recommended for passing secrets:
https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idoutputs

I’d suggest storing the token value as a repository secret so that both jobs can reference it securely.