Replies: 6 comments 5 replies
|
Hi, thanks for the suggestion! Currently, running I believe that this is enough to give you a hint that a PR already exists and that, in most cases, you can just do a I'm not sure if |
|
How about a flag? I have an action that creates a PR automatically from an issue, and the branch is named after the issue. I imagine this is a very common use case, so not having to write the code to check that the PR exists and conditionally creating it would be good to have. |
|
Hey guys. And It's works. |
|
I have to create multible prs. But these Workarounds just working with one pr. I have feature1 -> main, feature1 -> staging and feature1 -> develop. I think a flag might be the cleaner solution. A flag that overwrites the existing pr instead sending an error. |
|
The examples above are not validating the error, if there is an issue with a parameter value or the github token, the script will just blindly try the "or" command. In case it helps anyone, I'm doing it like this: PR_URL="$(gh pr list --head "${BRANCH_NAME}" --state open --json url --jq .[].url)"
if [[ -n "${PR_URL}" ]]; then
echo "PR already exists -> ${PR_URL}"
exit 0
else
gh pr create ...
fi |
|
I want to give you another use case for which this feature ☝🏻 would be really useful. I'm using |
Uh oh!
There was an error while loading. Please reload this page.
At this moment if you run
gh pr createtwice, it will attempt to create a new pull request, even if one already existing.It would be much better if
gh pr createwill instead update a pull request if already existing and outdated, aka by runninggit push.ghis already able to detect existing pr as we can see by running a command likegh pr ready.Having a default
create-or-updatewould enable us to use gh more ways (including scripting!) and increase productivity.This would make the command a little bit more idempotent, as it will ensure that a PR is active and updated at the end.
All reactions