Skip to content

Commit d74bcb7

Browse files
committed
refactor: centralize broken-markdown-links and automated labels (#2130)
Signed-off-by: Ajay Rajera <newajay.11r@gmail.com>
1 parent 93a8f44 commit d74bcb7

2 files changed

Lines changed: 15 additions & 1 deletion

File tree

.github/scripts/labels.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/**
2+
* Central location for label definitions to facilitate future changes.
3+
* This file serves as the single source of truth for all GitHub label names used by automated workflows.
4+
*/
5+
module.exports = {
6+
LABEL_BROKEN_MARKDOWN_LINKS: 'notes: broken markdown links',
7+
LABEL_AUTOMATED: 'notes: automated'
8+
};

.github/workflows/cron-pr-check-broken-links.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
name: Cron – Check Broken Markdown Links
22

3+
concurrency:
4+
group: cron-check-broken-markdown-links
5+
cancel-in-progress: false
6+
37
on:
48
schedule:
59
- cron: "0 0 1 * *"
@@ -42,12 +46,14 @@ jobs:
4246
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
4347
with:
4448
script: |
49+
const { LABEL_BROKEN_MARKDOWN_LINKS, LABEL_AUTOMATED } = require('./.github/scripts/labels.js');
50+
4551
// Determine if this is a dry run
4652
const isManual = context.eventName === 'workflow_dispatch';
4753
const dryRun = isManual ? String(context.payload.inputs.dry_run).toLowerCase() === 'true' : false;
4854
4955
// Labels configuration
50-
const targetLabels = ['broken-markdown-links', 'automated'];
56+
const targetLabels = [LABEL_BROKEN_MARKDOWN_LINKS, LABEL_AUTOMATED];
5157
const issueTitle = "Scheduled Markdown Link Check Found Broken Links";
5258
const runUrl = `${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`;
5359

0 commit comments

Comments
 (0)