Export Change schema.

This commit is contained in:
Federico Builes
2022-05-31 06:06:19 +02:00
parent 92e40d7290
commit e622e72c6f
3 changed files with 15 additions and 12 deletions
Generated Vendored
+10 -7
View File
@@ -126,10 +126,7 @@ function run() {
if (change.change_type === 'added' &&
change.vulnerabilities !== undefined &&
change.vulnerabilities.length > 0) {
for (const vuln of change.vulnerabilities) {
core.info(`${ansi_styles_1.default.bold.open}${change.manifest} » ${change.name}@${change.version}${ansi_styles_1.default.bold.close} ${vuln.advisory_summary} ${renderSeverity(vuln.severity)}`);
core.info(`${vuln.advisory_url}`);
}
printChangeVulnerabilities(change);
failed = true;
}
}
@@ -158,6 +155,12 @@ function run() {
}
});
}
function printChangeVulnerabilities(change) {
for (const vuln of change.vulnerabilities) {
core.info(`${ansi_styles_1.default.bold.open}${change.manifest} » ${change.name}@${change.version}${ansi_styles_1.default.bold.close} ${vuln.advisory_summary} ${renderSeverity(vuln.severity)}`);
core.info(`${vuln.advisory_url}`);
}
}
function renderSeverity(severity) {
const color = {
critical: 'red',
@@ -201,9 +204,9 @@ var __importStar = (this && this.__importStar) || function (mod) {
return result;
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.ChangesSchema = exports.PullRequestSchema = void 0;
exports.ChangesSchema = exports.PullRequestSchema = exports.ChangeSchema = void 0;
const z = __importStar(__nccwpck_require__(3301));
const ChangeSchema = z.object({
exports.ChangeSchema = z.object({
change_type: z.enum(['added', 'removed']),
manifest: z.string(),
ecosystem: z.string(),
@@ -226,7 +229,7 @@ exports.PullRequestSchema = z.object({
base: z.object({ sha: z.string() }),
head: z.object({ sha: z.string() })
});
exports.ChangesSchema = z.array(ChangeSchema);
exports.ChangesSchema = z.array(exports.ChangeSchema);
/***/ }),
Generated Vendored
+1 -1
View File
File diff suppressed because one or more lines are too long
+4 -4
View File
@@ -1,6 +1,6 @@
import * as z from 'zod'
const ChangeSchema = z.object({
export const ChangeSchema = z.object({
change_type: z.enum(['added', 'removed']),
manifest: z.string(),
ecosystem: z.string(),
@@ -23,10 +23,10 @@ const ChangeSchema = z.object({
export const PullRequestSchema = z.object({
number: z.number(),
base: z.object({sha: z.string()}),
head: z.object({sha: z.string()})
base: z.object({ sha: z.string() }),
head: z.object({ sha: z.string() })
})
export const ChangesSchema = z.array(ChangeSchema)
export type Change = z.infer<typeof ChangeSchema>
export type Changes = z.infer<typeof ChangesSchema>