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

Conversation

pfulton
Copy link
Collaborator

@pfulton pfulton commented Oct 15, 2024

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.

Description

How and where has this been tested?

Please tag yourself on the tests you've marked complete to confirm the tests have been run by someone other than the author.

Validation steps

Regression testing

Validate:

  1. The documentation pages for at least two other components are still loading, including:
  • The pages render correctly, are accessible, and are responsive.
  1. If components have been modified, VRTs have been run on this branch:
  • VRTs have been run and looked at.
  • Any VRT changes have been accepted (by reviewer and/or PR author), or there are no changes.

Screenshots

To-do list

  • I have read the contribution guidelines.
  • I have updated relevant storybook stories and templates.
  • I have tested these changes in Windows High Contrast mode.
  • If my change impacts other components, I have tested to make sure they don't break.
  • If my change impacts documentation, I have updated the documentation accordingly.
  • ✨ This pull request is ready to merge. ✨

Copy link

changeset-bot bot commented Oct 15, 2024

⚠️ No Changeset found

Latest commit: 563f011

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link
Contributor

github-actions bot commented Oct 15, 2024

🚀 Deployed on https://pr-3254--spectrum-css.netlify.app

Copy link
Contributor

github-actions bot commented Oct 15, 2024

File metrics

Summary

Total size: 4.30 MB*

🎉 No changes detected in any packages

* Size determined by adding together the size of the main file for all packages in the library.
* Results are not gzipped or minified.
* An ASCII character in UTF-8 is 8 bits or 1 byte.

@pfulton pfulton added the skip_vrt Add to a PR to skip running VRT (but still pass the action) label Oct 15, 2024
@@ -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".

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.
@pfulton pfulton force-pushed the pfulton/better-conditionals-actions branch from 1f7185b to 563f011 Compare October 18, 2024 14:05
Comment on lines 4 to 6
push:
branches:
- main
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.

@@ -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

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' }}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
skip_vrt Add to a PR to skip running VRT (but still pass the action)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants