tarides / dune-release

Streamlining the release of dune packages to opam
ISC License
115 stars 36 forks source link

Improving error when remote is not a fork of opam-repository #346

Open emillon opened 3 years ago

emillon commented 3 years ago

When the remote config option is misconfigured, an error happens at package submission time:

$ dune-release opam submit
...
[-] Opening pull request to merge branch release-pkg-0.0.1 of git@github.com:myself/project into ocaml/opam-repository
dune-release: [ERROR] Could not retrieve pull request URL from response, unexpected Github API error: "Validation Failed"

This happens because myself/project is not a fork of ocaml/opam-repository.

In terms of checking, a remote that does not end in /opam-repository should be enough to raise eyebrows, but the right way is to use the API: in the case of a fork, https://api.github.com/repos/myself/opam-repository has .fork == true and .parent.full_name == "ocaml/opam-repository" while https://api.github.com/repos/myself/project has .fork == false.

This check can be performed at configure time, after this kind of error, or as part of a config-checking command. I'll defer that to @NathanReb if he considers that this should be improved.

emillon commented 3 years ago

See #286