Skip to content

Conversation

@caseyisonit
Copy link
Contributor

@caseyisonit caseyisonit commented May 7, 2025

Description

This adds a conditional check to the preview-release workflow to only run on commit types feat,fix, or !:. The !: will capture any breaking change.

Motivation and context

  • Reduce the number of preview releases published
  • Only release functional testable code

Related issue(s)

Author's checklist

  • I have read the CONTRIBUTING and PULL_REQUESTS documents.
  • I have reviewed at the Accessibility Practices for this feature, see: Aria Practices
  • I have added automated tests to cover my changes.
  • I have included a well-written changeset if my change needs to be published.
  • I have included updated documentation if my change required it.

Reviewer's checklist

  • The conditional logic covers all semver edge cases that should release a preview version

@caseyisonit caseyisonit requested a review from a team as a code owner May 7, 2025 19:01
@changeset-bot
Copy link

changeset-bot bot commented May 7, 2025

⚠️ No Changeset found

Latest commit: 1ddc96e

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

runs-on: ubuntu-latest

# Run the job if manually triggered or if the commit message includes a commit type of fix or feat or breaking change
if: contains(github.event.head_commit.message, 'fix:') || contains(github.event.head_commit.message, 'fix(') || contains(github.event.head_commit.message, 'feat:') || contains(github.event.head_commit.message, 'feat(') || contains(github.event.head_commit.message, '!:')
Copy link
Contributor Author

Choose a reason for hiding this comment

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

using the : and ( ensures it is a commit type and not just a random word in the message

@github-actions
Copy link
Contributor

github-actions bot commented May 7, 2025

Branch preview

Review the following VRT differences

When a visual regression test fails (or has previously failed while working on this branch), its results can be found in the following URLs:

If the changes are expected, update the current_golden_images_cache hash in the circleci config to accept the new images. Instructions are included in that file.
If the changes are unexpected, you can investigate the cause of the differences and update the code accordingly.

Copy link
Contributor

@nikkimk nikkimk left a comment

Choose a reason for hiding this comment

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

Lawless genius twirls mustache (LGTM)

@github-actions
Copy link
Contributor

github-actions bot commented May 7, 2025

Tachometer results

Currently, no packages are changed by this PR...

@graynorton graynorton self-requested a review May 7, 2025 21:39
Copy link
Contributor

@graynorton graynorton left a comment

Choose a reason for hiding this comment

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

This looks like it will work, and I'm not necessarily opposed to going with this approach, but it bothers me a little bit to be relying on conventional commits for the publish-or-not logic, since we have moved in the direction of having Changesets be our source of truth for representing release-worthy changes.

What if, instead of conditionalizing the logic inside the job and inspecting commits, we were to only run the job when a push to main includes changes beneath the .changesets directory, something like this:

on:
  push:
    branches:
      - main
    paths:
      - '.changesets/**'

I think we could also add workflow_dispatch: to the on: block if we wanted to allow manually triggering the action from the GitHub UI.

@caseyisonit
Copy link
Contributor Author

I think we could also add workflow_dispatch: to the on: block if we wanted to allow manually triggering the action from the GitHub UI.

we provide the changsets-snapshot-publish command for this use case since there wouldn't be a git sha associated from a workflow_dispatch

@graynorton
Copy link
Contributor

we provide the changsets-snapshot-publish command for this use case since there wouldn't be a git sha associated from a workflow_dispatch

Ah, I hadn't thought about the missing sha issue!

The use case I had in mind was not an one-off snapshot release (which I agree changesets-snapshot-publish covers), but one where something had gone wrong and an automated preview build had been skipped or failed, and we wanted to essentially say "make an official preview release, but trust me and skip the changesets check". In this case, I imagined that the sha from the HEAD of main would be used, but I didn't think about where it would come from.

Anyway, it may be that we don't need to worry about that case.

@graynorton graynorton self-requested a review May 7, 2025 21:53
Copy link
Contributor

@graynorton graynorton left a comment

Choose a reason for hiding this comment

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

Approved, so we can get this merged. We'll follow up later to explore the possibility of using a Changesets-based trigger, as discussed here.

@caseyisonit caseyisonit merged commit 9fbada6 into main May 7, 2025
24 checks passed
@caseyisonit caseyisonit deleted the caseyisonit/preview-release-condition branch May 7, 2025 22:04
castastrophe pushed a commit that referenced this pull request May 9, 2025
* chore: add conditional check to preview release

* chore: add breaking change conditional
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants