Skip to content

Commit 3ae04fb

Browse files
committed
Add suppressedFiles argument
1 parent 845415a commit 3ae04fb

File tree

5 files changed

+25
-0
lines changed

5 files changed

+25
-0
lines changed

README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,19 @@ You can choose to suppress annotations with chosen CWTools offence category IDs
175175
default: ${{ secrets.GITHUB_TOKEN }}
176176
```
177177

178+
### suppressedFiles (optional)
179+
180+
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.
181+
182+
```yml
183+
- uses: cwtools/[email protected]
184+
with:
185+
game: hoi4
186+
suppressedFiles: '["common/scripted_effects/my_effects.txt", "events/EventFile.txt"]' # will completely suppress any annotations in those two files
187+
env:
188+
default: ${{ secrets.GITHUB_TOKEN }}
189+
```
190+
178191
### CWToolsCLIVersion (optional)
179192

180193
Which CWTools.CLI version to use (Default: latest stable).

action.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ inputs:
4040
description: 'What CWTools offence categories to suppress, in JSON format: {"failure":[], "warning":[], "notice":[]}'
4141
required: false
4242
default: '{"failure":[], "warning":[], "notice":[]}'
43+
suppressedFiles:
44+
description: 'Which files to completely ignore, in JSON format: ["path/from/root/repo/folder", "path/from/root/repo/folder"]'
45+
required: false
46+
default: '[]'
4347
CWToolsCLIVersion:
4448
description: 'Which CWTools.CLI version to use (Default: latest stable)'
4549
required: false

examples/GitLab_CWToolsCI.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ variables:
1919
#INPUT_RULESREF: 'master'
2020
#INPUT_VANILLAMODE: '0'
2121
#INPUT_SUPPRESSEDOFFENCECATEGORIES: '{"failure":[], "warning":[], "notice":[]}'
22+
#INPUT_SUPPRESSEDFILES: '[]'
2223
#INPUT_CWTOOLSCLIVERSION: ''
2324

2425
stages:

lib/cwtools.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
@CW_CI_ENV = ENV["CW_CI_ENV"]
3636

3737
@SUPPRESSED_OFFENCE_CATEGORIES = JSON.parse(ENV["INPUT_SUPPRESSEDOFFENCECATEGORIES"])
38+
@SUPPRESSED_FILES = JSON.parse(ENV["INPUT_SUPPRESSEDFILES"])
3839
@GAME = ENV["INPUT_GAME"]
3940
@LOC_LANGUAGES = ENV["INPUT_LOCLANGUAGES"]
4041
@MOD_PATH = ENV["INPUT_MODPATH"]
@@ -204,6 +205,9 @@ def run_cwtools
204205
path = file["file"]
205206
path = path.sub! @CW_WORKSPACE+"/", ''
206207
path = path.strip
208+
if @SUPPRESSED_FILES.include?(path)
209+
next
210+
end
207211
offenses = file["errors"]
208212
if !@CHANGED_ONLY || @changed_files.include?(path)
209213
offenses.each do |offense|

lib/entrypoint.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ elif [ -n "$CI_PROJECT_DIR" ]; then
3535
if [ -z "$INPUT_SUPPRESSEDOFFENCECATEGORIES" ] || [ "$INPUT_SUPPRESSEDOFFENCECATEGORIES" = "" ]; then
3636
export INPUT_SUPPRESSEDOFFENCECATEGORIES='{"failure":[], "warning":[], "notice":[]}'
3737
fi
38+
if [ -z "$INPUT_SUPPRESSEDFILES" ] || [ "$INPUT_SUPPRESSEDFILES" = "" ]; then
39+
export INPUT_SUPPRESSEDFILES='[]'
40+
fi
3841
if [ -z "$INPUT_CWTOOLSCLIVERSION" ] || [ "$INPUT_CWTOOLSCLIVERSION" = "" ]; then
3942
export INPUT_CWTOOLSCLIVERSION=''
4043
fi

0 commit comments

Comments
 (0)