Skip to content

ci: turn on automatic merging from the PR title - #28

Closed
ahsanalidotme wants to merge 1 commit into
mainfrom
ci/auto-merge-title
Closed

ahsanalidotme wants to merge 1 commit into
mainfrom
ci/auto-merge-title

Conversation

@ahsanalidotme

Copy link
Copy Markdown
Contributor

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

  • New .github/workflows/auto-merge.yml, the same file in every linktrail-io repo (only the runner line differs between private and public repos).
  • pull_request trigger (opened, edited, reopened, synchronize, ready_for_review, converted_to_draft); never pull_request_target. Fork PRs are skipped.
  • Reads the live PR. Title matches and PR is ready: 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-auto if it was on. Idempotent: nothing is called when the state is already right.
  • Token: secrets.AUTOMERGE_TOKEN when set, else GITHUB_TOKEN with a ::warning::. Permissions contents: write, pull-requests: write. One tiny job, no checkout, timeout-minutes: 5.
  • Short "Auto-merge" note in the docs.

Production impact

CI only: no app, API or SDK code changes.

Breaking public API change No
Behaviour change for integrators No
Min OS / SDK / platform version change No
Permissions or privacy manifest change No
Version and CHANGELOG updated n/a (CI only)
Risk Low

Tests

Tests added or updated for all new and changed code No (CI-only change)
Unit tests pass locally n/a (actionlint clean)
CI green Pending
Example app / e2e run n/a

Preview

None (CI only).

Details (optional)

Post-merge CI caveat: until the AUTOMERGE_TOKEN org secret is created, merges are made with GITHUB_TOKEN, and GitHub does not start push workflows 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 with contents and pull-requests write) fixes this with no code change.

The job is a helper, not a check: don't add Toggle auto-merge from title to the rulesets. If a PR can already merge when the word is added, gh merges it straight away.

Public repo: the older main ruleset requires an approving review, so auto-merge completes only after approval. Runner is ubuntu-latest.

Links

Same change in every linktrail-io repo, branch ci/auto-merge-title.

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.
@ahsanalidotme ahsanalidotme changed the title ci: auto-merge PRs whose title contains auto-merge ci: turn on automatic merging from the PR title Oct 28, 2026
@ahsanalidotme

Copy link
Copy Markdown
Contributor Author

Closing: the product owner decided the public repos don't need title-based auto-merge.

@ahsanalidotme
ahsanalidotme deleted the ci/auto-merge-title branch October 28, 2026 11:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant