Skip to content

Commit

Permalink
Update console import and improve logging
Browse files Browse the repository at this point in the history
  • Loading branch information
austenstone committed Jan 31, 2024
1 parent c043c9a commit e6c7393
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion dist/index.js

Large diffs are not rendered by default.

14 changes: 10 additions & 4 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { endGroup, getBooleanInput, getInput, setOutput, startGroup } from "@actions/core";
import { getSecretScanningAlerts, getCodeScanningAlerts, getDependabotAlerts, getOctokit } from "./github-security";
import { info } from "console";
import { groupEnd, info } from "console";

interface Input {
token: string;
Expand Down Expand Up @@ -53,34 +53,40 @@ export const run = async (): Promise<void> => {
};

startGroup('Getting GitHub Security Alerts');
info(`Settings: ${JSON.stringify(input, null, 2)}`);
info(`Input: ${JSON.stringify(input, null, 2)}`);
endGroup();

const requests = [] as Promise<any>[];

if (input.dependabot) {
requests.push(
getDependabotAlerts(octokit, { ...owner, queryParams: input.dependabotQueryParams }).then((results) => {
info(`Dependabot Alerts: ${JSON.stringify(results, null, 2)}`);
startGroup('Dependabot');
info(JSON.stringify(results, null, 2));
setOutput('dependabot', JSON.stringify(results));
groupEnd();
})
);
}

if (input.codeScanning) {
requests.push(
getCodeScanningAlerts(octokit, { ...owner, queryParams: input.codeScanningQueryParams }).then((results) => {
info(`Code Scanning Alerts: ${JSON.stringify(results, null, 2)}`);
startGroup('Code Scanning');
info(JSON.stringify(results, null, 2));
setOutput('code-scanning', JSON.stringify(results));
groupEnd();
})
);
}

if (input.secretScanning) {
requests.push(
getSecretScanningAlerts(octokit, { ...owner, queryParams: input.secretScanningQueryParams }).then((results) => {
startGroup('Secret Scanning');
info(`Secret Scanning Alerts: ${JSON.stringify(results, null, 2)}`);
setOutput('secret-scanning', JSON.stringify(results));
groupEnd();
})
);
}
Expand Down

0 comments on commit e6c7393

Please sign in to comment.