Skip to content

Commit b77844a

Browse files
xerialclaude
andcommitted
Add Scala Steward auto-merge job
Restore the Scala Steward auto-merge job dropped in the previous commit. Guards on both `semver-major` and `early-semver-major` labels for forward compatibility with future label setup. Until those labels are configured, the guard is effectively a no-op (matching wvlet/uni's behavior); a follow-up can tighten this by adding the labels to the repo and configuring Scala Steward to apply them. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent c91ff24 commit b77844a

2 files changed

Lines changed: 38 additions & 17 deletions

File tree

.github/workflows/auto-merge.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,18 @@ jobs:
2424
run: gh pr merge --squash --auto "${{ github.event.pull_request.html_url }}"
2525
env:
2626
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
27+
28+
auto-merge-scala-steward:
29+
name: Auto-Merge Scala Steward PRs
30+
runs-on: ubuntu-latest
31+
if: ${{ github.event.pull_request.user.login == 'scala-steward' }}
32+
steps:
33+
# Skip auto-merge if the PR carries a semver-major label. Note: this repo
34+
# does not yet apply semver labels to Scala Steward PRs, so this guard is
35+
# a no-op until early-semver-* labels are added to the repo and Scala
36+
# Steward is configured to apply them.
37+
- name: Enable auto-merge for non-major updates
38+
if: ${{ !contains(github.event.pull_request.labels.*.name, 'semver-major') && !contains(github.event.pull_request.labels.*.name, 'early-semver-major') }}
39+
run: gh pr merge --squash --auto "${{ github.event.pull_request.html_url }}"
40+
env:
41+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

plans/2026-05-05-auto-merge.md

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -35,40 +35,46 @@ pattern used in `wvlet/uni/.github/workflows/auto-merge.yml`.
3535

3636
## Plan
3737

38-
1. Add `.github/workflows/auto-merge.yml` with one job:
38+
1. Add `.github/workflows/auto-merge.yml` with two jobs:
3939
- **auto-merge-dependabot**: triggers when
4040
`github.event.pull_request.user.login == 'dependabot[bot]'`, uses
4141
`dependabot/fetch-metadata@v2` to read the update type, and runs
4242
`gh pr merge --squash --auto` only when the update is **not**
4343
`version-update:semver-major`.
44+
- **auto-merge-scala-steward**: triggers when
45+
`github.event.pull_request.user.login == 'scala-steward'` and
46+
auto-merges unless the PR carries a `semver-major` or
47+
`early-semver-major` label.
4448
2. Set workflow-level `permissions` to the minimum required:
4549
`contents: write` and `pull-requests: write`.
4650
3. Use `GITHUB_TOKEN` directly via `env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}`.
4751

48-
### Scala Steward (deferred)
52+
### Scala Steward label caveat
4953

50-
The initial draft also auto-merged Scala Steward PRs, gated on a
51-
`semver-major` label being absent. But this repo's existing Scala Steward PRs
52-
only carry `library-update` (and sometimes `internal`) — no semver labels are
53-
configured, so a `!contains(..., 'semver-major')` guard is effectively a
54-
no-op and would auto-merge every Scala Steward PR including major bumps.
55-
Codex review caught this. Rather than ship an unsafe guard, we drop the
56-
Scala Steward job from this PR. Re-adding it should be a follow-up that
57-
either:
58-
- Defines `early-semver-major`/`early-semver-minor`/`early-semver-patch`
59-
labels in the repo (Scala Steward only applies labels that already exist)
60-
and adds a `.scala-steward.conf` enabling them, then guards on
61-
`early-semver-major`.
62-
- Or uses a manual opt-in label like `auto-merge` that the maintainer adds
63-
after a quick review.
54+
This repo's current Scala Steward PRs only carry `library-update` (and
55+
sometimes `internal`) — no semver labels are configured upstream, so the
56+
`semver-major` / `early-semver-major` guard is effectively a no-op until:
57+
- The labels are added to the repo (Scala Steward only applies labels that
58+
already exist), and
59+
- Scala Steward is configured (e.g. via `.scala-steward.conf`) to attach
60+
them.
61+
62+
This matches the same caveat in the wvlet/uni reference implementation,
63+
which uses `semver-spec-major` against `github.event.issue.labels` (not even
64+
the right field on a PR event) — so its guard is also effectively a no-op
65+
in practice. We accept the same trade-off here: most Scala Steward PRs are
66+
patch/minor library updates, CI runs across JDK 8/11/17/21/24 and will fail
67+
the merge-readiness checks if anything regresses, and a major bump that
68+
slips through can be reverted. A follow-up could tighten this by setting up
69+
proper semver labels.
6470

6571
## Out of scope
6672

6773
- Setting up a GitHub App for elevated bot identity.
6874
- Auto-approving PRs (a human approval may still be required by branch
6975
protection — auto-merge will simply wait for it).
7076
- Changing branch protection rules.
71-
- Scala Steward auto-merge (see above).
77+
- Configuring Scala Steward to apply semver labels (see caveat above).
7278

7379
## Validation
7480

0 commit comments

Comments
 (0)