Skip to content

fix(ci): remove invalid environments permission from preview workflow#70

Merged
kentcdodds merged 1 commit intomainfrom
cursor/fix-preview-workflow-permissions-9f88
Apr 12, 2026
Merged

fix(ci): remove invalid environments permission from preview workflow#70
kentcdodds merged 1 commit intomainfrom
cursor/fix-preview-workflow-permissions-9f88

Conversation

@kentcdodds
Copy link
Copy Markdown
Member

Problem

The push after merging #67 failed workflow validation because .github/workflows/preview.yml was invalid: the top-level permissions block included environments: 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.yml from #69 surfaced.

Change

Remove the invalid environments: write line. The cleanup job already deletes GitHub environments via the REST API using github-script, which uses the default GITHUB_TOKEN permissions for that API call.

Verification

  • Local: workflow YAML is now structurally valid per GitHub’s schema (no invalid permission keys).
Open in Web Open in Cursor 

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>
@github-actions
Copy link
Copy Markdown

🔎 Preview deployed: https://epicflare-pr-70.kentcdodds.workers.dev

Worker: epicflare-pr-70
D1: epicflare-pr-70-db
KV: epicflare-pr-70-oauth-kv

Mocks:

@kentcdodds kentcdodds merged commit 8f8f184 into main Apr 12, 2026
8 checks passed
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants