prontolabs / pronto

Quick automated code review of your changes

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Issue with comments not being created/posted with Github action workflow

ravibhusal opened this issue · comments

The following is my pronto setup

.github/workflows/pronto.yml

# https://docs.github.com/en/actions/learn-github-actions/understanding-github-actions

name: Pronto

# Doc[Events] https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows
on:
  pull_request_target:
    types: [opened, edited, reopened]

jobs:
  pronto:

    runs-on: ubuntu-latest

    steps:
      - name: Checkout repo
        uses: actions/checkout@v2.7.0
      - name: Setup Ruby # https://github.com/ruby/setup-ruby
        uses: ruby/setup-ruby@v1
        with:
          bundler-cache: true
      - name: Setup pronto # https://github.com/prontolabs/pronto#github-integration
        run: gem install pronto pronto-rubocop rubocop-rspec rubocop-performance rubocop-rails pronto-flay pronto-reek pronto-fasterer pronto-rails_best_practices pronto-brakeman
      - name: Run Pronto
        run: bundle exec pronto run -f github_status github_pr -c origin/${{ github.base_ref }}
        env:
          PRONTO_PULL_REQUEST_ID: ${{ github.event.pull_request.number }}
          PRONTO_GITHUB_ACCESS_TOKEN: ${{ github.token }}

.pronto.yml

# https://github.com/prontolabs/pronto#configuration

max_warnings: 200 #Default: 150
warnings_per_review: 100 # Default: 30
verbose: true # Default: false

Gemfile

group :development do
  gem 'pronto'
  gem 'pronto-brakeman', require: false
  gem 'pronto-fasterer', require: false
  gem 'pronto-flay', require: false
  gem 'pronto-rails_best_practices', require: false
  gem 'pronto-reek', require: false
  gem 'pronto-rubocop', require: false
end

Running pronto via github actions doesn't seem to create comment or post anything.
Logs from github action

image

However, running
PRONTO_GITHUB_ACCESS_TOKEN=xxxxx pronto run -f github_status github_pr -c origin/staging works just fine and it posts 4 messages for the same PR.

Logs: from the command line

Creating comment status on ded429c19cb90dedca60948a9ef578775d6c1f26
Creating comment status on ded429c19cb90dedca60948a9ef578775d6c1f26
Creating comment status on ded429c19cb90dedca60948a9ef578775d6c1f26
Creating comment status on ded429c19cb90dedca60948a9ef578775d6c1f26
Creating comment status on ded429c19cb90dedca60948a9ef578775d6c1f26
Creating comment status on ded429c19cb90dedca60948a9ef578775d6c1f26
Pronto::Brakeman
Pronto::Fasterer
Pronto::Flay
Pronto::RailsBestPractices
Pronto::Reek
Pronto::Rubocop
Creating a comment from message: #<Pronto::Message:0x00000001200ec0b0.....>
Creating a comment from message: #<Pronto::Message:0x00000001177f06f8.......>
Creating a comment from message: #<Pronto::Message:0x00000001177e2378......>
Creating a comment from message: #<Pronto::Message:0x00000001177dbbe0......>
Creating pull request comment on 2214
Creating pull request comment on 2214
Creating pull request comment on 2214
Creating pull request comment on 2214
4 Pronto messages posted to GitHub (0 existing)

I went through GitHub Actions Integration wiki page but couldn't find anything relevant to my issue.

Changing

on:
  pull_request_target:
    types: [opened, edited, reopened]

to

on: [pull_request]

worked for some reason.