Update workflow to merge dev with rel-10.3#25185
Conversation
There was a problem hiding this comment.
Pull request overview
Updates the GitHub Actions workflow that auto-creates an “auto-merge” PR when changes are pushed to a release branch, shifting it from rel-10.2 to rel-10.3.
Changes:
- Renamed workflow/job identifiers and strings from
rel-10.2torel-10.3. - Updated trigger branch to
rel-10.3. - Updated the auto-merge branch naming and
gh pr review/mergetargets torel-10.3.
| - uses: actions/checkout@v2 | ||
| with: | ||
| ref: dev | ||
| - name: Reset promotion branch | ||
| run: | | ||
| git fetch origin rel-10.2:rel-10.2 | ||
| git reset --hard rel-10.2 | ||
| git fetch origin rel-10.3:rel-10.3 | ||
| git reset --hard rel-10.3 |
There was a problem hiding this comment.
The current flow checks out dev and then git reset --hard rel-10.3, which moves the checked-out dev working tree to the release branch tip. This does not actually merge dev into rel-10.3, and it risks creating a PR in the opposite direction (or with no meaningful diff). Consider instead checking out rel-10.3 (or the push ref) and explicitly merging origin/dev into it before creating the PR, or adjust the PR base/head so the direction matches the title/body.
| - name: Create Pull Request | ||
| uses: peter-evans/create-pull-request@v3 | ||
| with: | ||
| branch: auto-merge/rel-10-2/${{github.run_number}} | ||
| title: Merge branch dev with rel-10.2 | ||
| body: This PR generated automatically to merge dev with rel-10.2. Please review the changed files before merging to prevent any errors that may occur. | ||
| branch: auto-merge/rel-10-3/${{github.run_number}} | ||
| title: Merge branch dev with rel-10.3 | ||
| body: This PR generated automatically to merge dev with rel-10.3. Please review the changed files before merging to prevent any errors that may occur. | ||
| draft: true | ||
| token: ${{ github.token }} |
There was a problem hiding this comment.
peter-evans/create-pull-request is used without specifying base, so the target branch will default to the repository default branch. That makes this workflow brittle and can easily create PRs against the wrong branch. Set base: rel-10.3 (or whichever branch is intended) explicitly so the PR always targets the release branch.
| run: | | ||
| gh pr ready | ||
| gh pr review auto-merge/rel-10-2/${{github.run_number}} --approve | ||
| gh pr merge auto-merge/rel-10-2/${{github.run_number}} --merge --auto --delete-branch | ||
| gh pr review auto-merge/rel-10-3/${{github.run_number}} --approve | ||
| gh pr merge auto-merge/rel-10-3/${{github.run_number}} --merge --auto --delete-branch |
There was a problem hiding this comment.
gh pr ready is called without a PR argument, but the following commands target a specific PR via the head branch name. In CI this can mark the wrong PR (it defaults to the PR associated with the current checked-out branch). Pass the same PR/branch argument (or better: use the PR number/URL output from create-pull-request) consistently to gh pr ready/review/merge, and skip these steps when no PR was created/updated.
No description provided.