Skip to content

Conversation

@juanpprieto
Copy link
Contributor

WHY are these changes introduced?

The Major Version Protection workflow was incorrectly blocking ALL pull requests containing major version changes, regardless of their target branch. This was preventing normal feature branch development workflows where branches merge into other feature branches before eventually reaching main.

Evidence of the issue:

  • PR PR4 - Migrate skeleton template to React Router 7.8.x #3141 targeting feat/cli-diff-removal (not main) was blocked by major version protection
  • The workflow triggered on all pull_request events without checking the base branch
  • This breaks common workflows like feature→feature merges and staging branches

WHAT is this pull request doing?

This PR fixes the Major Version Protection workflow to only run on PRs that are actually targeting protected branches:

  • PRs targeting main branch
  • PRs targeting calver release branches (e.g., 2024-01, 2025-07)

The fix: Updates the workflow's if condition to check github.event.pull_request.base.ref before running the protection job.

# Before - runs on ALL PRs
if: github.event_name == 'pull_request'

# After - only runs on PRs targeting main or release branches  
if: |
  github.event_name == 'pull_request' && 
  (github.event.pull_request.base.ref == 'main' || 
   startsWith(github.event.pull_request.base.ref, '20'))

HOW to test your changes?

  1. Create a PR with major changes targeting a feature branch → Protection should NOT run
  2. Create a PR with major changes targeting main → Protection SHOULD run
  3. Create a PR with major changes targeting a release branch like 2025-01 → Protection SHOULD run
  4. The /bypass-major-safeguard command should still work on protected PRs

Checklist

  • I've read the Contributing Guidelines
  • I've considered possible cross-platform impacts (Mac, Linux, Windows)
  • I've added a changeset if this PR contains user-facing or noteworthy changes
  • I've added tests to cover my changes
  • I've added or updated the documentation

…se branches

The major version protection was incorrectly blocking all PRs with major changes,
even those targeting feature branches. This fix ensures protection only runs on:
- PRs targeting 'main' branch
- PRs targeting calver release branches (starting with '20', e.g., '2024-01', '2025-07')

This allows feature branch development to proceed without major version blocks,
while still protecting main and release branches from unintended major changes.
@shopify
Copy link
Contributor

shopify bot commented Sep 11, 2025

Oxygen deployed a preview of your fix-base-branch-calver-protection branch. Details:

Storefront Status Preview link Deployment details Last update (UTC)
custom-cart-method ✅ Successful (Logs) Preview deployment Inspect deployment September 11, 2025 5:00 PM
metaobjects ✅ Successful (Logs) Preview deployment Inspect deployment September 11, 2025 5:00 PM
third-party-queries-caching ✅ Successful (Logs) Preview deployment Inspect deployment September 11, 2025 5:00 PM
Skeleton (skeleton.hydrogen.shop) ✅ Successful (Logs) Preview deployment Inspect deployment September 11, 2025 5:00 PM

Learn more about Hydrogen's GitHub integration.

if: |
github.event_name == 'pull_request' &&
(github.event.pull_request.base.ref == 'main' ||
startsWith(github.event.pull_request.base.ref, '20'))
Copy link
Contributor

Choose a reason for hiding this comment

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

!remindme 75 years

@kdaviduik kdaviduik merged commit 932fb0f into main Sep 11, 2025
14 checks passed
@kdaviduik kdaviduik deleted the fix-base-branch-calver-protection branch September 11, 2025 20:13
juanpprieto added a commit that referenced this pull request Sep 17, 2025
…se branches (#3161)

The major version protection was incorrectly blocking all PRs with major changes,
even those targeting feature branches. This fix ensures protection only runs on:
- PRs targeting 'main' branch
- PRs targeting calver release branches (starting with '20', e.g., '2024-01', '2025-07')

This allows feature branch development to proceed without major version blocks,
while still protecting main and release branches from unintended major changes.
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.

2 participants