@@ -29,15 +29,20 @@ jobs:
2929
3030 - name : Validate URLs
3131 id : validate
32- run : npm run test:urls
32+ run : npm run test:urls 2>&1 | tee url-validation.log
3333 continue-on-error : true
34+ env :
35+ NO_COLOR : ' 1'
3436
3537 - name : Create issue if URLs are broken
3638 if : steps.validate.outcome == 'failure'
3739 uses : actions/github-script@v8
3840 with :
3941 script : |
42+ const fs = require('node:fs');
4043 const title = '🔗 Broken URLs detected in manifests';
44+ const output = fs.readFileSync('url-validation.log', 'utf8');
45+ const excerpt = output.slice(-6000);
4146 const body = `## Scheduled URL Validation Failed
4247
4348 The weekly URL validation check has detected broken or inaccessible URLs in the manifest files.
4954 - Update or remove broken URLs
5055 - Consider if these tools/services have been discontinued
5156
52- ### Affected Files
53- Check the workflow logs for specific files and URLs that failed validation.
57+ ### Validation Output
58+ \`\`\`text
59+ ${excerpt}
60+ \`\`\`
5461
5562 ---
5663 *This issue was automatically created by the scheduled URL validation workflow.*`;
8087 });
8188 }
8289
90+ - name : Close resolved URL validation issues
91+ if : steps.validate.outcome == 'success'
92+ uses : actions/github-script@v8
93+ with :
94+ script : |
95+ const issues = await github.paginate(github.rest.issues.listForRepo, {
96+ owner: context.repo.owner,
97+ repo: context.repo.repo,
98+ state: 'open',
99+ labels: 'automated,url-validation',
100+ per_page: 100
101+ });
102+
103+ for (const issue of issues) {
104+ await github.rest.issues.createComment({
105+ owner: context.repo.owner,
106+ repo: context.repo.repo,
107+ issue_number: issue.number,
108+ body: `URL validation passed in ${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}. Closing this automated maintenance issue.`
109+ });
110+ await github.rest.issues.update({
111+ owner: context.repo.owner,
112+ repo: context.repo.repo,
113+ issue_number: issue.number,
114+ state: 'closed',
115+ state_reason: 'completed'
116+ });
117+ }
118+
83119 - name : Fail workflow after reporting broken URLs
84120 if : steps.validate.outcome == 'failure'
85121 run : exit 1
0 commit comments