cli / cli

GitHub’s official command line tool
https://cli.github.com
MIT License
36.69k stars 5.62k forks source link

`gh pr merge --auto` doesn't wait for checks to complete #8514

Open khatchad opened 8 months ago

khatchad commented 8 months ago

Describe the bug

When I issue gh pr merge --auto, the PR merges even though the checks haven't completed. It would seem to me that the command is ignoring the --auto flag. The version of gh I am using is 2.40.1.

Steps to reproduce the behavior

  1. Be on a branch that tracks a remote branch tied to pull request.
  2. Issue gh pr merge --auto

Expected vs actual behavior

I expect the PR to go into auto merge mode, i.e.,, to merge once the checks complete. The docs say:

Automatically merge only after necessary requirements are met

for the flag --auto. Instead, the PR merges with the checks still running.

williammartin commented 6 months ago

Sorry for the long delay in responding here after Christmas. Some team churn a large backlog.

Can you confirm that this still occurs for you, and if so, can you provide the output of gh pr merge --auto with GH_DEBUG=api env var set?

khatchad commented 6 months ago

No prob. I haven't seen this work yet. I don't want to merge PRs that haven't had their checks pass. I noticed that if I add more CLI flags to the command the problem doesn't happen. But, if I just use --auto, it always happens.

khatchad commented 6 months ago
$ gh --version
gh version 2.44.1 (2024-02-16)
https://github.com/cli/cli/releases/tag/v2.44.1
williammartin commented 6 months ago

I don't want to merge PRs that haven't had their checks pass.

Totally understand.

I noticed that if I add more CLI flags to the command the problem doesn't happen. But, if I just use --auto, it always happens.

That's pretty interesting. Looking forward to the debug logs!

Perhaps you could also provide a debug log with other flags so we can compare the requests/responses.

radahh-rest commented 5 months ago

We also seem to have this issue, although maybe I just misunderstand the --auto feature. Debug log attached (slightly redacted---can supply OOB if required). We are using rule sets that require all status checks to pass and interestingly(?) they are shown as 'passed', so possibly the problem is not the auto merge, but the build config?

6_Auto-merge development dependencies.txt

image

emcdaniel-sungage commented 5 months ago

I noticed that if I add more CLI flags to the command the problem doesn't happen

We're having this issue as well. What flags were you using when it didn't happen? Thanks @khatchad.

khatchad commented 5 months ago

I noticed that if I add more CLI flags to the command the problem doesn't happen

We're having this issue as well. What flags were you using when it didn't happen? Thanks @khatchad.

khatchad commented 4 months ago

Looks like this problem has gotten worse. On gh version 2.48.0 (2024-04-17), I just tried gh pr merge --auto --delete-branch --merge, and the problem happened with those arguments as well.

khatchad commented 4 months ago

I wonder if this problem has something to do with --delete-branch now. I would think it would be difficult to "Delete the local and remote branch after merge" if --auto is also specified.

yogsototh commented 2 weeks ago

experienced the same issue without --auto today.

I used gh pr merge --squash and this command failed a few time. But after the CI build completed and failed. That command still merged the PR.

Screenshot 2024-08-28 at 17 27 06