-
Notifications
You must be signed in to change notification settings - Fork 7.8k
Open
Labels
enhancementa request to improve CLIa request to improve CLIneeds-triageneeds to be reviewedneeds to be reviewed
Description
Describe the feature or problem you’d like to solve
I want a single uninteractive command to delete the local branch when the PR is merged
This, almost works, but has a couple of race conditions
gh pr create --fill-first; sleep 3 && gh run watch --exit-status && gh pr merge --squash --delete-branch --auto
- The runs might not be available, so we're sleeping first
- If we watch the wrong run the local branch won't be deleted if there are still runs
Proposed solution
Let's start with I think there are multiple solutions to this, so I'm doing my best to describe the problem more than just the solution
- I think that there needs to be a
gh pr watch --exit-statusso that we can watch all the runs related to this pr at once. - When running
gh pr merge --squash --delete-branch --autoif the merge hasn't been done yet, record some kind of local file queue check, so that the next time gh is run, it'll check and delete the branch if that pr is closed. - We also need a
gh pr watch <job name>and maybe agh run watch --latest --job-name <job name>
❯ gh --version
gh version 2.44.1 (2024-02-29)
https://github.com/cli/cli/releases/tag/v2.44.1
Metadata
Metadata
Assignees
Labels
enhancementa request to improve CLIa request to improve CLIneeds-triageneeds to be reviewedneeds to be reviewed