Remove dead code, complete printScorecardBlock
This commit is contained in:
10
src/main.ts
10
src/main.ts
@@ -150,8 +150,6 @@ async function run(): Promise<void> {
|
||||
summary.addDeniedToSummary(deniedChanges)
|
||||
printDeniedDependencies(deniedChanges, config)
|
||||
}
|
||||
core.debug('Adding scorecard to summary')
|
||||
core.debug(`Config: ${config.show_openssf_scorecard}`)
|
||||
if (config.show_openssf_scorecard) {
|
||||
const scorecard = await getScorecardLevels(filteredChanges)
|
||||
summary.addScorecardToSummary(scorecard, config)
|
||||
@@ -281,6 +279,14 @@ function printScorecardBlock(
|
||||
core.group('Scorecard', async () => {
|
||||
if (scorecard) {
|
||||
for (const dependency of scorecard.dependencies) {
|
||||
if (
|
||||
dependency.scorecard?.score &&
|
||||
dependency.scorecard?.score < config.warn_on_openssf_scorecard_level
|
||||
) {
|
||||
core.info(
|
||||
`${styles.color.red}${dependency.change.ecosystem}/${dependency.change.name}: OpenSSF Scorecard Score: ${dependency?.scorecard?.score}${styles.red.close}`
|
||||
)
|
||||
}
|
||||
core.info(
|
||||
`${dependency.change.ecosystem}/${dependency.change.name}: OpenSSF Scorecard Score: ${dependency?.scorecard?.score}`
|
||||
)
|
||||
|
||||
@@ -133,58 +133,6 @@ export const ScorecardApiSchema = z.object({
|
||||
score: z.number().nullish()
|
||||
})
|
||||
|
||||
export const DepsDevProjectSchema = z
|
||||
.object({
|
||||
projectKey: z.object({
|
||||
id: z.string({})
|
||||
}),
|
||||
openIssuesCount: z.string().nullish(),
|
||||
starsCount: z.string().nullish(),
|
||||
forksCount: z.string().nullish(),
|
||||
license: z.string().nullish(),
|
||||
description: z.string().nullish(),
|
||||
homepage: z.string().nullish(),
|
||||
scorecard: z.object({
|
||||
date: z.string(),
|
||||
repository: z
|
||||
.object({
|
||||
name: z.string(),
|
||||
commit: z.string()
|
||||
})
|
||||
.nullish(),
|
||||
scorecard: z
|
||||
.object({
|
||||
version: z.string(),
|
||||
commit: z.string()
|
||||
})
|
||||
.nullish(),
|
||||
checks: z
|
||||
.array(
|
||||
z.object({
|
||||
name: z.string(),
|
||||
documentation: z.object({
|
||||
shortDescription: z.string(),
|
||||
url: z.string()
|
||||
}),
|
||||
score: z.string(),
|
||||
reason: z.string(),
|
||||
details: z.array(z.string())
|
||||
})
|
||||
)
|
||||
.nullish(),
|
||||
overallScore: z.number().nullish()
|
||||
}),
|
||||
ossFuzz: z
|
||||
.object({
|
||||
lineCount: z.string(),
|
||||
lineCoverCount: z.string(),
|
||||
date: z.string(),
|
||||
configUrl: z.string()
|
||||
})
|
||||
.nullish()
|
||||
})
|
||||
.nullish()
|
||||
|
||||
export const ScorecardSchema = z.object({
|
||||
dependencies: z.array(
|
||||
z.object({
|
||||
@@ -200,6 +148,5 @@ export type ComparisonResponse = z.infer<typeof ComparisonResponseSchema>
|
||||
export type ConfigurationOptions = z.infer<typeof ConfigurationOptionsSchema>
|
||||
export type Severity = z.infer<typeof SeveritySchema>
|
||||
export type Scope = (typeof SCOPES)[number]
|
||||
export type DepsDevProject = z.infer<typeof DepsDevProjectSchema>
|
||||
export type Scorecard = z.infer<typeof ScorecardSchema>
|
||||
export type ScorecardApi = z.infer<typeof ScorecardApiSchema>
|
||||
|
||||
@@ -1,12 +1,4 @@
|
||||
import {
|
||||
Change,
|
||||
DepsDevProject,
|
||||
DepsDevProjectSchema,
|
||||
Scorecard,
|
||||
ScorecardApi
|
||||
} from './schemas'
|
||||
import {isSPDXValid, octokitClient} from './utils'
|
||||
import {PackageURL} from 'packageurl-js'
|
||||
import {Change, Scorecard, ScorecardApi} from './schemas'
|
||||
import * as core from '@actions/core'
|
||||
|
||||
export async function getScorecardLevels(
|
||||
@@ -44,8 +36,8 @@ export async function getScorecardLevels(
|
||||
) {
|
||||
try {
|
||||
scorecardApi = await getScorecard(repositoryUrl)
|
||||
} catch (error: any) {
|
||||
core.debug(`Error querying for scorecard: ${error.message}`)
|
||||
} catch (error: unknown) {
|
||||
core.debug(`Error querying for scorecard: ${(error as Error).message}`)
|
||||
}
|
||||
}
|
||||
data.dependencies.push({
|
||||
|
||||
Reference in New Issue
Block a user