[code-infra] Add workflow to check version label and cherry pick#1039
[code-infra] Add workflow to check version label and cherry pick#1039
Conversation
JCQuintas
commented
Jan 15, 2026
| Rule | Implementation |
|---|---|
| Make vX.x label required | ✅ Fails if no version label found |
| IS main_branch AND HAS current_version_label → ignore | ✅ currentBranchLabel = mainVersionLabel, no cherry-pick if only that label |
| IS main_branch AND HAS other_version_branch_label → open PR | ✅ Cherry-picks to labels that aren't mainVersionLabel |
| IS version_branch AND HAS version_branch_label → ignore | ✅ currentBranchLabel = baseBranch (e.g., v8.x), no cherry-pick if only that label |
| IS version_branch AND HAS other_version_branch_label → open PR | ✅ Cherry-picks to labels that aren't the branch name |
✅ Deploy Preview for mui-internal ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Bundle size report
Check out the code infra dashboard for more information about this PR. |
There was a problem hiding this comment.
Pull request overview
This PR adds automated workflow infrastructure to validate version labels on PRs and automatically create cherry-pick PRs to target version branches based on those labels. It ensures every PR has at least one version label (e.g., v9.x, v8.x) and intelligently determines when cherry-picks are needed by comparing the PR's base branch with the version labels applied.
Changes:
- Adds version label validation logic with intelligent cherry-pick target detection
- Creates reusable workflow for checking version labels and opening cherry-pick PRs
- Implements conditional logic to skip cherry-picks when PR targets match its version labels
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| .github/workflows/scripts/prs/checkVersionLabel.js | JavaScript module that validates version labels and determines cherry-pick targets based on PR base branch |
| .github/workflows/prs_check-version-label-and-cherry-pick.yml | Reusable workflow that orchestrates version label checking and cherry-pick PR creation |
| steps: | ||
| - name: Check out mui-public repo | ||
| id: checkout | ||
| uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 |
There was a problem hiding this comment.
🤔 It just has to compare PR labels, afaics it shouldn't be necessary to check out any repo for this, neither should it be necessary to call github API, all info should be available in the action context of pull request event
There was a problem hiding this comment.
It needs to if we are using a function from the repo
const script = require('./.github/workflows/scripts/prs/checkVersionLabel.js')
I could move the code here, it is just that the js can be typechecked
There was a problem hiding this comment.
versioning is kind of problematic, i.e. we would use the sha to version the workflow where we call it, but then the script itself is versioned differently (e.g. someone could change the script on master and break users of this workflow, even if the workflow call is pinned to a specific sha)
There was a problem hiding this comment.
Sure, though we use this pattern in many other workflows.
I've moved the script inside this file directly