From 95de373b02b96fec7a25e5391b0a436ea988c195 Mon Sep 17 00:00:00 2001 From: David Malheiro Date: Fri, 9 May 2025 15:28:02 +0100 Subject: [PATCH 1/3] chore: Added logs when loading the workflow files --- src/main.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main.ts b/src/main.ts index e992cc9..d6f0cda 100644 --- a/src/main.ts +++ b/src/main.ts @@ -203,9 +203,11 @@ async function run(context: typeof github.context): Promise { }); workflowFilePaths.forEach((wf) => { + console.log("\nREADING WORKFLOW FILES"); + console.log(line); let workflow: Workflow = { filePath: wf, actions: Array() }; workflowFiles.push(workflow); - + console.log("\nReading:" + workflow.filePath); try { let yaml: any = yamlParse.load( fs.readFileSync(workflow.filePath, "utf-8"), From 97dfe8f4f9e8ecb8842444e5ce7345bc9cd72d21 Mon Sep 17 00:00:00 2001 From: David Malheiro Date: Fri, 9 May 2025 15:56:06 +0100 Subject: [PATCH 2/3] chore: build --- lib/index.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/index.js b/lib/index.js index 7c0efd0..703923a 100644 --- a/lib/index.js +++ b/lib/index.js @@ -39051,8 +39051,11 @@ function run(context) { console.log(item.toString()); }); workflowFilePaths.forEach((wf) => { + console.log("\nREADING WORKFLOW FILES"); + console.log(line); let workflow = { filePath: wf, actions: Array() }; workflowFiles.push(workflow); + console.log("\nReading:" + workflow.filePath); try { let yaml = js_yaml_1.default.load(fs_1.default.readFileSync(workflow.filePath, "utf-8")); let actionStrings = getPropertyValues(yaml, "uses"); From 1909c15fcc7b4ee0d5684406dc4083fe7468347d Mon Sep 17 00:00:00 2001 From: David Malheiro Date: Tue, 13 May 2025 09:38:26 +0100 Subject: [PATCH 3/3] chore: Logs more readable --- lib/index.js | 10 +++++----- package.json | 2 +- src/main.ts | 10 +++++----- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/lib/index.js b/lib/index.js index 703923a..294a580 100644 --- a/lib/index.js +++ b/lib/index.js @@ -39050,8 +39050,8 @@ function run(context) { actionPolicyList.forEach((item) => { console.log(item.toString()); }); + console.log("\nREADING WORKFLOW FILES"); workflowFilePaths.forEach((wf) => { - console.log("\nREADING WORKFLOW FILES"); console.log(line); let workflow = { filePath: wf, actions: Array() }; workflowFiles.push(workflow); @@ -39106,12 +39106,12 @@ function run(context) { actionViolations.push(violation); } else { - console.log("\nNo violations detected"); + console.log("\n ✅ No violations detected"); } }); if (actionViolations.length > 0) { core.setOutput("violations", actionViolations); - console.log("\n!!! ACTION POLICY VIOLATIONS DETECTED !!!"); + console.log("\n ❌ ACTION POLICY VIOLATIONS DETECTED ❌"); console.log(line); actionViolations.forEach((workflow) => { console.log(`Workflow: ${workflow.filePath}`); @@ -39121,11 +39121,11 @@ function run(context) { console.log(); }); if (failIfViolations) { - core.setFailed("!!! ACTION POLICY VIOLATIONS DETECTED !!!"); + core.setFailed(" ❌ ACTION POLICY VIOLATIONS DETECTED ❌"); } } else { - console.log("\nAll workflow files contain actions that conform to the policy provided."); + console.log("\n ✅ All workflow files contain actions that conform to the policy provided."); } } catch (error) { diff --git a/package.json b/package.json index 904ac61..ad8f9fd 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "actionbot", - "version": "1.0.4", + "version": "1.0.5", "private": true, "description": "Github Action Policy Checker as a Github Action", "main": "lib/index.js", diff --git a/src/main.ts b/src/main.ts index d6f0cda..bec39d3 100644 --- a/src/main.ts +++ b/src/main.ts @@ -202,8 +202,8 @@ async function run(context: typeof github.context): Promise { console.log(item.toString()); }); + console.log("\nREADING WORKFLOW FILES"); workflowFilePaths.forEach((wf) => { - console.log("\nREADING WORKFLOW FILES"); console.log(line); let workflow: Workflow = { filePath: wf, actions: Array() }; workflowFiles.push(workflow); @@ -267,13 +267,13 @@ async function run(context: typeof github.context): Promise { if (violation.actions.length > 0) { actionViolations.push(violation); } else { - console.log("\nNo violations detected"); + console.log("\n ✅ No violations detected"); } }); if (actionViolations.length > 0) { core.setOutput("violations", actionViolations); - console.log("\n!!! ACTION POLICY VIOLATIONS DETECTED !!!"); + console.log("\n ❌ ACTION POLICY VIOLATIONS DETECTED ❌"); console.log(line); actionViolations.forEach((workflow) => { @@ -287,11 +287,11 @@ async function run(context: typeof github.context): Promise { }); if (failIfViolations) { - core.setFailed("!!! ACTION POLICY VIOLATIONS DETECTED !!!"); + core.setFailed(" ❌ ACTION POLICY VIOLATIONS DETECTED ❌"); } } else { console.log( - "\nAll workflow files contain actions that conform to the policy provided.", + "\n ✅ All workflow files contain actions that conform to the policy provided.", ); } } catch (error: unknown) {