Skip to content

Commit

Permalink
Add suppressedFiles argument
Browse files Browse the repository at this point in the history
  • Loading branch information
Yard1 committed Jun 18, 2020
1 parent 845415a commit 3ae04fb
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 0 deletions.
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,19 @@ You can choose to suppress annotations with chosen CWTools offence category IDs
default: ${{ secrets.GITHUB_TOKEN }}
```

### suppressedFiles (optional)

You can choose to suppress annotations completely in certain files. Use paths from root of repository, make sure to have no trailing whitespace. Globbing is not supported.

```yml
- uses: cwtools/[email protected]
with:
game: hoi4
suppressedFiles: '["common/scripted_effects/my_effects.txt", "events/EventFile.txt"]' # will completely suppress any annotations in those two files
env:
default: ${{ secrets.GITHUB_TOKEN }}
```

### CWToolsCLIVersion (optional)

Which CWTools.CLI version to use (Default: latest stable).
Expand Down
4 changes: 4 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ inputs:
description: 'What CWTools offence categories to suppress, in JSON format: {"failure":[], "warning":[], "notice":[]}'
required: false
default: '{"failure":[], "warning":[], "notice":[]}'
suppressedFiles:
description: 'Which files to completely ignore, in JSON format: ["path/from/root/repo/folder", "path/from/root/repo/folder"]'
required: false
default: '[]'
CWToolsCLIVersion:
description: 'Which CWTools.CLI version to use (Default: latest stable)'
required: false
Expand Down
1 change: 1 addition & 0 deletions examples/GitLab_CWToolsCI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ variables:
#INPUT_RULESREF: 'master'
#INPUT_VANILLAMODE: '0'
#INPUT_SUPPRESSEDOFFENCECATEGORIES: '{"failure":[], "warning":[], "notice":[]}'
#INPUT_SUPPRESSEDFILES: '[]'
#INPUT_CWTOOLSCLIVERSION: ''

stages:
Expand Down
4 changes: 4 additions & 0 deletions lib/cwtools.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
@CW_CI_ENV = ENV["CW_CI_ENV"]

@SUPPRESSED_OFFENCE_CATEGORIES = JSON.parse(ENV["INPUT_SUPPRESSEDOFFENCECATEGORIES"])
@SUPPRESSED_FILES = JSON.parse(ENV["INPUT_SUPPRESSEDFILES"])
@GAME = ENV["INPUT_GAME"]
@LOC_LANGUAGES = ENV["INPUT_LOCLANGUAGES"]
@MOD_PATH = ENV["INPUT_MODPATH"]
Expand Down Expand Up @@ -204,6 +205,9 @@ def run_cwtools
path = file["file"]
path = path.sub! @CW_WORKSPACE+"/", ''
path = path.strip
if @SUPPRESSED_FILES.include?(path)
next
end
offenses = file["errors"]
if !@CHANGED_ONLY || @changed_files.include?(path)
offenses.each do |offense|
Expand Down
3 changes: 3 additions & 0 deletions lib/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ elif [ -n "$CI_PROJECT_DIR" ]; then
if [ -z "$INPUT_SUPPRESSEDOFFENCECATEGORIES" ] || [ "$INPUT_SUPPRESSEDOFFENCECATEGORIES" = "" ]; then
export INPUT_SUPPRESSEDOFFENCECATEGORIES='{"failure":[], "warning":[], "notice":[]}'
fi
if [ -z "$INPUT_SUPPRESSEDFILES" ] || [ "$INPUT_SUPPRESSEDFILES" = "" ]; then
export INPUT_SUPPRESSEDFILES='[]'
fi
if [ -z "$INPUT_CWTOOLSCLIVERSION" ] || [ "$INPUT_CWTOOLSCLIVERSION" = "" ]; then
export INPUT_CWTOOLSCLIVERSION=''
fi
Expand Down

0 comments on commit 3ae04fb

Please sign in to comment.