Skip to content

Commit d84cac6

Browse files
committed
Add debug logging and GitHub Actions log line offset
Add console.log statements to trace warning/error detection (total lines, matched index, matched content, final result). Apply a +3 line offset to firstIssueLine to account for GitHub Actions preamble lines in step logs. https://claude.ai/code/session_01Eph17CQCfdnKaJhA2nSr9W
1 parent 77f90d9 commit d84cac6

File tree

3 files changed

+19
-1
lines changed

3 files changed

+19
-1
lines changed

dist/index.js

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

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/index.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,17 +74,26 @@ for (const file of readdirRecursively(".")) {
7474
let compileResult = "✅success";
7575
let firstIssueLine = 1;
7676
const lines = compilationOutput.split("\n");
77+
console.log(`total lines: ${lines.length}`);
7778
const warningIdx = lines.findIndex((line) => line.match(warningRegex));
79+
console.log(`warningIdx: ${warningIdx}`);
7880
if (warningIdx !== -1) {
7981
compileResult = "⚠️warning";
8082
firstIssueLine = warningIdx + 1;
83+
console.log(`matched warning line: ${lines[warningIdx]}`);
8184
} else {
8285
const errorIdx = lines.findIndex((line) => line.match(errorRegex));
86+
console.log(`errorIdx: ${errorIdx}`);
8387
if (errorIdx !== -1) {
8488
compileResult = "❌error";
8589
firstIssueLine = errorIdx + 1;
90+
console.log(`matched error line: ${lines[errorIdx]}`);
8691
}
8792
}
93+
// GitHub Actions step logs have a few preamble lines before the actual output
94+
const GITHUB_ACTIONS_LOG_OFFSET = 3;
95+
firstIssueLine += GITHUB_ACTIONS_LOG_OFFSET;
96+
console.log(`compileResult: ${compileResult}, firstIssueLine: ${firstIssueLine} (includes offset ${GITHUB_ACTIONS_LOG_OFFSET})`);
8897

8998
const { data: job } = await octokit.rest.actions.getJobForWorkflowRun({
9099
owner,

0 commit comments

Comments
 (0)