Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make logging offences outside of the PR diff optional #8

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ inputs:
gem_versions:
description: Gem versions to install
default: rubocop:1.54.1 rubocop-rails:2.20.2 rubocop-rspec:2.22.0
outside_diff:
description: Log offences found outside of PR diff
default: "true"
rubocop_arguments:
description: Arguments passed to rubocop cli
default: ""
Expand All @@ -17,4 +20,5 @@ runs:
shell: bash
env:
GITHUB_TOKEN: ${{ inputs.github_token }}
OUTSIDE_DIFF: ${{ inputs.outside_diff }}
RUBOCOP_GEM_VERSIONS: ${{ inputs.gem_versions }}
4 changes: 3 additions & 1 deletion rubocop.rb
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,9 @@ def in_diff?(changed_files, path, line)
else
puts "Commenting on pull request with offenses found outside the diff"

Github.post!("/repos/#{owner_and_repository}/issues/#{pr_number}/comments", body: body)
if ENV.fetch("OUTSIDE_DIFF", "true") == "true"
Github.post!("/repos/#{owner_and_repository}/issues/#{pr_number}/comments", body: body)
end
end
elsif existing_separate_comment
existing_comment_id = existing_separate_comment.fetch("id")
Expand Down