Repository navigation
Conversation
The generate job is the only job that reads TOKENLIST_SECRET. Declaring the publish environment lets the secret move out of repository-level Actions secrets, where a workflow pushed on any branch can read it, into an environment that only main may use.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Repository-level Actions secrets are handed to any workflow run in the repository, including a workflow file pushed on a fresh branch. A secret stored in an environment is handed only to jobs that declare that environment, and an environment whose deployment branch policy allows only
mainrefuses jobs from any other ref. So a workflow pushed on a new branch can no longer read it.TOKENLIST_SECRETis used only by thegeneratejob ingenerate.yml, which runs on push tomain(pathsdata/**,src/**, the workflow itself) and on manual dispatch. Every run of that workflow so far has been onmain. This PR addsenvironment: publishto that job and changes nothing else.lint.ymlandvalidate.ymluse no secrets and are unchanged.Secret -> environment
TOKENLIST_SECRETpublishmainonlydata/orsrc/, so approvals are infrequent.Maintainer steps, in order
publish.mainonly.TOKENLIST_SECRETinpublish.TOKENLIST_SECRET(Settings -> Secrets and variables -> Actions -> Repository secrets).Until this PR is merged, a push to
mainthat triggersgeneratewill fail because the job cannot see the environment secret yet. Keep this step and the next one close together.main(workflow_dispatch) once to confirm it works. Manual runs must be started frommain; the environment refuses other branches.Do not merge before step 1. Otherwise the first run creates
publishautomatically with no branch policy.Secrets still needed on unprotected refs
None. No
pull_requestor other-branch job reads a secret.Follow-up (not in this PR)
actions/setup-nodealso receivesTOKENLIST_SECRETastoken. That input is only used to download Node.js from GitHub and works with the default token. Passing the write token there is not needed.