Skip to content

Commit 563f011

Browse files
committed
ci: use pull_request closed event for selective vrt runs
This refines our vrt action to attempt to skip the workflow when it encounters a dependabot or changeset release PR. It uses the GH `pull_request: closed` event type to listen for PRs merging into selected branches (`main`, `spectrum_two`, `s2-foundations-redux`), then checks against the `head_ref` variable to see if it starts with a certain name. If the `head_ref` starts with a flagged name, it skips the rest of the workflow.
1 parent a5003b6 commit 563f011

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

.github/workflows/vrt.yml

+11-3
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,15 @@ on:
44
push:
55
branches:
66
- main
7-
- "!changeset-release/**"
8-
- "!dependabot/**"
7+
pull_request:
8+
# the closed event type gives us the head_ref (the name of the branch being merged into main)
9+
types:
10+
- closed
11+
# for PRs merging into the below branches
12+
branches:
13+
- main
14+
- spectrum_two
15+
- s2-foundations-redux
916
workflow_dispatch:
1017
workflow_call:
1118
inputs:
@@ -25,7 +32,8 @@ permissions:
2532

2633
jobs:
2734
vrt:
28-
if: ${{!startsWith(github.ref, 'refs/heads/dependabot/') && !startsWith(github.ref, 'refs/heads/changeset-release/') }}
35+
# if the branch being merged is a dependabot branch or a changeset release, skip everything in this workflow
36+
if: ${{!startsWith(github.head_ref, 'dependabot') && !startsWith(github.head_ref, 'changeset-release') }}
2937
name: Chromatic
3038
runs-on: ubuntu-latest
3139
timeout-minutes: 20

0 commit comments

Comments
 (0)