Skip to content

Commit

Permalink
Merge pull request #2 from CareerPlug/outside-diff-option
Browse files Browse the repository at this point in the history
Make logging offences outside of the PR diff optional
  • Loading branch information
igray authored Apr 13, 2024
2 parents 102d2e3 + f62f445 commit 884f3c1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 4 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,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 @@ -21,4 +24,5 @@ runs:
env:
FAILURE_EXIT_CODE: ${{ inputs.failure_exit_code }}
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

0 comments on commit 884f3c1

Please sign in to comment.