Repository navigation
Fix preview Environment cleanup under GITHUB_TOKEN limits - #33
Merged
Merged
Conversation
Default GITHUB_TOKEN cannot delete Environments (Resource not accessible by integration). Register PR Deployments under a shared `preview` environment, treat legacy preview-pr-* delete denials as expected, and allow optional PREVIEW_ENV_ADMIN_TOKEN for actual legacy env deletion. Co-authored-by: Firtina Ozbalikchi <firtoz@users.noreply.github.com>
Contributor
PR previewStatus Removed. Preview stack destroyed after merge. Links
Updates automatically while the same-repo PR preview workflow runs. |
Operators can clear leftover preview-pr-* Environments after CF destroy without Cloudflare credentials. Document the proper shared-preview fix and one-shot sweep commands. Co-authored-by: Firtina Ozbalikchi <firtoz@users.noreply.github.com>
|
Bugbot is not enabled for your account, so this pull request was not reviewed. Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs. |
This branch was successfully deployed
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.
Summary
Default
GITHUB_TOKENcannot delete GitHub Environments (HttpError: Resource not accessible by integration). Teardown was soft-failing on that delete after a successful Cloudflare destroy.Changes
preview(PR number in payload/description) so teardown only needs to inactivate deploymentspreview-pr-*delete denials as expected (info, not a scary soft-fail warning) when usingGITHUB_TOKENPREVIEW_ENV_ADMIN_TOKEN(classic PAT withrepo) enables actual legacy Environment deletion during teardownCleaning up
preview-pr-31nowbun run preview:cleanup:orphans -- --apply(uses yourghauth, which can delete Environments)Test plan
bun test packages/scripts/src/cleanup-github-preview-env.test.tspreviewdeploysPREVIEW_ENV_ADMIN_TOKENand confirm legacypreview-pr-*envs delete