Skip to content

Commit

Permalink
ci: use pull_request closed event for selective vrt runs
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
pfulton committed Oct 18, 2024
1 parent a5003b6 commit 563f011
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions .github/workflows/vrt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,15 @@ on:
push:
branches:
- main
- "!changeset-release/**"
- "!dependabot/**"
pull_request:
# the closed event type gives us the head_ref (the name of the branch being merged into main)
types:
- closed
# for PRs merging into the below branches
branches:
- main
- spectrum_two
- s2-foundations-redux
workflow_dispatch:
workflow_call:
inputs:
Expand All @@ -25,7 +32,8 @@ permissions:

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

0 comments on commit 563f011

Please sign in to comment.