Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ inputs:
test-junit-path:
required: false
description: 'Paths (newline-separated glob patterns) of JUnit XML files containing test results'
report-vulnerabilities:
required: false
description: 'Whether to report vulnerabilities found for dependencies'
default: 'false'
check-dependencies-status:
required: false
description: 'Checks the status of dependencies, and fails the build if not all dependencies in the current commit are accepted and controlled'
Expand Down
12 changes: 12 additions & 0 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions src/input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export type ActionInput = {
artifactPath: string[];
testCucumberPath: string[];
testJunitPath: string[];
reportVulnerabilities: boolean;
checkDependenciesStatus: boolean;
checkReleaseStatus: boolean;
};
Expand Down Expand Up @@ -38,6 +39,7 @@ export function readActionInput(): ActionInput {

const log = core.getInput('log');

const reportVulnerabilities = core.getBooleanInput('report-vulnerabilities');
const checkDependenciesStatus = core.getBooleanInput(
'check-dependencies-status'
);
Expand All @@ -59,6 +61,7 @@ export function readActionInput(): ActionInput {
testCucumberPath,
testJunitPath,
buildName,
reportVulnerabilities,
checkDependenciesStatus,
checkReleaseStatus,
};
Expand Down
10 changes: 10 additions & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,16 @@ async function run(): Promise<void> {
core.setFailed(`Failure reporting build to Ketryx: ${buildData.error}`);
}

if (buildData.vulnerabilities) {
core.info(`Vulnerabilities: ${buildData.vulnerabilities.length}`);
for (const vulnerability of buildData.vulnerabilities) {
core.error(vulnerability.summary, {
file: vulnerability.filePaths[0],
title: vulnerability.dependencyName,
});
}
}

core.setOutput('ok', buildData.ok);
core.setOutput('error', buildData.error);
core.setOutput('build-id', buildData.buildId);
Expand Down
15 changes: 15 additions & 0 deletions src/upload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ type BuildApiInputData = {
log?: string;
}>;
artifacts?: Array<ArtifactData>;
returnVulnerabilities?: boolean;
checkDependenciesStatus?: boolean;
checkReleaseStatus?: boolean;
};
Expand All @@ -40,6 +41,18 @@ type BuildApiResponseData = {
dependenciesAccepted?: boolean | null;
dependenciesControlled?: boolean | null;
versionsReleased?: boolean | null;
vulnerabilities?: VulnerabilityReturnData[];
};

type VulnerabilityReturnData = {
id: string;
summary: string;
description: string;
severity: number | null;
version: string;
urls: string[];
filePaths: string[];
dependencyName: string;
};

export async function uploadBuildArtifact(
Expand Down Expand Up @@ -121,6 +134,8 @@ export async function uploadBuild(
// on the Ketryx side, to make sure the current commit can be found.
syncRepositoryUpdate:
input.checkDependenciesStatus || input.checkReleaseStatus,

returnVulnerabilities: input.reportVulnerabilities,
checkDependenciesStatus: input.checkDependenciesStatus,
checkReleaseStatus: input.checkReleaseStatus,
};
Expand Down