Skip to content

chore(ci): run PR cleanup in its own workflow so it is never cancelled - #9

Merged
sam-goodwin merged 1 commit into
mainfrom
chore/ci-cleanup-never-cancelled
Oct 7, 2026
Merged

sam-goodwin merged 1 commit into
mainfrom
chore/ci-cleanup-never-cancelled

Conversation

@sam-goodwin

Copy link
Copy Markdown
Collaborator

Cleanup lived in ci.yml, inside the per-PR concurrency group with cancel-in-progress: true:

  • a newer run in that group could cancel cleanup mid-destroy, and
  • the closed run itself cancelled the PR's in-progress CI run, so Test.make's afterAll(destroy) and the demo teardown never ran.

Either way, stages were left behind.

cleanup.yml: its own workflow, never cancelled

on:
  pull_request:
    types: [closed]

concurrency:
  group: cleanup-pr-${{ github.event.number }}
  cancel-in-progress: false

It waits for the PR's CI runs to finish (so nothing deploys after the destroy, and the test suites clean up after themselves), then destroys:

gh api ".../workflows/ci.yml/runs?event=pull_request&branch=$HEAD_REF" \
  --jq '[.workflow_runs[] | select(.status != "completed")] | length'   # poll until 0 (max 60 min)

pnpm exec alchemy destroy --stage pr-$N --yes
pnpm exec alchemy destroy --stage demo-pr-$N --yes
pnpm exec alchemy destroy --stage dev-pr-$N --yes

ci.yml no longer handles closed

-    types: [opened, reopened, synchronize, closed]
+    types: [opened, reopened, synchronize]

Superseded pushes still cancel in-progress PR runs. They reuse the same test-pr-<n> / demo-pr-<n> stages, so the next run deploys over anything the cancelled run left and tears it down at the end.

🤖 Generated with Claude Code

Cleanup shared ci.yml's per-PR concurrency group with cancel-in-progress,
so a newer run in the group could cancel it and leave stages behind; and
closing a PR cancelled its in-progress run before the test suites tore down
their stages. cleanup.yml has its own group, waits for the PR's CI runs to
finish, then destroys the preview and demo stages.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@github-actions

github-actions Bot commented Oct 7, 2026

Copy link
Copy Markdown

Preview deployed

App: https://cafe-web-pr-9-3altvykwkdrowm4o.testing-2b2.workers.dev

Built from commit 53ada1b.


This comment updates automatically with each push.

@github-actions

github-actions Bot commented Oct 7, 2026

Copy link
Copy Markdown

Demo of this preview

Demo of this preview

Video: https://pub-68e74efbba3b4272943c198da363bcab.r2.dev/pr-9/f45c77a7e77ac538d445eb43c3969d00ed24a33c/demo.mp4
App: https://cafe-web-pr-9-3altvykwkdrowm4o.testing-2b2.workers.dev

Recorded from commit f45c77a: alchemy deploy, chatting in the browser, alchemy dev, pnpm test, ALCHEMY_DEV=1 pnpm test.

@sam-goodwin
sam-goodwin added this pull request to stack #11 October 7, 2026 09:39
@sam-goodwin
sam-goodwin merged commit 3638dc4 into main Oct 7, 2026
4 checks passed
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.

1 participant