fix(ci): remove invalid environments permission from preview workflow#70
Merged
kentcdodds merged 1 commit intomainfrom Apr 12, 2026
Merged
Conversation
GitHub Actions workflow permissions only allow a fixed set of keys; 'environments' is not valid and caused workflow validation to fail on push. Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
|
🔎 Preview deployed: https://epicflare-pr-70.kentcdodds.workers.dev Worker: Mocks:
|
cursor bot
pushed a commit
that referenced
this pull request
Apr 12, 2026
The cleanup job calls DELETE /repos/.../environments/... which returns 403 for the default GITHUB_TOKEN. PR #70 removed invalid workflow permission environments: write, which did not fix token scope anyway. Catch 403 so PR-close cleanup succeeds after Cloudflare teardown. Use optional secret PREVIEW_ENV_CLEANUP_TOKEN when a repo wants automatic environment removal, and document it in the setup guide. Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
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.
Problem
The push after merging #67 failed workflow validation because
.github/workflows/preview.ymlwas invalid: the top-levelpermissionsblock includedenvironments: write, which is not a supported key in GitHub Actions’ workflow permissions schema. GitHub reported:(Line: 43, Col: 3): Unexpected value 'environments'.This is unrelated to Vitest itself; the same push re-validated all workflows, so the invalid
preview.ymlfrom #69 surfaced.Change
Remove the invalid
environments: writeline. The cleanup job already deletes GitHub environments via the REST API usinggithub-script, which uses the defaultGITHUB_TOKENpermissions for that API call.Verification