Address review comments and improve workflow

- Add workflow documentation explaining selective update strategy
- Improve logging with clear output formatting (no emojis)
- Add GitHub Actions workflow summary with file change details
- Fix command injection vulnerability by validating test paths with regex
- Add error handling for JSON.parse with descriptive messages
- Replace non-null assertion with safer null checking pattern
- Add explicit error handling for TypeScript script execution
This commit is contained in:
bymyself
2025-10-12 16:00:38 -07:00
parent 83ff415815
commit df6723415b
3 changed files with 115 additions and 15 deletions

View File

@@ -28,7 +28,17 @@ async function main() {
}
const raw = await fsp.readFile(reportPath, 'utf8')
const data = JSON.parse(raw)
let data: JSONReport
try {
data = JSON.parse(raw)
} catch (error) {
throw new Error(
`Failed to parse Playwright JSON report at ${reportPath}. ` +
`The report file may be corrupted or incomplete. ` +
`Error: ${error instanceof Error ? error.message : String(error)}`
)
}
const hasScreenshotSignal = (r: JSONReportTestResult) => {
return r.attachments.some((att) => att?.contentType?.startsWith('image/'))
@@ -52,7 +62,10 @@ async function main() {
last && last.status === 'failed' && hasScreenshotSignal(last)
if (!failedScreenshot) continue
if (!out.has(project)) out.set(project, new Set())
out.get(project)!.add(loc)
const projectSet = out.get(project)
if (projectSet) {
projectSet.add(loc)
}
}
}
}