dune-release opam submit fails if a PR in opam-repository is already opened from the same branch (updates)
While trying to make a release of https://github.com/ocaml-opam/opam-0install-solver, I hit the following failure:
[-] Opening pull request to merge branch release-opam-0install-0.3 of [email protected]:kit-ty-kate/opam-repository into ocaml/opam-repository
dune-release: [ERROR] Could not retrieve pull request URL from response, unexpected Github API error: "Validation Failed"
The branch exists and everything worked fine before, however when running dune-release opam -vvv --dry-run submit again, the failing command looks like that:
curl --user ocaml-opam:${token} --silent --show-error --config - --dump-header - --data ...
The bit that doesn't look right here is --user ocaml-opam:${token}. This should be --user kit-ty-kate:${token}
Looking at my config file I can't see anything mentioning the ocaml-opam org:
$ cat ~/.config/dune/release.yml
user: kit-ty-kate
remote: [email protected]:kit-ty-kate/opam-repository
local: /home/kit_ty_kate/.cache/dune/opam-repository
Tested with dune-release 1.4.0
Nevermind it seems this error appears when a PR already exists. Here is the curl result when I send a similar command by hand:
{
"message": "Validation Failed",
"errors": [
{
"resource": "PullRequest",
"code": "custom",
"message": "A pull request already exists for kit-ty-kate:release-opam-0install-0.3."
}
],
"documentation_url": "https://docs.github.com/rest/reference/pulls#create-a-pull-request"
}
Would it be possible to update a PR when it already exists instead? The message can be modified if needed and the branch has already been force-pushed anyway.
Hi, we're working on having draft PRs
I don't think draft PRs necessarily are the solution here, it's again a recovery issue, e.g. you ran dune-release, something went wrong at some point and you simply can't re-run it because some of the actions have already been performed and it doesn't know how to handle it.
It should probably instead just force push, acknowledge that the PR already exist and skip this part or eventually update the PR if necessary.