mirror of
https://github.com/github/codeql-action.git
synced 2026-04-26 16:58:47 +00:00
Move conversion of PR diff-range paths to absolute paths
This commit is contained in:
@@ -191,13 +191,6 @@ function getDiffRanges(
|
||||
fileDiff: FileDiff,
|
||||
logger: Logger,
|
||||
): DiffThunkRange[] | undefined {
|
||||
// Diff-informed queries expect the file path to be absolute. CodeQL always
|
||||
// uses forward slashes as the path separator, so on Windows we need to
|
||||
// replace any backslashes with forward slashes.
|
||||
const filename = path
|
||||
.join(actionsUtil.getRequiredInput("checkout_path"), fileDiff.filename)
|
||||
.replaceAll(path.sep, "/");
|
||||
|
||||
if (fileDiff.patch === undefined) {
|
||||
if (fileDiff.changes === 0) {
|
||||
// There are situations where a changed file legitimately has no diff.
|
||||
@@ -212,7 +205,7 @@ function getDiffRanges(
|
||||
// to a special diff range that covers the entire file.
|
||||
return [
|
||||
{
|
||||
path: filename,
|
||||
path: fileDiff.filename,
|
||||
startLine: 0,
|
||||
endLine: 0,
|
||||
},
|
||||
@@ -247,7 +240,7 @@ function getDiffRanges(
|
||||
// Any line that does not start with a "+" or "-" terminates the current
|
||||
// range of added lines.
|
||||
diffRanges.push({
|
||||
path: filename,
|
||||
path: fileDiff.filename,
|
||||
startLine: additionRangeStartLine,
|
||||
endLine: currentLine - 1,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user