Skip to content

Commit

Permalink
Close previous issues
Browse files Browse the repository at this point in the history
  • Loading branch information
jlvandenhout committed Feb 23, 2024
1 parent bf5ad8a commit 77fae7e
Showing 1 changed file with 26 additions and 2 deletions.
28 changes: 26 additions & 2 deletions .github/workflows/broken-links-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,38 @@ jobs:
if: always() && steps.check-links.outcome == 'failure'
with:
script: |
const title: 'Fix broken links';
const previousIssues = await github.rest.issues.listForRepo({
owner: context.repo.owner,
repo: context.repo.repo,
state: 'open',
creator: context.actor,
});
for (const issue in previousIssues) {
if (issue.title !== title) continue;
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issue.number,
body: 'Closing because of new report available.'
});
await octokit.rest.issues.update({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issue.number,
state: "closed",
});
}
const fs = require('fs');
const input = fs.readFileSync('stderr.txt');
const data = JSON.parse(input);
const urls = data.map(item => item.url);
const output = urls.map(url => `- [ ] ${url}`).join('\n');
github.rest.issues.create({
await github.rest.issues.create({
owner: context.repo.owner,
repo: context.repo.repo,
title: 'Fix broken links',
title,
body: `The following links are possibly broken:\n${output}`,
});

0 comments on commit 77fae7e

Please sign in to comment.