Skip to content

Commit 6e99210

Browse files
Avoid race condition with PR previews (#1728)
A PR preview failed to deploy today because a prior workflow was already pushing the deploy, which messed up the Git state. We should only ever attempt to deploy one PR preview at a time - pushing a new commit should cancel the prior deploy attempt if still in progress. To cancel, this uses the technique from https://www.meziantou.net/how-to-cancel-github-workflows-when-pushing-new-commits-on-a-branch.htm.
1 parent ab54d22 commit 6e99210

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

.github/workflows/pr-preview.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ on:
1717
- "docs/**/*"
1818
- "public/images/**/*"
1919

20+
concurrency:
21+
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
22+
cancel-in-progress: true
23+
2024
jobs:
2125
pr-preview:
2226
name: PR preview

0 commit comments

Comments
 (0)