Skip to content

Commit d914b4d

Browse files
ci(links): avoid duplicate broken link reports (#2073)
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
1 parent d24a56e commit d914b4d

1 file changed

Lines changed: 18 additions & 3 deletions

File tree

.github/workflows/links.yml

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,29 @@ jobs:
2828
with:
2929
script: |
3030
const fs = require('fs');
31+
const reportTitle = 'Broken Links Report';
32+
const openIssues = await github.paginate(
33+
github.rest.issues.listForRepo,
34+
{
35+
owner: context.repo.owner,
36+
repo: context.repo.repo,
37+
state: 'open',
38+
per_page: 100
39+
}
40+
);
41+
42+
if (openIssues.some(issue =>
43+
!issue.pull_request && issue.title === reportTitle
44+
)) {
45+
core.info(`An open "${reportTitle}" issue already exists; skipping.`);
46+
return;
47+
}
3148
32-
// Read the markdown file
33-
// Ensure the path is correct relative to the workspace root
3449
const reportBody = fs.readFileSync('./lychee/out.md', 'utf8');
3550
3651
await github.rest.issues.create({
3752
owner: context.repo.owner,
3853
repo: context.repo.repo,
39-
title: 'Broken Links Report',
54+
title: reportTitle,
4055
body: reportBody
4156
});

0 commit comments

Comments
 (0)