Export Change schema.
This commit is contained in:
+10
-7
@@ -126,10 +126,7 @@ function run() {
|
|||||||
if (change.change_type === 'added' &&
|
if (change.change_type === 'added' &&
|
||||||
change.vulnerabilities !== undefined &&
|
change.vulnerabilities !== undefined &&
|
||||||
change.vulnerabilities.length > 0) {
|
change.vulnerabilities.length > 0) {
|
||||||
for (const vuln of change.vulnerabilities) {
|
printChangeVulnerabilities(change);
|
||||||
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}`);
|
|
||||||
}
|
|
||||||
failed = true;
|
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) {
|
function renderSeverity(severity) {
|
||||||
const color = {
|
const color = {
|
||||||
critical: 'red',
|
critical: 'red',
|
||||||
@@ -201,9 +204,9 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
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 z = __importStar(__nccwpck_require__(3301));
|
||||||
const ChangeSchema = z.object({
|
exports.ChangeSchema = z.object({
|
||||||
change_type: z.enum(['added', 'removed']),
|
change_type: z.enum(['added', 'removed']),
|
||||||
manifest: z.string(),
|
manifest: z.string(),
|
||||||
ecosystem: z.string(),
|
ecosystem: z.string(),
|
||||||
@@ -226,7 +229,7 @@ exports.PullRequestSchema = z.object({
|
|||||||
base: z.object({ sha: z.string() }),
|
base: z.object({ sha: z.string() }),
|
||||||
head: z.object({ sha: z.string() })
|
head: z.object({ sha: z.string() })
|
||||||
});
|
});
|
||||||
exports.ChangesSchema = z.array(ChangeSchema);
|
exports.ChangesSchema = z.array(exports.ChangeSchema);
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
|||||||
+1
-1
File diff suppressed because one or more lines are too long
+4
-4
@@ -1,6 +1,6 @@
|
|||||||
import * as z from 'zod'
|
import * as z from 'zod'
|
||||||
|
|
||||||
const ChangeSchema = z.object({
|
export const ChangeSchema = z.object({
|
||||||
change_type: z.enum(['added', 'removed']),
|
change_type: z.enum(['added', 'removed']),
|
||||||
manifest: z.string(),
|
manifest: z.string(),
|
||||||
ecosystem: z.string(),
|
ecosystem: z.string(),
|
||||||
@@ -23,10 +23,10 @@ const ChangeSchema = z.object({
|
|||||||
|
|
||||||
export const PullRequestSchema = z.object({
|
export const PullRequestSchema = z.object({
|
||||||
number: z.number(),
|
number: z.number(),
|
||||||
base: z.object({sha: z.string()}),
|
base: z.object({ sha: z.string() }),
|
||||||
head: z.object({sha: z.string()})
|
head: z.object({ sha: z.string() })
|
||||||
})
|
})
|
||||||
|
|
||||||
export const ChangesSchema = z.array(ChangeSchema)
|
export const ChangesSchema = z.array(ChangeSchema)
|
||||||
|
export type Change = z.infer<typeof ChangeSchema>
|
||||||
export type Changes = z.infer<typeof ChangesSchema>
|
export type Changes = z.infer<typeof ChangesSchema>
|
||||||
|
|||||||
Reference in New Issue
Block a user