Closed ConorMacBride closed 2 years ago
Note: the first checkout
task deletes and recreates the sources directory so the bash
task which writes to the sources directory (to clone the fork) must be after all checkout
tasks in the job have run.
@Cadair Can you review and merge? This is working at https://github.com/sunpy/sunpy/pull/5700.
from a fork it can't find the commit hash in the self repository Azure checks out
This is unfortunate, but I am like 90% sure it's possible to do that without resorting to the github API and checking out the fork itself.
I think the following git incantation should fetch all the commits for a PR as referenced through the upstream repo and not needing to reference the fork:
$ git fetch origin refs/pull/<num>/head
I tried this locally and it fetched all the commits on your sunpy/sunpy#5700 PR. If you ran this command before you went looking for the commit hash I think it would solve the issue without the extra API call?
That works much better! I've added the git fetch
to the script which'll run if a PR_NUMBER
env variable is set. It's working here: https://dev.azure.com/sunpy/sunpy/_build/results?buildId=21560&view=logs&j=b4877b35-8b5c-5460-4bbd-df532ed4d3a3&t=ebcf7dce-a25f-503f-8595-fdd814047e50
Thanks a lot once again!
When using the
check_skip.yml
template on a PR from a fork it can't find the commit hash in theself
repository Azure checks out. This PR is to use the GitHub API to get the clone URL of the fork and clone that instead of the target repository. Testing at https://github.com/sunpy/sunpy/pull/5700.