Fix checkout in Pronto on external pull requests

Since the target branch was in a different repository, the action failed
since it couldn't find the reference.

The code here is based on a recent change in Pronto [1] and with a comparison
between the repo.url property of pull_request.head and pull_request.base
to determine if the pull request was created from a forked repository

[1] https://github.com/prontolabs/pronto/commit/4fe28418b6
This commit is contained in:
taitus
2021-04-19 15:55:37 +02:00
parent 0654bcbad9
commit 9272873cf8

View File

@@ -13,6 +13,10 @@ jobs:
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- name: Run Pronto
- name: Run pronto
run: |
if [ ${{ github.event.pull_request.head.repo.full_name }} == ${{ github.event.pull_request.base.repo.full_name }} ]; then
PRONTO_PULL_REQUEST_ID="$(jq --raw-output .number "$GITHUB_EVENT_PATH")" PRONTO_GITHUB_ACCESS_TOKEN="${{ github.token }}" bundle exec pronto run -f github_status github_pr -c origin/${{ github.base_ref }}
else
bundle exec pronto run --exit-code -c origin/${{ github.base_ref }}
fi