(candidate: LooseRecord)
| 354 | } |
| 355 | |
| 356 | function writeSelfHealJob(candidate: LooseRecord) { |
| 357 | const absolute = path.join(repoRoot(), candidate.job_path); |
| 358 | fs.mkdirSync(path.dirname(absolute), { recursive: true }); |
| 359 | fs.writeFileSync( |
| 360 | absolute, |
| 361 | renderSelfHealJob({ |
| 362 | repo, |
| 363 | issueNumber: candidate.number, |
| 364 | title: candidate.title, |
| 365 | branch: candidate.branch, |
| 366 | headSha: candidate.head_sha, |
| 367 | mergeState: candidate.reason, |
| 368 | runUrl: currentActionsRunUrl(), |
| 369 | }), |
| 370 | "utf8", |
| 371 | ); |
| 372 | const job = parseJob(candidate.job_path); |
| 373 | const errors = validateJob(job); |
| 374 | if (errors.length > 0) throw new Error(`invalid self-heal job ${candidate.job_path}: ${errors}`); |
| 375 | } |
| 376 | |
| 377 | function postSelfHealStatus(candidate: LooseRecord, { status }: { status: string }) { |
| 378 | const body = renderSelfHealStatusComment({ |
no test coverage detected