Skip to content

Commit 6009898

Browse files
authored
fix(ci): scope label-triggered workflows to their own label (#71)
Adding an unrelated label to a PR that already has run-e2e or deploy-preview re-triggered the e2e/deploy-vercel jobs, since the `labeled`/`synchronize` if-conditions only checked whether the target label was present anywhere in the PR's current label set. Narrow the `labeled` branch to the label actually added by the event.
1 parent e81f1f9 commit 6009898

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

.github/workflows/deploy-vercel.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ jobs:
2323
if: >-
2424
(github.event_name == 'push' && github.ref == 'refs/heads/main') ||
2525
(github.event_name == 'pull_request_target' &&
26-
contains(github.event.pull_request.labels.*.name, 'deploy-preview'))
26+
((github.event.action == 'labeled' && github.event.label.name == 'deploy-preview') ||
27+
(github.event.action != 'labeled' && contains(github.event.pull_request.labels.*.name, 'deploy-preview'))))
2728
runs-on: ubuntu-latest
2829
environment:
2930
name: ${{ github.event_name == 'pull_request_target' && 'test' || 'production' }}

.github/workflows/e2e.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ jobs:
1414
name: Playwright E2E (production build)
1515
if: >-
1616
github.event_name == 'workflow_dispatch' ||
17-
contains(github.event.pull_request.labels.*.name, 'run-e2e')
17+
(github.event.action == 'labeled' && github.event.label.name == 'run-e2e') ||
18+
(github.event.action == 'synchronize' && contains(github.event.pull_request.labels.*.name, 'run-e2e'))
1819
runs-on: ubuntu-latest
1920
permissions:
2021
contents: read

0 commit comments

Comments
 (0)