Skip to content

Commit

Permalink
update conditionals
Browse files Browse the repository at this point in the history
  • Loading branch information
Kemosabert committed Apr 19, 2024
1 parent 6af1f4e commit 10bfec7
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 5 deletions.
10 changes: 8 additions & 2 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,10 @@ async function run() {
if (result.diff_url) {
moreDetailsText = ` More details at ${result.diff_url}`;
}
const shouldPostComment = !isMergeGroupAction && (postScanStatusAsComment === 'on' || postScanStatusAsComment === 'only_if_new_findings');
let shouldPostComment = (postScanStatusAsComment === 'on' || postScanStatusAsComment === 'only_if_new_findings');
if (isMergeGroupAction) {
shouldPostComment = false; // no review comments in merge queue
}
if (shouldPostComment && !!((_9 = result.outcome) === null || _9 === void 0 ? void 0 : _9.human_readable_message)) {
try {
const options = { onlyIfNewFindings: postScanStatusAsComment === 'only_if_new_findings', hasNewFindings: !!result.gate_passed };
Expand All @@ -246,7 +249,10 @@ async function run() {
}
}
}
const shouldPostReviewComments = !isMergeGroupAction && (postReviewComments === 'on');
let shouldPostReviewComments = (postReviewComments === 'on');
if (isMergeGroupAction) {
shouldPostReviewComments = false; // no review comments in merge queue
}
if (shouldPostReviewComments) {
await createReviewComments(secretKey, scanId);
}
Expand Down
2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

12 changes: 10 additions & 2 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,11 @@ async function run(): Promise<void> {
moreDetailsText = ` More details at ${result.diff_url}`;
}

const shouldPostComment = !isMergeGroupAction && (postScanStatusAsComment === 'on' || postScanStatusAsComment === 'only_if_new_findings');
let shouldPostComment = (postScanStatusAsComment === 'on' || postScanStatusAsComment === 'only_if_new_findings');
if (isMergeGroupAction) {
shouldPostComment = false; // no review comments in merge queue
}

if (shouldPostComment && !!result.outcome?.human_readable_message) {
try {
const options = { onlyIfNewFindings: postScanStatusAsComment === 'only_if_new_findings', hasNewFindings: !!result.gate_passed };
Expand All @@ -149,7 +153,11 @@ async function run(): Promise<void> {
}
}

const shouldPostReviewComments = !isMergeGroupAction && (postReviewComments === 'on');
let shouldPostReviewComments = (postReviewComments === 'on');
if (isMergeGroupAction) {
shouldPostReviewComments = false; // no review comments in merge queue
}

if (shouldPostReviewComments) {
await createReviewComments(secretKey, scanId)
}
Expand Down

0 comments on commit 10bfec7

Please sign in to comment.