feat(input): allow to disable annotations
This commit is contained in:
@ -74,6 +74,7 @@ And ensure that you're using the <a href="https://github.com/Checkmarx/kics-gith
|
|||||||
| Variable | Example Value | Description | Type | Required | Default |
|
| Variable | Example Value | Description | Type | Required | Default |
|
||||||
|-------------------------------------------|--------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------|---------| -------- |--------------------------------------------------------|
|
|-------------------------------------------|--------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------|---------| -------- |--------------------------------------------------------|
|
||||||
| enable_comment | true | Enable pull request report comments | Boolean | No | false |
|
| enable_comment | true | Enable pull request report comments | Boolean | No | false |
|
||||||
|
| disable_annotations | true | Disable annotations report | Boolean | No | false |
|
||||||
| comments_with_queries | true | Add queries in th pull request report comments (available when enable_comments = true) | Boolean | No | false |
|
| comments_with_queries | true | Add queries in th pull request report comments (available when enable_comments = true) | Boolean | No | false |
|
||||||
| 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 |
|
| 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 |
|
||||||
| path | terraform/main.tf,Dockerfile | paths to a file or directories to scan, comma separated list | String | Yes | N/A |
|
| path | terraform/main.tf,Dockerfile | paths to a file or directories to scan, comma separated list | String | Yes | N/A |
|
||||||
|
@ -6,6 +6,10 @@ inputs:
|
|||||||
description: "The GITHUB_TOKEN for the current workflow run"
|
description: "The GITHUB_TOKEN for the current workflow run"
|
||||||
required: false
|
required: false
|
||||||
default: ${{github.token}}
|
default: ${{github.token}}
|
||||||
|
disable_annotations:
|
||||||
|
required: false
|
||||||
|
default: "false"
|
||||||
|
description: "Disable annotations report"
|
||||||
enable_comments:
|
enable_comments:
|
||||||
required: false
|
required: false
|
||||||
default: "false"
|
default: "false"
|
||||||
@ -105,6 +109,7 @@ runs:
|
|||||||
env:
|
env:
|
||||||
INPUT_TOKEN: ${{ inputs.token }}
|
INPUT_TOKEN: ${{ inputs.token }}
|
||||||
INPUT_OUTPUT_PATH: ${{ inputs.output_path }}
|
INPUT_OUTPUT_PATH: ${{ inputs.output_path }}
|
||||||
|
INPUT_DISABLE_ANNOTATIONS: ${{ inputs.disable_annotations }}
|
||||||
INPUT_ENABLE_COMMENTS: ${{ inputs.enable_comments }}
|
INPUT_ENABLE_COMMENTS: ${{ inputs.enable_comments }}
|
||||||
INPUT_COMMENTS_WITH_QUERIES: ${{ inputs.comments_with_queries }}
|
INPUT_COMMENTS_WITH_QUERIES: ${{ inputs.comments_with_queries }}
|
||||||
INPUT_EXCLUDED_COLUMNS_FOR_COMMENTS_WITH_QUERIES: ${{ inputs.excluded_column_for_comments_with_queries }}
|
INPUT_EXCLUDED_COLUMNS_FOR_COMMENTS_WITH_QUERIES: ${{ inputs.excluded_column_for_comments_with_queries }}
|
||||||
|
@ -47,6 +47,7 @@ async function main() {
|
|||||||
|
|
||||||
// Get ENV variables
|
// Get ENV variables
|
||||||
const githubToken = process.env.INPUT_TOKEN;
|
const githubToken = process.env.INPUT_TOKEN;
|
||||||
|
const disableAnnotations = process.env.INPUT_DISABLE_ANNOTATIONS;
|
||||||
const enableComments = process.env.INPUT_ENABLE_COMMENTS;
|
const enableComments = process.env.INPUT_ENABLE_COMMENTS;
|
||||||
const commentsWithQueries = process.env.INPUT_COMMENTS_WITH_QUERIES;
|
const commentsWithQueries = process.env.INPUT_COMMENTS_WITH_QUERIES;
|
||||||
const excludedColumnsForCommentsWithQueries = process.env.INPUT_EXCLUDED_COLUMNS_FOR_COMMENTS_WITH_QUERIES.split(',');
|
const excludedColumnsForCommentsWithQueries = process.env.INPUT_EXCLUDED_COLUMNS_FOR_COMMENTS_WITH_QUERIES.split(',');
|
||||||
@ -71,12 +72,13 @@ async function main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const parsedResults = readJSON(outputPath.resultsJSONFile);
|
const parsedResults = readJSON(outputPath.resultsJSONFile);
|
||||||
|
if (disableAnnotations.toLocaleLowerCase() === "false") {
|
||||||
|
annotator.annotateChangesWithResults(parsedResults);
|
||||||
|
}
|
||||||
if (enableComments.toLocaleLowerCase() === "true") {
|
if (enableComments.toLocaleLowerCase() === "true") {
|
||||||
await commenter.postPRComment(parsedResults, repo, prNumber, octokit, commentsWithQueries.toLocaleLowerCase() === "true", excludedColumnsForCommentsWithQueries);
|
await commenter.postPRComment(parsedResults, repo, prNumber, octokit, commentsWithQueries.toLocaleLowerCase() === "true", excludedColumnsForCommentsWithQueries);
|
||||||
}
|
}
|
||||||
|
|
||||||
annotator.annotateChangesWithResults(parsedResults);
|
|
||||||
|
|
||||||
setWorkflowStatus(exitCode);
|
setWorkflowStatus(exitCode);
|
||||||
cleanupOutput(outputPath.resultsJSONFile, outputFormats);
|
cleanupOutput(outputPath.resultsJSONFile, outputFormats);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
Reference in New Issue
Block a user