Fix column number implementation

This commit is contained in:
Justin Hutchings
2024-03-08 02:49:15 +00:00
parent 250250e73d
commit 6a74ebd41e
4 changed files with 1026 additions and 16 deletions
Generated Vendored
+992 -6
View File
File diff suppressed because it is too large Load Diff
Generated Vendored
+1 -1
View File
File diff suppressed because one or more lines are too long
Generated Vendored
+19
View File
@@ -1069,6 +1069,25 @@ Apache License
limitations under the License.
graceful-fs
ISC
The ISC License
Copyright (c) 2011-2022 Isaac Z. Schlueter, Ben Noordhuis, and Contributors
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
indent-string
MIT
MIT License
+14 -9
View File
@@ -1,7 +1,7 @@
import * as core from '@actions/core'
import * as dependencyGraph from './dependency-graph'
import * as github from '@actions/github'
import fs from 'fs'
import fs from 'graceful-fs'
import styles from 'ansi-styles'
import {RequestError} from '@octokit/request-error'
import {
@@ -25,6 +25,7 @@ import {getRefs} from './git-refs'
import {groupDependenciesByManifest} from './utils'
import {commentPr} from './comment-pr'
import {getDeniedChanges} from './deny'
import * as path from 'path'
async function delay(ms: number): Promise<void> {
return new Promise(resolve => setTimeout(resolve, ms))
@@ -387,13 +388,14 @@ async function createScorecardWarnings(
endColumn: lineColNumbers.endCol
}
)
} else {
core.warning(
`${dependency.change.ecosystem}/${dependency.change.name} has an OpenSSF Scorecard of ${dependency.scorecard?.score}, which is less than this repository's threshold of ${config.warn_on_openssf_scorecard_level}.`,
{
title: 'OpenSSF Scorecard Warning'
}
)
}
core.warning(
`${dependency.change.ecosystem}/${dependency.change.name} has an OpenSSF Scorecard of ${dependency.scorecard?.score}, which is less than this repository's threshold of ${config.warn_on_openssf_scorecard_level}.`,
{
title: 'OpenSSF Scorecard Warning'
}
)
}
}
}
@@ -403,8 +405,11 @@ async function findLineColNumbers(
manifest: string,
packageName: string
): Promise<{lineNumber: number; startCol: number; endCol: number}> {
// open the file
fs.readFile(manifest, 'utf8', function (err, data) {
// Concatenate the GITHUB_WORKSPACE to the manifest file
const fileName = path.join(process.env.GITHUB_WORKSPACE || '', manifest)
// Open the file
fs.readFile(fileName, 'utf8', function (err, data) {
if (err) {
throw err
}