Skip to content

Add auto-merge workflow for Dependabot and Scala Steward PRs#979

Merged
xerial merged 3 commits intomainfrom
feature/auto-merge-workflow
May 5, 2026
Merged

Add auto-merge workflow for Dependabot and Scala Steward PRs#979
xerial merged 3 commits intomainfrom
feature/auto-merge-workflow

Conversation

@xerial
Copy link
Copy Markdown
Member

@xerial xerial commented May 5, 2026

Summary

  • Adds .github/workflows/auto-merge.yml with two jobs that enable squash auto-merge on PRs from dependabot[bot] and scala-steward. Modeled on wvlet/uni/.github/workflows/auto-merge.yml.
  • Uses on: pull_request_target instead of pull_request so the declared permissions: block grants GITHUB_TOKEN actual write access on Dependabot-authored runs (without needing a GitHub App). The workflow never checks out PR head code, so the standard pull_request_target injection risk does not apply.
  • Dependabot job uses dependabot/fetch-metadata to detect and skip version-update:semver-major.
  • Scala Steward job skips PRs labeled semver-major or early-semver-major.

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

Scala Steward label caveat

The repo doesn't currently apply semver labels to Scala Steward PRs (only library-update), so the semver-major / early-semver-major guard is effectively a no-op for now. This matches wvlet/uni's behavior — its guard checks github.event.issue.labels which doesn't exist on PR events, so it's also a no-op there. A follow-up can tighten this by adding the labels to the repo and configuring Scala Steward to apply them. Risk is acceptable in the meantime: CI runs across JDK 8/11/17/21/24 and a slipped-through major bump can be reverted.

Prereqs

  • Repo already has "Allow auto-merge" enabled (allow_auto_merge: true) and squash is the default merge method.
  • GitHub will only merge once required status checks pass and any required reviewers approve — auto-merge does not bypass branch protection.

Test plan

  • Workflow YAML parses cleanly (verified locally with python3 -c "import yaml; yaml.safe_load(...)").
  • After merge, observe the next Dependabot or Scala Steward PR: workflow run should succeed and the PR should show "auto-merge enabled by github-actions[bot]".
  • Confirm a major-version Dependabot PR does NOT get auto-merge enabled (the version-update:semver-major guard).

Mirrors the wvlet/uni auto-merge pattern, adapted for this repo:
- Uses pull_request_target so GITHUB_TOKEN gets the declared write
  permissions on Dependabot-authored PRs (avoids needing a GitHub App).
- Skips Dependabot major-version bumps via dependabot/fetch-metadata.
- Skips Scala Steward PRs labeled semver-major.
- Squash-merges via --auto, so GitHub waits for required checks and
  reviews before merging.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@github-actions github-actions Bot added the doc label May 5, 2026
The semver-major label guard was a no-op: this repo's Scala Steward PRs
only carry library-update (and sometimes internal), so the guard would
have auto-merged every Scala Steward PR including major bumps. Defer
Scala Steward auto-merge until the repo has proper semver labeling
configured.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@xerial xerial changed the title Add auto-merge workflow for Dependabot and Scala Steward PRs Add auto-merge workflow for Dependabot PRs May 5, 2026
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>
@xerial xerial changed the title Add auto-merge workflow for Dependabot PRs Add auto-merge workflow for Dependabot and Scala Steward PRs May 5, 2026
@xerial xerial merged commit 73d59ee into main May 5, 2026
9 checks passed
@xerial xerial deleted the feature/auto-merge-workflow branch May 5, 2026 20:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant