inline config options
This commit is contained in:
+17
@@ -44993,6 +44993,7 @@ function readInlineConfig() {
|
|||||||
const base_ref = getOptionalInput('base-ref');
|
const base_ref = getOptionalInput('base-ref');
|
||||||
const head_ref = getOptionalInput('head-ref');
|
const head_ref = getOptionalInput('head-ref');
|
||||||
const comment_summary_in_pr = getOptionalBoolean('comment-summary-in-pr');
|
const comment_summary_in_pr = getOptionalBoolean('comment-summary-in-pr');
|
||||||
|
const allow_dependencies_licenses = parseRecord(getOptionalRecord('allow-dependencies-licenses'));
|
||||||
validateLicenses('allow-licenses', allow_licenses);
|
validateLicenses('allow-licenses', allow_licenses);
|
||||||
validateLicenses('deny-licenses', deny_licenses);
|
validateLicenses('deny-licenses', deny_licenses);
|
||||||
const keys = {
|
const keys = {
|
||||||
@@ -45000,6 +45001,7 @@ function readInlineConfig() {
|
|||||||
fail_on_scopes,
|
fail_on_scopes,
|
||||||
allow_licenses,
|
allow_licenses,
|
||||||
deny_licenses,
|
deny_licenses,
|
||||||
|
allow_dependencies_licenses,
|
||||||
allow_ghsas,
|
allow_ghsas,
|
||||||
license_check,
|
license_check,
|
||||||
vulnerability_check,
|
vulnerability_check,
|
||||||
@@ -45017,6 +45019,21 @@ function getOptionalInput(name) {
|
|||||||
const value = core.getInput(name);
|
const value = core.getInput(name);
|
||||||
return value.length > 0 ? value : undefined;
|
return value.length > 0 ? value : undefined;
|
||||||
}
|
}
|
||||||
|
function getOptionalRecord(records) {
|
||||||
|
const value = core.getInput(records);
|
||||||
|
return value.length > 0 ? yaml_1.default.parse(value) : undefined;
|
||||||
|
}
|
||||||
|
function parseRecord(records) {
|
||||||
|
if (records === undefined) {
|
||||||
|
return records;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return Object.fromEntries(Object.entries(records).map(([key, value]) => [
|
||||||
|
key,
|
||||||
|
value.map(x => x.trim())
|
||||||
|
]));
|
||||||
|
}
|
||||||
|
}
|
||||||
function parseList(list) {
|
function parseList(list) {
|
||||||
if (list === undefined) {
|
if (list === undefined) {
|
||||||
return list;
|
return list;
|
||||||
|
|||||||
+1
-1
File diff suppressed because one or more lines are too long
@@ -35,6 +35,9 @@ function readInlineConfig(): ConfigurationOptionsPartial {
|
|||||||
const base_ref = getOptionalInput('base-ref')
|
const base_ref = getOptionalInput('base-ref')
|
||||||
const head_ref = getOptionalInput('head-ref')
|
const head_ref = getOptionalInput('head-ref')
|
||||||
const comment_summary_in_pr = getOptionalBoolean('comment-summary-in-pr')
|
const comment_summary_in_pr = getOptionalBoolean('comment-summary-in-pr')
|
||||||
|
const allow_dependencies_licenses = parseRecord(
|
||||||
|
getOptionalRecord('allow-dependencies-licenses')
|
||||||
|
)
|
||||||
|
|
||||||
validateLicenses('allow-licenses', allow_licenses)
|
validateLicenses('allow-licenses', allow_licenses)
|
||||||
validateLicenses('deny-licenses', deny_licenses)
|
validateLicenses('deny-licenses', deny_licenses)
|
||||||
@@ -44,6 +47,7 @@ function readInlineConfig(): ConfigurationOptionsPartial {
|
|||||||
fail_on_scopes,
|
fail_on_scopes,
|
||||||
allow_licenses,
|
allow_licenses,
|
||||||
deny_licenses,
|
deny_licenses,
|
||||||
|
allow_dependencies_licenses,
|
||||||
allow_ghsas,
|
allow_ghsas,
|
||||||
license_check,
|
license_check,
|
||||||
vulnerability_check,
|
vulnerability_check,
|
||||||
@@ -67,6 +71,28 @@ function getOptionalInput(name: string): string | undefined {
|
|||||||
return value.length > 0 ? value : undefined
|
return value.length > 0 ? value : undefined
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getOptionalRecord(
|
||||||
|
records: string
|
||||||
|
): Record<string, string[]> | undefined {
|
||||||
|
const value = core.getInput(records)
|
||||||
|
return value.length > 0 ? YAML.parse(value) : undefined
|
||||||
|
}
|
||||||
|
|
||||||
|
function parseRecord(
|
||||||
|
records: Record<string, string[]> | undefined
|
||||||
|
): Record<string, string[]> | undefined {
|
||||||
|
if (records === undefined) {
|
||||||
|
return records
|
||||||
|
} else {
|
||||||
|
return Object.fromEntries(
|
||||||
|
Object.entries(records).map(([key, value]) => [
|
||||||
|
key,
|
||||||
|
value.map(x => x.trim())
|
||||||
|
])
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function parseList(list: string | undefined): string[] | undefined {
|
function parseList(list: string | undefined): string[] | undefined {
|
||||||
if (list === undefined) {
|
if (list === undefined) {
|
||||||
return list
|
return list
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import spdxSatisfies from 'spdx-satisfies'
|
import spdxSatisfies from 'spdx-satisfies'
|
||||||
import {Change, Changes} from './schemas'
|
import {Change, Changes} from './schemas'
|
||||||
import {isSPDXValid, octokitClient, isDefined} from './utils'
|
import {isSPDXValid, octokitClient, isDefined} from './utils'
|
||||||
import * as core from '@actions/core'
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Loops through a list of changes, filtering and returning the
|
* Loops through a list of changes, filtering and returning the
|
||||||
|
|||||||
Reference in New Issue
Block a user