From 9272873cf8aa6e3d1571a692f70444a76be37b82 Mon Sep 17 00:00:00 2001 From: taitus Date: Mon, 19 Apr 2021 15:55:37 +0200 Subject: [PATCH] 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 --- .github/workflows/linters.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/linters.yml b/.github/workflows/linters.yml index c29601043..b42671bd8 100644 --- a/.github/workflows/linters.yml +++ b/.github/workflows/linters.yml @@ -13,6 +13,10 @@ jobs: uses: ruby/setup-ruby@v1 with: bundler-cache: true - - name: Run Pronto + - name: Run pronto run: | - 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 }} + 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