diff --git a/README.md b/README.md index 41a0c93..132fef5 100644 --- a/README.md +++ b/README.md @@ -424,6 +424,7 @@ jobs: { "exclude-categories": "Encryption", "exclude-paths": "terraform/gcp/big_data.tf,terraform/gcp/gcs.tf", + "ignore-on-exit": "results", "log-file": true, "minimal-ui": false, "no-color": false, diff --git a/src/commenter.js b/src/commenter.js index 3525e73..e782a16 100644 --- a/src/commenter.js +++ b/src/commenter.js @@ -138,13 +138,17 @@ async function postPRComment(results, repo, prNumber, octokit, commentWithQuerie message = createComment(results) + "_The queries table was omitted: it exceeds the GitHub comment size limit._\n"; } - const comments = await octokit.paginate(octokit.rest.issues.listComments, { + const {data: comments} = await octokit.rest.issues.listComments({ ...repo, issue_number: prNumber, - per_page: 100, }); - const comment = comments.find((comment) => comment.body?.startsWith("![kics-logo](")); + const comment = comments.find((comment) => { + return ( + comment.user.login === "github-actions[bot]" && + comment.body.startsWith("![kics-logo](") + ); + }); if (comment) { await octokit.rest.issues.updateComment({ diff --git a/test/e2e/action-contract.test.js b/test/e2e/action-contract.test.js index d607ec1..3c8df60 100644 --- a/test/e2e/action-contract.test.js +++ b/test/e2e/action-contract.test.js @@ -5,7 +5,6 @@ const assert = require('node:assert/strict') const fs = require('node:fs') const path = require('node:path') const { ROOT, loadManifest, runnerInputEnv } = require('../helpers/action-manifest') -const { knownBug } = require('../helpers/known-bug') const { inputs, env } = loadManifest() const read = (file) => fs.readFileSync(path.join(ROOT, file), 'utf8') @@ -16,7 +15,6 @@ const consumed = new Set([ ]) consumed.delete('INPUT_PARAM') // entrypoint.sh's own "-p " variable, not an action input - test('action.yml parsing assumptions hold', async (t) => { await t.test('declares inputs and the runs.env mappings the tests rely on', () => { assert.ok(Object.keys(inputs).length > 20, 'inputs section parsed') @@ -43,8 +41,7 @@ test('every declared input is used by the code', async (t) => { const viaEnvMapping = new Set(Object.entries(env).filter(([key]) => consumed.has(key)).map(([, input]) => input)) for (const name of Object.keys(inputs)) { const used = consumed.has(`INPUT_${name.toUpperCase()}`) || viaEnvMapping.has(name) - const options = name in KNOWN_UNUSED_INPUTS ? knownBug(KNOWN_UNUSED_INPUTS[name]) : {} - await t.test(name, options, () => assert.ok(used, `input "${name}" is declared but never read`)) + await t.test(name, () => assert.ok(used, `input "${name}" is declared but never read`)) } }) diff --git a/test/e2e/repository-contract.test.js b/test/e2e/repository-contract.test.js index 0c8a0eb..7a23c9a 100644 --- a/test/e2e/repository-contract.test.js +++ b/test/e2e/repository-contract.test.js @@ -4,7 +4,6 @@ const test = require('node:test') const assert = require('node:assert/strict') const fs = require('node:fs') const path = require('node:path') -const { knownBug } = require('../helpers/known-bug') const { ROOT, loadManifest } = require('../helpers/action-manifest') const read = (file) => fs.readFileSync(path.join(ROOT, file), 'utf8') @@ -54,7 +53,6 @@ test('README', async (t) => { await t.test('has SARIF upload examples', () => assert.ok(sarifExamples.length > 0)) for (const [i, block] of sarifExamples.entries()) { - const options = block.includes('config_path') ? knownBug('the config file example sets neither ignore_on_exit nor ignore-on-exit, so the job fails before the SARIF upload (#76)') : {} - await t.test(`SARIF upload example ${i + 1} does not fail before the upload`, options, () => assert.match(block, /ignore[_-]on[_-]exit/)) + await t.test(`SARIF upload example ${i + 1} does not fail before the upload`, () => assert.match(block, /ignore[_-]on[_-]exit/)) } })