Add on-failure option to comment-summary-in-pr setting

This commit is contained in:
Sean Murphy
2023-08-04 22:37:51 -04:00
parent 1e70f06e66
commit 902e86c6f5
10 changed files with 21 additions and 15 deletions
+1 -1
View File
@@ -38,7 +38,7 @@ function readInlineConfig(): ConfigurationOptionsPartial {
const vulnerability_check = getOptionalBoolean('vulnerability-check')
const base_ref = getOptionalInput('base-ref')
const head_ref = getOptionalInput('head-ref')
const comment_summary_in_pr = getOptionalBoolean('comment-summary-in-pr')
const comment_summary_in_pr = getOptionalInput('comment-summary-in-pr')
validatePURL(allow_dependencies_licenses)
validateLicenses('allow-licenses', allow_licenses)
+5 -1
View File
@@ -84,7 +84,11 @@ async function run(): Promise<void> {
summary.addScannedDependencies(changes)
printScannedDependencies(changes)
if (config.comment_summary_in_pr) {
if (
config.comment_summary_in_pr === 'always' ||
(config.comment_summary_in_pr === 'on-failure' &&
process.exitCode === core.ExitCode.Failure)
) {
await commentPr(core.summary)
}
} catch (error) {
+1 -1
View File
@@ -47,7 +47,7 @@ export const ConfigurationOptionsSchema = z
config_file: z.string().optional(),
base_ref: z.string().optional(),
head_ref: z.string().optional(),
comment_summary_in_pr: z.boolean().default(false)
comment_summary_in_pr: z.enum(['always', 'never', 'on-failure']).default('never'),
})
.superRefine((config, context) => {
if (config.allow_licenses && config.deny_licenses) {