Skip to content

Commit 12573fd

Browse files
fix: skip the PR comment when the event is not a pull request (#169)
1 parent b3ab06c commit 12573fd

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

‎src/main.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ async function main() {
8080
if (enableAnnotations.toLocaleLowerCase() === "true") {
8181
annotator.annotateChangesWithResults(parsedResults);
8282
}
83-
if (enableComments.toLocaleLowerCase() === "true") {
83+
if (enableComments.toLocaleLowerCase() === "true" && prNumber !== '') {
8484
await commenter.postPRComment(parsedResults, repo, prNumber, octokit, commentsWithQueries.toLocaleLowerCase() === "true", excludedColumnsForCommentsWithQueries);
8585
}
8686
if (enableJobsSummary.toLocaleLowerCase() === "true") {

‎test/e2e/action.test.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ test('pull request comment', async (t) => {
7474
assert.match(fake.comments[0].body, /### Queries Results/)
7575
})
7676

77-
await t.test('is skipped without failing the step when not running for a pull request', knownBug('on push events prNumber is "", so the action calls /issues//comments, gets a 404 and swallows it'), async (t) => {
77+
await t.test('is skipped without failing the step when not running for a pull request', async (t) => {
7878
const fake = await startFakeGitHub(t)
7979
const run = await runAction(t, { results: kicsResults(), inputs: { enable_comments: 'true' }, apiUrl: fake.url, event: 'push' })
8080
assert.equal(run.code, 0)

0 commit comments

Comments
 (0)