Skip to content

Commit eef2554

Browse files
docs(readme): set ignore-on-exit in the config file SARIF example (#175)
* add: unit e2e test suite, ci workflow and coverage badge * add: explanatory comment to write permissions * update: test coverage to match real use cases and known bug count * add: known-bug missing file * add: correct badge * fix: input queries and bom params * fix: only enable boolean switches when the input is "true" * fix: escape pipes and all newlines in query table cells * fix: skip the PR comment when the event is not a pull request * fix: post the summary without the queries table when the comment is too large * test: make the fake kics write results world-readable like KICS v2.1.20 * fix: keep a scan path containing spaces as a single argument * fix: keep path-valued inputs containing spaces as single arguments * fix: remove the results.json KICS wrote into the workspace when json was not requested * fix: honor the type input as an alias of platform_type * docs: set ignore-on-exit in the config file SARIF example * docs: set ignore-on-exit in the config file SARIF example
1 parent 5e221d4 commit eef2554

4 files changed

Lines changed: 10 additions & 10 deletions

File tree

‎README.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -424,6 +424,7 @@ jobs:
424424
{
425425
"exclude-categories": "Encryption",
426426
"exclude-paths": "terraform/gcp/big_data.tf,terraform/gcp/gcs.tf",
427+
"ignore-on-exit": "results",
427428
"log-file": true,
428429
"minimal-ui": false,
429430
"no-color": false,

‎src/commenter.js‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,13 +138,17 @@ async function postPRComment(results, repo, prNumber, octokit, commentWithQuerie
138138
message = createComment(results) + "_The queries table was omitted: it exceeds the GitHub comment size limit._\n";
139139
}
140140

141-
const comments = await octokit.paginate(octokit.rest.issues.listComments, {
141+
const {data: comments} = await octokit.rest.issues.listComments({
142142
...repo,
143143
issue_number: prNumber,
144-
per_page: 100,
145144
});
146145

147-
const comment = comments.find((comment) => comment.body?.startsWith("![kics-logo]("));
146+
const comment = comments.find((comment) => {
147+
return (
148+
comment.user.login === "github-actions[bot]" &&
149+
comment.body.startsWith("![kics-logo](")
150+
);
151+
});
148152

149153
if (comment) {
150154
await octokit.rest.issues.updateComment({

‎test/e2e/action-contract.test.js‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ const assert = require('node:assert/strict')
55
const fs = require('node:fs')
66
const path = require('node:path')
77
const { ROOT, loadManifest, runnerInputEnv } = require('../helpers/action-manifest')
8-
const { knownBug } = require('../helpers/known-bug')
98

109
const { inputs, env } = loadManifest()
1110
const read = (file) => fs.readFileSync(path.join(ROOT, file), 'utf8')
@@ -16,7 +15,6 @@ const consumed = new Set([
1615
])
1716
consumed.delete('INPUT_PARAM') // entrypoint.sh's own "-p <path>" variable, not an action input
1817

19-
2018
test('action.yml parsing assumptions hold', async (t) => {
2119
await t.test('declares inputs and the runs.env mappings the tests rely on', () => {
2220
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) => {
4341
const viaEnvMapping = new Set(Object.entries(env).filter(([key]) => consumed.has(key)).map(([, input]) => input))
4442
for (const name of Object.keys(inputs)) {
4543
const used = consumed.has(`INPUT_${name.toUpperCase()}`) || viaEnvMapping.has(name)
46-
const options = name in KNOWN_UNUSED_INPUTS ? knownBug(KNOWN_UNUSED_INPUTS[name]) : {}
47-
await t.test(name, options, () => assert.ok(used, `input "${name}" is declared but never read`))
44+
await t.test(name, () => assert.ok(used, `input "${name}" is declared but never read`))
4845
}
4946
})
5047

‎test/e2e/repository-contract.test.js‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ const test = require('node:test')
44
const assert = require('node:assert/strict')
55
const fs = require('node:fs')
66
const path = require('node:path')
7-
const { knownBug } = require('../helpers/known-bug')
87
const { ROOT, loadManifest } = require('../helpers/action-manifest')
98

109
const read = (file) => fs.readFileSync(path.join(ROOT, file), 'utf8')
@@ -54,7 +53,6 @@ test('README', async (t) => {
5453
await t.test('has SARIF upload examples', () => assert.ok(sarifExamples.length > 0))
5554

5655
for (const [i, block] of sarifExamples.entries()) {
57-
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)') : {}
58-
await t.test(`SARIF upload example ${i + 1} does not fail before the upload`, options, () => assert.match(block, /ignore[_-]on[_-]exit/))
56+
await t.test(`SARIF upload example ${i + 1} does not fail before the upload`, () => assert.match(block, /ignore[_-]on[_-]exit/))
5957
}
6058
})

0 commit comments

Comments
 (0)