prontolabs / pronto

Quick automated code review of your changes
MIT License
2.6k stars 245 forks source link

Pronto errored: Pull request for sha SHA_HERE with id PULL_REQUEST_ID_HERE was not found. #418

Open dmoroka opened 2 years ago

dmoroka commented 2 years ago

I tried to run sample configuration for adding comment for pull request. I have created personal access token with scope of "repo" to post comments for pull request on behalf of certain account and also added this token to secrets. I`m using pronto (0.10.0), pronto-rubocop (0.10.0)

This is my configuration

name: Pronto
on: [pull_request]

jobs:
  pronto:
    runs-on: ubuntu-latest

    steps:
      - name: Checkout code
        uses: actions/checkout@v2
      - run: |
          git fetch --no-tags --prune --depth=10 origin +refs/heads/*:refs/remotes/origin/*

      - name: Setup Ruby
        uses: ruby/setup-ruby@v1
        with:
          ruby-version: 2.5.7
          bundler-cache: true

      - name: Run Pronto
        run: bundle exec pronto run -f github_pr -c origin/${{ github.base_ref }}
        env:
          PRONTO_PULL_REQUEST_ID: ${{ github.event.pull_request.number }}
          PRONTO_GITHUB_ACCESS_TOKEN: "${{ secrets.MY_TOKEN_HERE }}"

when I ran this configuration on github actions , I got the following error

Run bundle exec pronto run -f github_pr -c origin/development
  bundle exec pronto run -f github_pr -c origin/development
  shell: /usr/bin/bash -e {0}
  env:
    PRONTO_PULL_REQUEST_ID: PULL_REQUEST_ID_HERE
    PRONTO_GITHUB_ACCESS_TOKEN: ***
An error occurred while Rails/UniqueValidationWithoutIndex cop was inspecting app/models/test_model.rb:11:2.
To see the complete backtrace run rubocop -d.
An error occurred while Rails/UniqueValidationWithoutIndex cop was inspecting app/models/test_model.rb:12:2.
To see the complete backtrace run rubocop -d.
WARNING: Unexpected middleware set after the adapter. This won't be supported from Faraday 1.0.
Pronto errored: Pull request for sha 1231231231231231231231231231231231231 with id 1234 was not found.

If I check this 1231231231231231231231231231231231231 SHA in repo it shows the following message "This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository."

Could you please help to solve this kind of issue?

niltonvasques commented 2 years ago

same issue here with pronto version 0.11

niltonvasques commented 2 years ago

@dmoroka I figured out the problem. Try to set the variable PRONTO_GITHUB_SLUG: {user}/{repo}

niltonvasques commented 2 years ago

The problem happened again, and this time was caused by octockit. I was forced to downgrade to 4.21.0.

Reference: https://github.com/octokit/octokit.rb/issues/1389