Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: use pull_request closed event for selective vrt runs #3254

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Comment on lines 4 to 6
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
push:
branches:
- main
push:
branches:
- main

If we add the below pull_request logic, I think we should remove the push trigger so that we prevent it running twice.

- "!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') }}
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I may need to also check that it was closed due to a merge, because this might run for anything that is closed without merging.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Won't this add additional runs on closed PRs instead of reducing the number of runs against main?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes! I need to exclude it from regular closures instead of "closures that are merges".

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if: ${{!startsWith(github.head_ref, 'dependabot') && !startsWith(github.head_ref, 'changeset-release') }}
if: ${{ github.event.pull_request.merged == 'true' }}

name: Chromatic
runs-on: ubuntu-latest
timeout-minutes: 20
Expand Down
Loading