Skip to content

feat(pr): add --auto-merge-method to choose merge method#514

Merged
phlope merged 1 commit intografana:mainfrom
julienduchesne:julienduchesne/auto-merge-method
Apr 27, 2026
Merged

feat(pr): add --auto-merge-method to choose merge method#514
phlope merged 1 commit intografana:mainfrom
julienduchesne:julienduchesne/auto-merge-method

Conversation

@julienduchesne
Copy link
Copy Markdown
Contributor

@julienduchesne julienduchesne commented Apr 27, 2026

Summary

Adds a new --auto-merge-method flag (env: GITHUB_AUTO_MERGE_METHOD) that controls which merge method is used when --auto-merge is enabled. Accepts merge, squash, or rebase; defaults to merge.

--auto-merge remains a boolean flag, so existing usage is unchanged.

@julienduchesne julienduchesne requested a review from a team as a code owner April 27, 2026 13:35
Keep --auto-merge as a boolean flag (backwards compatible) and add a
new --auto-merge-method string flag that controls the merge method
(merge, squash, rebase). Defaults to "merge" so existing usage is
unchanged. Also configurable via GITHUB_AUTO_MERGE_METHOD.
@julienduchesne julienduchesne force-pushed the julienduchesne/auto-merge-method branch from 9903876 to f75c188 Compare April 27, 2026 13:44
@julienduchesne julienduchesne changed the title feat(pr): allow choosing merge method for --auto-merge feat(pr): add --auto-merge-method to choose merge method Apr 27, 2026
@phlope
Copy link
Copy Markdown

phlope commented Apr 27, 2026

Looks good, one behaviour i wanted to check before approving:
If a merge method is selected where not permitted/explicitly disabled on a repository, what is the result?

Looks like the change has coverage with the logger to surface the reason but i wanted to double check before 👍

@julienduchesne
Copy link
Copy Markdown
Contributor Author

time=2026-04-27T02:02:26.452Z level=DEBUG msg="performing request" method=GET url=https://api.github.com/repos/grafana/deployment_tools/pulls/566458
time=2026-04-27T02:02:27.231Z level=DEBUG msg="performing request" method=GET url=https://api.github.com/repos/grafana/deployment_tools/pulls/566458
time=2026-04-27T02:02:27.962Z level=DEBUG msg="performing request" method=POST url=https://api.github.com/graphql
time=2026-04-27T02:02:28.538Z level=INFO msg="CI passed and auto-merge is enabled, merging PR"
time=2026-04-27T02:02:28.538Z level=DEBUG msg="performing request" method=PUT url=https://api.github.com/repos/grafana/deployment_tools/pulls/566458/merge
time=2026-04-27T02:02:29.457Z level=WARN msg="failed to merge PR, will retry on next poll" error="failed to merge PR: PUT https://api.github.com/repos/grafana/deployment_tools/pulls/566458/merge: 405 Merge commits are not allowed on this repository. []"
time=2026-04-27T02:02:29.457Z level=INFO msg=rechecking interval=30s

@julienduchesne
Copy link
Copy Markdown
Contributor Author

Logs the error and retries 30 seconds later

@phlope phlope added this pull request to the merge queue Apr 27, 2026
Merged via the queue into grafana:main with commit a908827 Apr 27, 2026
22 checks passed
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.

2 participants