Closed tonyvince closed 3 years ago
@tonyvince Hey 👋 Thank you for your feedback!
I guess, reviewdog only works with Pull Requests, because I see the following message:
reviewdog: this is not PullRequest build.
@haya14busa Please correct me If I'm wrong
@tonyvince Try to use the github-check reporter instead of the github-pr-review
:
name: RuboCop
on: [push, pull_request]
jobs:
rubocop:
name: runner / rubocop
runs-on: ubuntu-18.04
steps:
- name: Check out code
uses: actions/checkout@v1
- uses: ruby/setup-ruby@v1
with:
ruby-version: 2.5.1
- name: rubocop
uses: reviewdog/action-rubocop@v1
with:
rubocop_version: gemfile
rubocop_extensions: rubocop-rails:gemfile rubocop-rspec:gemfile
github_token: ${{ secrets.GITHUB_TOKEN }}
reporter: github-check
fail_on_error: true
@tonyvince Can I close this issue?
Shouldn't github-check
be documented as a valid option?
I'm trying to run this on workflow_dispatch
and get the following error:
reviewdog: post failed for rubocop: failed to create check: POST https://api.github.com/repos/org/repo/check-runs: 422 No commit found for SHA: []
I imagine this is because github-check
assumes the SHA from a push. I'm unsure what is different about where the SHA comes from, but I see it can be set with CI_COMMIT
:
In my case, I plan to do something like:
- name: Set commit SHA for non pr runs
if: github.event_name != 'pull_request'
run: echo ::set-env name=CI_COMMIT::${{ github.sha }}
- name: rubocop_rails
uses: reviewdog/action-rubocop@v2
with:
rubocop_version: gemfile
rubocop_extensions: rubocop-rails:gemfile rubocop-rspec:gemfile
github_token: ${{ secrets.github_token }}
level: ${{ github.event.inputs.rubocop_log_level != '' && github.event.inputs.rubocop_log_level || 'error' }}
workdir: rails/
fail_on_error: false # for now
reporter: ${{ github.event_name == 'pull_request' && 'github-pr-review' || 'github-check' }}
The above didn't work for me because there is a separate code path for github actions: https://github.com/reviewdog/reviewdog/blob/8c93ceaf90b675262a5386828501ba2b5a461df0/cienv/cienv.go#L38-L40
Which specifically looks for PullRequest information in the event object: https://github.com/reviewdog/reviewdog/blob/8c93ceaf90b675262a5386828501ba2b5a461df0/cienv/github_actions.go#L86
I've raised reviewdog/reviewdog#1062
It seems like the action does not support push action, Is there a workaround for this?
rubocop version: 0.81.0
action
error trace