Skip to content

Commit

Permalink
Update to only open a new issue of no previous issues exist
Browse files Browse the repository at this point in the history
  • Loading branch information
jlvandenhout committed Feb 23, 2024
1 parent 77fae7e commit 56221d2
Showing 1 changed file with 13 additions and 22 deletions.
35 changes: 13 additions & 22 deletions .github/workflows/broken-links-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,37 +28,28 @@ jobs:
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.'
});
const previousIssueExists = previousIssues.some((issue) => {
issue.title === title;
})
await octokit.rest.issues.update({
if !previousIssueExists {
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');
await github.rest.issues.create({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issue.number,
state: "closed",
title,
body: `The following links are possibly broken:\n${output}`,
});
}
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');
await github.rest.issues.create({
owner: context.repo.owner,
repo: context.repo.repo,
title,
body: `The following links are possibly broken:\n${output}`,
});

0 comments on commit 56221d2

Please sign in to comment.