Skip to content

feat: auto-merge update PRs and stagger maintenance schedules - #82

Merged
blink1073 merged 2 commits into
Calysto:mainfrom
blink1073:auto-merge
Oct 12, 2026
Merged

blink1073 merged 2 commits into
Calysto:mainfrom
blink1073:auto-merge

Conversation

@blink1073

Copy link
Copy Markdown
Contributor

Summary

  • Add an opt-in auto-merge input to pre-commit-autoupdate and poetry-lock-update that enables squash auto-merge on the PRs they open, and enable it in this repo's workflows.
  • Add a dependabot-auto-merge workflow that approves and enables auto-merge for patch/minor Dependabot updates.
  • Stagger the maintenance schedules to avoid interference: Poetry lock (Mon), Dependabot (Tue), pre-commit autoupdate (Wed).

Notes

  • Auto-merge requires "Allow auto-merge" enabled in repo settings; merges once required checks pass.
  • dependabot/fetch-metadata is hash-pinned to satisfy zizmor's unpinned-uses policy.

@blink1073 blink1073 added the enhancement New feature or request label Oct 12, 2026
@greptile-apps

greptile-apps Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 4/5

[High impact] Enables automatic merging of dependency and maintenance update pull requests.

The PR appears safe to merge, with non-blocking improvements to error reporting, update filtering, and tests.

Findings

  1. P2 Failed lookup looks successful ▶
  2. P2 Unknown updates pass the filter ▶
  3. P2 Merge paths lack tests ▶

Summary

Adds optional squash auto-merge to the two maintenance actions and enables it in this repository.

  • Update actions can queue squash merges after required checks pass.
  • Dependabot non-major pull requests can queue squash auto-merge.
  • Dependabot runs Tuesday and pre-commit updates run Wednesday.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Maintenance update] --> B{Changes found?}
  B -->|No| C[Stop]
  B -->|Yes| D[Create or update PR]
  D --> E{Auto-merge enabled and not dry-run?}
  E -->|Yes| F[Enable squash auto-merge]
  E -->|No| G[Leave PR for manual merge]
  H[Dependabot PR] --> I[Read update metadata]
  I --> J{Not classified as major?}
  J -->|Yes| K[Approve and enable squash auto-merge]
  J -->|No| G
Loading

Reviews (1) · Last reviewed commit: "feat: auto-merge update PRs and stagger ..." · Reviewed by Greptile

Comment thread actions/poetry-lock-update/action.yml Outdated
if [ "$AUTO_MERGE" = "true" ] && [ "$DRY_RUN" != "true" ]; then
# The branch (and PR) is reused across runs; only enable auto-merge
# if it is not already enabled, since re-enabling it errors.
if [ "$(gh pr view "$BRANCH" --json autoMergeRequest --jq '.autoMergeRequest')" = "null" ]; then

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Failed lookup looks successful

If gh pr view fails, its empty output makes this comparison false. The step then finishes successfully without enabling auto-merge, leaving the PR waiting for manual action. Capture the result separately and stop on a failed lookup before checking autoMergeRequest.

Suggested change
if [ "$(gh pr view "$BRANCH" --json autoMergeRequest --jq '.autoMergeRequest')" = "null" ]; then
AUTO_MERGE_REQUEST=$(gh pr view "$BRANCH" --json autoMergeRequest --jq '.autoMergeRequest') || exit $?
if [ "$AUTO_MERGE_REQUEST" = "null" ]; then

github-token: ${{ secrets.GITHUB_TOKEN }}

- name: Approve and enable auto-merge for patch and minor updates
if: steps.meta.outputs.update-type != 'version-update:semver-major'

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Unknown updates pass the filter

This condition accepts every update-type except the exact major-update value, including an empty or unfamiliar value. That could enable auto-merge without confirming the update is patch or minor. Explicitly allow those two values so unknown metadata leaves the PR for review.

Suggested change
if: steps.meta.outputs.update-type != 'version-update:semver-major'
if: steps.meta.outputs.update-type == 'version-update:semver-patch' || steps.meta.outputs.update-type == 'version-update:semver-minor'

Comment thread actions/poetry-lock-update/action.yml Outdated
Comment on lines +153 to +158
if [ "$AUTO_MERGE" = "true" ] && [ "$DRY_RUN" != "true" ]; then
# The branch (and PR) is reused across runs; only enable auto-merge
# if it is not already enabled, since re-enabling it errors.
if [ "$(gh pr view "$BRANCH" --json autoMergeRequest --jq '.autoMergeRequest')" = "null" ]; then
gh pr merge "$BRANCH" --auto --squash --delete-branch
fi

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Merge paths lack tests

Neither new auto-merge path has test coverage. Both action tests use dry-run, and the existing PR helper tests never run these commands. Mistakes in when poetry-lock-update or pre-commit-autoupdate merges PRs can therefore pass unnoticed. Add tests with a fake gh for opt-in merging, dry-run and disabled inputs, an already-enabled PR, and lookup failures.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

The GitHub App authors these PRs and cannot approve its own PR, so
auto-merge never satisfied the required review. Approve with the workflow
token (a different actor) before enabling auto-merge.

Extract the approve-and-merge logic into a shared actions/common/auto_merge.sh
and address Greptile review findings:

- fail the step when the auto-merge lookup errors instead of silently
  skipping the merge
- match patch/minor Dependabot update types explicitly so unknown metadata
  is left for review
- add tests covering opt-in, dry-run, disabled, already-enabled, missing
  app token, and lookup-failure paths
@blink1073
blink1073 merged commit bd97822 into Calysto:main Oct 12, 2026
26 checks passed
@blink1073
blink1073 deleted the auto-merge branch October 12, 2026 18:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant