Skip to content

Commit 0731baf

Browse files
committed
fix syntax
1 parent 1cd7dd1 commit 0731baf

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

.github/actions/gokakashi-scan/index.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const fetch = require ('node-fetch');
1+
const fetch = require('node-fetch'); // Use CommonJS require for v2.x
22
const { setFailed, getInput, setOutput } = require('@actions/core');
33

44
async function run() {
@@ -9,6 +9,7 @@ async function run() {
99
const imageName = getInput('image_name');
1010
const severity = getInput('severity');
1111
const publish = getInput('publish');
12+
const failOnSeverity = getInput('fail_on_severity'); // Get user-defined severity level
1213

1314
// Step 1: Trigger the scan and get the scan_id
1415
const triggerResponse = await fetch(`${apiHost}/api/v0/scan?image=${imageName}&severity=${severity}&publish=${publish}`, {
@@ -67,12 +68,11 @@ async function run() {
6768
// Step 3: Check the scan report for vulnerabilities
6869
const reportResponse = await fetch(reportUrl);
6970
const reportData = await reportResponse.json();
70-
const failOnSeverity = getInput('fail_on_severity'); // Get user-defined severity level
71-
// const hasVulnsToFail = reportData.vulnerabilities.some(vuln => vuln.severity === failOnSeverity);
7271

7372
if (failOnSeverity) {
7473
// Split the severities into an array
7574
const severitiesToFailOn = failOnSeverity.split(',').map(sev => sev.trim().toUpperCase());
75+
7676
// Check if the report contains any vulnerabilities matching the specified severities
7777
const hasVulnsToFail = reportData.vulnerabilities.some(vuln =>
7878
severitiesToFailOn.includes(vuln.severity)
@@ -86,8 +86,8 @@ async function run() {
8686
console.log('No fail_on_severity defined, proceeding without failing the job.');
8787
}
8888
} catch (error) {
89-
setFailed(error.message);
89+
setFailed(error.message);
9090
}
9191
}
9292

93-
run();
93+
run();

0 commit comments

Comments
 (0)