Repository navigation
ci: turn on automatic merging from the PR title - #28
Closed
ahsanalidotme wants to merge 1 commit into
Closed
ahsanalidotme wants to merge 1 commit into
ahsanalidotme wants to merge 1 commit into
Conversation
A PR whose title contains auto-merge (any case) gets GitHub auto-merge with a merge commit once it is ready for review; removing the word turns it off. Replaces the merge queue, which the plan does not offer for private repos. Uses AUTOMERGE_TOKEN when set, else GITHUB_TOKEN with a warning that post-merge push CI will not run.
Contributor
Author
|
Closing: the product owner decided the public repos don't need title-based auto-merge. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
PRs whose title contains
auto-merge(any case, e.g.[auto-merge] Fix typo) now get GitHub auto-merge turned on, with a merge commit, so they merge by themselves once the required checks (and approvals) pass. Removing the word turns it off again. This replaces the merge queue, which isn't available for private repos on our plan.How
.github/workflows/auto-merge.yml, the same file in every linktrail-io repo (only the runner line differs between private and public repos).pull_requesttrigger (opened, edited, reopened, synchronize, ready_for_review, converted_to_draft); neverpull_request_target. Fork PRs are skipped.gh pr merge --auto --merge(merge commit, never squash: stacked PRs depend on it). Otherwise, or when the PR is a draft:gh pr merge --disable-autoif it was on. Idempotent: nothing is called when the state is already right.secrets.AUTOMERGE_TOKENwhen set, elseGITHUB_TOKENwith a::warning::. Permissionscontents: write,pull-requests: write. One tiny job, no checkout,timeout-minutes: 5.Production impact
CI only: no app, API or SDK code changes.
Tests
Preview
None (CI only).
Details (optional)
Post-merge CI caveat: until the
AUTOMERGE_TOKENorg secret is created, merges are made withGITHUB_TOKEN, and GitHub does not startpushworkflows for those. So any post-merge CI on the base branch silently won't run for auto-merged PRs. The job logs a warning each time. Creating the secret (a token withcontentsandpull-requestswrite) fixes this with no code change.The job is a helper, not a check: don't add
Toggle auto-merge from titleto the rulesets. If a PR can already merge when the word is added,ghmerges it straight away.Public repo: the older
mainruleset requires an approving review, so auto-merge completes only after approval. Runner isubuntu-latest.Links
Same change in every linktrail-io repo, branch
ci/auto-merge-title.