Skip to content

Commit 1df7382

Browse files
author
Mickaël VILLERS
committed
feat(input): allow to disable annotations
1 parent 40fa83a commit 1df7382

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ And ensure that you're using the <a href="https://github.com/Checkmarx/kics-gith
7474
| Variable | Example Value &nbsp; | Description &nbsp; | Type | Required | Default |
7575
|-------------------------------------------|--------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------|---------| -------- |--------------------------------------------------------|
7676
| enable_comment | true | Enable pull request report comments | Boolean | No | false |
77+
| disable_annotations | true | Disable annotations report | Boolean | No | false |
7778
| comments_with_queries | true | Add queries in th pull request report comments (available when enable_comments = true) | Boolean | No | false |
7879
| excluded_column_for_comments_with_queries | description_id,similarity_id,search_line,search_value | Excluded columns for the comment with queries, accepts a comma separated list | String | No | description_id,similarity_id,search_line,search_value |
7980
| path | terraform/main.tf,Dockerfile | paths to a file or directories to scan, comma separated list | String | Yes | N/A |

action.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ inputs:
66
description: "The GITHUB_TOKEN for the current workflow run"
77
required: false
88
default: ${{github.token}}
9+
disable_annotations:
10+
required: false
11+
default: "false"
12+
description: "Disable annotations report"
913
enable_comments:
1014
required: false
1115
default: "false"
@@ -105,6 +109,7 @@ runs:
105109
env:
106110
INPUT_TOKEN: ${{ inputs.token }}
107111
INPUT_OUTPUT_PATH: ${{ inputs.output_path }}
112+
INPUT_DISABLE_ANNOTATIONS: ${{ inputs.disable_annotations }}
108113
INPUT_ENABLE_COMMENTS: ${{ inputs.enable_comments }}
109114
INPUT_COMMENTS_WITH_QUERIES: ${{ inputs.comments_with_queries }}
110115
INPUT_EXCLUDED_COLUMNS_FOR_COMMENTS_WITH_QUERIES: ${{ inputs.excluded_column_for_comments_with_queries }}

src/main.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ async function main() {
4747

4848
// Get ENV variables
4949
const githubToken = process.env.INPUT_TOKEN;
50+
const disableAnnotations = process.env.INPUT_DISABLE_ANNOTATIONS;
5051
const enableComments = process.env.INPUT_ENABLE_COMMENTS;
5152
const commentsWithQueries = process.env.INPUT_COMMENTS_WITH_QUERIES;
5253
const excludedColumnsForCommentsWithQueries = process.env.INPUT_EXCLUDED_COLUMNS_FOR_COMMENTS_WITH_QUERIES.split(',');
@@ -71,12 +72,13 @@ async function main() {
7172
}
7273

7374
const parsedResults = readJSON(outputPath.resultsJSONFile);
75+
if (disableAnnotations.toLocaleLowerCase() === "false") {
76+
annotator.annotateChangesWithResults(parsedResults);
77+
}
7478
if (enableComments.toLocaleLowerCase() === "true") {
7579
await commenter.postPRComment(parsedResults, repo, prNumber, octokit, commentsWithQueries.toLocaleLowerCase() === "true", excludedColumnsForCommentsWithQueries);
7680
}
7781

78-
annotator.annotateChangesWithResults(parsedResults);
79-
8082
setWorkflowStatus(exitCode);
8183
cleanupOutput(outputPath.resultsJSONFile, outputFormats);
8284
} catch (e) {

0 commit comments

Comments
 (0)