Bulk merge Pull Requests for GOV.UK repos.
Create a "Personal access token", with at least the repo/public_repo
scope. Add your token with repo access to .env
:
export GITHUB_TOKEN=<yourtoken>
The scripts will use this token to talk to GitHub.
./review gds-api-adapters
This looks for unreviewed PRs in alphagov
with "gds-api-adapters" in the title. If it finds any, it will list them out and ask you to confirm if you want to approve them.
Use this command for third-party libraries that need a second GOV.UK reviewer.
@tijmenb ~/govuk/bulk-merger on master $ ./review gds-api-adapters
Searching for PRs containing 'gds-api-adapters'
Found 3 unreviewed PRs:
- 'Bump gds-api-adapters from 53.2.0 to 54.0.0' (https://github.com/alphagov/short-url-manager/pull/262)
- 'Bump gds-api-adapters from 53.2.0 to 54.0.0' (https://github.com/alphagov/local-links-manager/pull/328)
- 'Bump gds-api-adapters from 53.2.0 to 54.0.0' (https://github.com/alphagov/email-alert-service/pull/205)
Have you reviewed the changes, and you want to approve all these PRs? [y/N]
y
OK! Approving away...
Reviewing PR 'Bump gds-api-adapters from 53.2.0 to 54.0.0' (https://github.com/alphagov/short-url-manager/pull/262) ✅
Reviewing PR 'Bump gds-api-adapters from 53.2.0 to 54.0.0' (https://github.com/alphagov/local-links-manager/pull/328) ✅
Reviewing PR 'Bump gds-api-adapters from 53.2.0 to 54.0.0' (https://github.com/alphagov/email-alert-service/pull/205) ✅
./merge govuk_publishing_components
This will run the ./review
script above, but also merge the approved PRs.
Because all repos have branch protection turned on, you won't be able to merge PRs that haven't passed on CI.
Found 4 reviewed but unmerged PRs:
- 'Bump gds-api-adapters from 53.2.0 to 54.0.0' (https://github.com/alphagov/short-url-manager/pull/262)
- 'Bump gds-api-adapters from 53.1.0 to 54.0.0' (https://github.com/alphagov/frontend/pull/1658)
- 'Bump gds-api-adapters from 53.2.0 to 54.0.0' (https://github.com/alphagov/local-links-manager/pull/328)
- 'Bump gds-api-adapters from 53.2.0 to 54.0.0' (https://github.com/alphagov/email-alert-service/pull/205)
Have you reviewed the changes, and you want to MERGE all these PRs? [y/N]
y
OK! Approving away...
Merging PR 'Bump gds-api-adapters from 53.2.0 to 54.0.0' (https://github.com/alphagov/short-url-manager/pull/262) ❌ Failed to merge: "PUT https://api.github.com/repos/alphagov/short-url-manager/pulls/262/merge: 405 - Required status check \"continuous-integration/jenkins/branch\" is errored. // See: https://help.github.com/articles/about-protected-branches"
Merging PR 'Bump gds-api-adapters from 53.1.0 to 54.0.0' (https://github.com/alphagov/frontend/pull/1658) ❌ Failed to merge: "PUT https://api.github.com/repos/alphagov/frontend/pulls/1658/merge: 405 - 2 of 2 required status checks have not succeeded: 1 expected and 1 pending. // See: https://help.github.com/articles/about-protected-branches"
Merging PR 'Bump gds-api-adapters from 53.2.0 to 54.0.0' (https://github.com/alphagov/local-links-manager/pull/328) ✅
Merging PR 'Bump gds-api-adapters from 53.2.0 to 54.0.0' (https://github.com/alphagov/email-alert-service/pull/205) ✅