name: linters
on: [pull_request]

jobs:
  linters:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@v2
      - run: |
          git fetch --no-tags --prune origin +refs/heads/*:refs/remotes/origin/*
      - name: Setup Ruby
        uses: ruby/setup-ruby@v1
        with:
          bundler-cache: true
      - 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

name: linters
on: [pull_request]

jobs:
  linters:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@v2
      - run: |
          git fetch --no-tags --prune origin +refs/heads/*:refs/remotes/origin/*
      - name: Setup Ruby
        uses: ruby/setup-ruby@v1
        with:
          bundler-cache: true
      - name: Run pronto
        run: |
          if [[ ${{ github.event.pull_request.head.repo.full_name }} == ${{ github.event.pull_request.base.repo.full_name }} && ${{ github.actor }} != dependabot* ]]; 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

Fix Pronto on Dependabot pull requests
Fix Pronto on Dependabot pull requests

As explained in "GitHub Actions: Workflows triggered by Dependabot PRs
will run with read-only permissions" [1], we need to consider Dependabot
pull requests as external pull requests.

[1] https://github.blog/changelog/2021-02-19-github-actions-workflows-triggered-by-dependabot-prs-will-run-with-read-only-permissions/
