Skip to content

Commit 0fc9e98

Browse files
committed
fix: gracefully handle corrupt pr-diff-range.json instead of aborting
1 parent 35dd583 commit 0fc9e98

11 files changed

+150
-35
lines changed

lib/analyze-action-post.js

Lines changed: 11 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/analyze-action.js

Lines changed: 19 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/autobuild-action.js

Lines changed: 11 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/init-action-post.js

Lines changed: 19 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/init-action.js

Lines changed: 11 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/resolve-environment-action.js

Lines changed: 11 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/setup-codeql-action.js

Lines changed: 11 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/upload-lib.js

Lines changed: 19 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/upload-sarif-action.js

Lines changed: 19 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/diff-informed-analysis-utils.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,14 @@ export function readDiffRangesJsonFile(
105105
logger.debug(
106106
`Read pr-diff-range JSON file from ${jsonFilePath}:\n${jsonContents}`,
107107
);
108-
return JSON.parse(jsonContents) as DiffThunkRange[];
108+
try {
109+
return JSON.parse(jsonContents) as DiffThunkRange[];
110+
} catch (e) {
111+
logger.warning(
112+
`Failed to parse diff ranges JSON file at ${jsonFilePath}: ${e}`,
113+
);
114+
return undefined;
115+
}
109116
}
110117

111118
/**

0 commit comments

Comments
 (0)