fix(template): keep the job's Forgejo token away from mise in CI #4
Loading…
Reference in a new issue
No description provided.
Delete branch "jonnxor/fix/template-ci-github-token"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
The Forgejo Actions runner sets
GITHUB_TOKENto the job's Forgejo token. mise usesGITHUB_TOKENwhen it asks api.github.com about a tool (ubi, aqua and github backends), so a Forgejo token goes to GitHub and the request fails with 401. Seen on 2026-10-13 in WAAAGH/jonnxor-is PR 3 (run 9, mise 2026.10.8,ubi:lycheeverse/lychee).Fix
GITHUB_TOKEN: ""on each of the three mise steps (mise install,mise run lint,mise run test), with one comment explaining why.Why step level and not job level
The request was a job-level
GITHUB_TOKEN: ""next toMISE_YES, asjonnxor-ishas it. That does not work on this runner:act/runner/step.go:mergeEnvcopies the job env into the step env, thenwithGithubEnvsetsGITHUB_TOKENto the job token unconditionally. Only the step's ownenv:is merged after that.jonnxor-isrun shows otherwise. The commit that added the job-level blank (33a98b9) also moved lychee to a plain URL download, so since run 10 nothing in that job calls the GitHub API. Runs 10–13 pass whether or not the variable is blank.actions/checkoutis unaffected either way: it authenticates with itstokeninput, not the env var, and the mise steps come after it.Tested
copier copy --trust --defaults --vcs-ref HEAD -d project_name=demo, with and withoutuse_sops; bothci.ymlfiles parse as YAML and carry the blank on the three mise steps.MISE_USE_VERSIONS_HOST=0 mise ls-remote github:lycheeverse/lychee): a blankGITHUB_TOKENsucceeds anonymously, a wrong token gets the 401.Follow-up, not in this PR
repos/jonnxor-is/.forgejo/workflows/ci.ymlstill has the job-level line, which does nothing. It is harmless until a tool there needs the GitHub API again.🤖 Generated with Claude Code