Skip to content

Add GitHub Actions workflow for merge ups #1962

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

Merged
merged 1 commit into from
Mar 3, 2025

Conversation

alcaeus
Copy link
Member

@alcaeus alcaeus commented Feb 24, 2025

This PR adds a new GitHub Actions workflow to automatically merge changes up into newer branches. This changes the workflow in this repository: instead of merging all pull requests into the default branch and cherry-picking into older branches, pull request must now target the lowest branch they affect. Currently, this means that bug fixes would go into release/1.17, and new features go into v2.

Once a commit is pushed to a matching branch, the automation becomes active. The following details this process, assuming we pushed into the release/v1.17 branch.

The first step is determining the branch to merge into. The action will consider these branch names in order:

  • release/1.18 (next minor branch matching branchNamePattern)
  • v1 (next minor branch matching devBranchNamePattern)
  • release/2.0 (next major branch matching branchNamePattern)
  • v2 (next major branch matching devBranchNamePattern)
  • master (fallbackBranch)

In this case, the automation would select the v1 branch, as release/1.18 does not exist. Next, the automation branches off from release/1.18 to create a temporary branch and creates a pull request targeting v1. This intermediate branch allows us to push additional commits to resolve conflicts, fix CI, and do other changes without affecting release/1.17. Once the PR is ready, it can be merged using a merge commit. This step is important to mark v1 as containing all commits of release/1.17.
The process then repeats as a new commit has been pushed to v1. Since that is a dev branch, the automation only considers the following branches:

  • release/2.0 (next major branch matching branchNamePattern)
  • v2 (next major branch matching devBranchNamePattern)
  • master (fallbackBranch)

For an example of such a merge-up pull request, please see this PR. Note that PHP still uses a dedicated bot user. Here, I've instead used the release environment to give the workflow access to the release app credentials, using that as PR author. We can switch this to use a different GitHub App if we want to have a separate account creating the merge-up PRs.

There are a few things to note:

  • I've enabled merge commits in the repository settings
  • I've enabled auto-merge in the repository settings
  • The automation enables auto-merge, meaning that PRs are merged automatically once necessary approvals are given and required checks pass. This always uses a merge commit, avoiding errors
  • The first merge-up PR into each branch will likely require manual intervention due to previous cherry-picks. In this case, we'll ignore changes by first resetting to the target branch, then merging the source branch using --strategy=ours - this has the effect of merging the branches as merged without changing any files.

@alcaeus alcaeus requested a review from qingyang-hu February 24, 2025 13:41
@mongodb-drivers-pr-bot mongodb-drivers-pr-bot bot added the priority-3-low Low Priority PR for Review label Feb 24, 2025
Copy link
Contributor

API Change Report

No changes found!

Copy link
Collaborator

@matthewdale matthewdale left a comment

Choose a reason for hiding this comment

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

Looks good! 👍

@alcaeus alcaeus removed the request for review from qingyang-hu March 3, 2025 11:08
@alcaeus alcaeus merged commit c2ca35c into release/1.17 Mar 3, 2025
29 of 35 checks passed
@alcaeus alcaeus deleted the add-merge-up-workflow branch March 3, 2025 11:08
alcaeus added a commit that referenced this pull request Mar 3, 2025
alcaeus added a commit that referenced this pull request Mar 4, 2025
* release/1.17:
  Use different credentials for merge-up PRs (#1968)
  Add GitHub Actions workflow for merge ups (#1962)
  BUMP v1.17.3
  GODRIVER-3448 Limit GOMAXPROCS for fuzz tests (#1939) [v1] (#1943) [release/1.17] (#1957)
  Update reviewers.txt (#1855) [v1] (#1883) [release/1.17] (#1958)
  Cherry pick 1.17.2 work to release/1.17 (#1956)
  GODRIVER-3470 Correct BSON unmarshaling logic for null values (#1924) (#1955)
  GODRIVER-3370 Add bypassEmptyTsReplacement option. (#1927) [release/1.17] (#1954)
  GODRIVER-3340 Bump github.com/klauspost/compress from 1.13.6 to 1.16.7 [release/1.17] (#1880)
  GODRIVER-3374 Add ReadCompressedCompressedMessage back to wiremessage API (#1870)
  Fix data race in 'discard connections' pool test. [v1] (#1877)
  Bump golangci-lint for 1.23 compatibility [v1] (#1875)
  BUMP v1.17.1
  GODRIVER-3156 Detect and discard closed idle connections. (#1815) [release/1.17] (#1841)
  GODRIVER-3313 [release/1.17] Skip CSOT spec tests on Windows and macOS. (#1838)
  GODRIVER-3358 [release/1.17] Do not override authSource from TXT record (#1840)
  GODRIVER-2589 [release/1.17] Clarify `*Cursor.All()` behavior in comment. (#1839)
  DEVPROD-10453 Use assume_role for s3 uploads [release/1.17] (#1824) (#1837)
  update repo metadata
alcaeus added a commit that referenced this pull request Mar 4, 2025
…4499

* release/1.17:
  Use different credentials for merge-up PRs (#1968)
  Add GitHub Actions workflow for merge ups (#1962)
alcaeus added a commit that referenced this pull request Mar 4, 2025
* v1:
  Use different credentials for merge-up PRs (#1968)
  Add GitHub Actions workflow for merge ups (#1962)
  BUMP v1.17.3
  GODRIVER-3448 Limit GOMAXPROCS for fuzz tests (#1939) [v1] (#1943) [release/1.17] (#1957)
  Update reviewers.txt (#1855) [v1] (#1883) [release/1.17] (#1958)
  Cherry pick 1.17.2 work to release/1.17 (#1956)
  GODRIVER-3470 Correct BSON unmarshaling logic for null values (#1924) (#1955)
  GODRIVER-3370 Add bypassEmptyTsReplacement option. (#1927) [release/1.17] (#1954)
  GODRIVER-3340 Bump github.com/klauspost/compress from 1.13.6 to 1.16.7 [release/1.17] (#1880)
  GODRIVER-3374 Add ReadCompressedCompressedMessage back to wiremessage API (#1870)
  Fix data race in 'discard connections' pool test. [v1] (#1877)
  Bump golangci-lint for 1.23 compatibility [v1] (#1875)
  BUMP v1.17.1
  GODRIVER-3156 Detect and discard closed idle connections. (#1815) [release/1.17] (#1841)
  GODRIVER-3313 [release/1.17] Skip CSOT spec tests on Windows and macOS. (#1838)
  GODRIVER-3358 [release/1.17] Do not override authSource from TXT record (#1840)
  GODRIVER-2589 [release/1.17] Clarify `*Cursor.All()` behavior in comment. (#1839)
  DEVPROD-10453 Use assume_role for s3 uploads [release/1.17] (#1824) (#1837)
  update repo metadata
alcaeus added a commit that referenced this pull request Mar 4, 2025
…41094483929

* release/2.0: (203 commits)
  Use different credentials for merge-up PRs (#1968)
  Add GitHub Actions workflow for merge ups (#1962)
  BUMP v1.17.3
  GODRIVER-3448 Limit GOMAXPROCS for fuzz tests (#1939) [v1] (#1943) [release/1.17] (#1957)
  Update reviewers.txt (#1855) [v1] (#1883) [release/1.17] (#1958)
  Cherry pick 1.17.2 work to release/1.17 (#1956)
  GODRIVER-3470 Correct BSON unmarshaling logic for null values (#1924) (#1955)
  GODRIVER-3370 Add bypassEmptyTsReplacement option. (#1927) [release/1.17] (#1954)
  GODRIVER-3448 Limit GOMAXPROCS for fuzz tests (#1939) [v1] (#1943)
  GODRIVER-3470 Correct BSON unmarshaling logic for null values (#1924)
  GODRIVER-3370 Add bypassEmptyTsReplacement option. (#1927)
  BUMP v1.17.2
  GODRIVER-3436 Avoid initializing null data given custom decoder (#1902)
  GODRIVER-3340 Add a test for goroutine leaks. (#1874)
  Update reviewers.txt (#1855) [v1] (#1883)
  GODRIVER-3340 Bump github.com/klauspost/compress from 1.13.6 to 1.16.7 [release/1.17] (#1880)
  GODRIVER-3374 Add ReadCompressedCompressedMessage back to wiremessage API (#1870)
  Fix data race in 'discard connections' pool test. [v1] (#1877)
  Bump golangci-lint for 1.23 compatibility [v1] (#1875)
  Fix data race in 'discard connections' pool test. [v1] (#1877)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority-3-low Low Priority PR for Review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants