From e0f80ff5aef66775dcbdebe9c15d0c2b156e0a1b Mon Sep 17 00:00:00 2001 From: Krishna Dutt Panchagnula Date: Sat, 21 Jun 2025 12:11:35 +0530 Subject: [PATCH 1/8] added script and pipline for scheduled link rot checker Signed-off-by: krishnaduttPanchagnula --- .github/workflows/lin-rot-checker.yml | 20 ++++++++++++++++++++ hack/lin-rot-checker.py | 27 +++++++++++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 .github/workflows/lin-rot-checker.yml create mode 100644 hack/lin-rot-checker.py diff --git a/.github/workflows/lin-rot-checker.yml b/.github/workflows/lin-rot-checker.yml new file mode 100644 index 00000000000..e7ccfacd4eb --- /dev/null +++ b/.github/workflows/lin-rot-checker.yml @@ -0,0 +1,20 @@ +name: Link rot Checker Scheduled Job + +on: + schedule: + - cron: '0 8 * * *' + +jobs: + run-python: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.11' + + - name: Execute Python script + run: python your_script.py diff --git a/hack/lin-rot-checker.py b/hack/lin-rot-checker.py new file mode 100644 index 00000000000..494f3fbd839 --- /dev/null +++ b/hack/lin-rot-checker.py @@ -0,0 +1,27 @@ +import re +import glob +import requests + +# Regex pattern to extract URLs from markdown links [text](url) +pattern = re.compile(r'\[.*?\]\((.*?)\)') + +links = [] + +# Iterate over all .md files in all directories inclusing childern +for filename in glob.glob("**/*.md",recursive=True): + with open(filename, 'r', encoding='utf-8') as f: + print(f"Processing file: {filename}") + content = f.read() + found_links = pattern.findall(content) + links.extend(found_links) + +print(f"Extracted links:{links}") + +for link in links: + try: + if requests.head(link).status_code==200: + print(f'{link} link is valid') + else: + print (f'{link} is not valid') + except requests.exceptions.RequestException as e: + print("The link has exceeded the dns resolution limit and failed") \ No newline at end of file From 88c29bb1966076161bd2f47d3b2d974a6622fe02 Mon Sep 17 00:00:00 2001 From: Krishna Dutt Panchagnula Date: Thu, 26 Jun 2025 18:39:28 +0530 Subject: [PATCH 2/8] Updated the pipeline to use lychee action Signed-off-by: krishnaduttPanchagnula --- .github/workflows/lin-rot-checker.yml | 20 ------------------ .github/workflows/link-rot-checker.yml | 29 ++++++++++++++++++++++++++ hack/lin-rot-checker.py | 27 ------------------------ 3 files changed, 29 insertions(+), 47 deletions(-) delete mode 100644 .github/workflows/lin-rot-checker.yml create mode 100644 .github/workflows/link-rot-checker.yml delete mode 100644 hack/lin-rot-checker.py diff --git a/.github/workflows/lin-rot-checker.yml b/.github/workflows/lin-rot-checker.yml deleted file mode 100644 index e7ccfacd4eb..00000000000 --- a/.github/workflows/lin-rot-checker.yml +++ /dev/null @@ -1,20 +0,0 @@ -name: Link rot Checker Scheduled Job - -on: - schedule: - - cron: '0 8 * * *' - -jobs: - run-python: - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: '3.11' - - - name: Execute Python script - run: python your_script.py diff --git a/.github/workflows/link-rot-checker.yml b/.github/workflows/link-rot-checker.yml new file mode 100644 index 00000000000..6d76be446d1 --- /dev/null +++ b/.github/workflows/link-rot-checker.yml @@ -0,0 +1,29 @@ +name: Link-rot-Checker + +on: + repository_dispatch: + workflow_dispatch: + schedule: + - cron: "00 18 * * *" + +jobs: + linkChecker: + runs-on: ubuntu-latest + permissions: + issues: write + steps: + - uses: actions/checkout@v4 + + - name: Link Checker + id: lychee + uses: lycheeverse/lychee-action@v2 + with: + fail: false + + - name: Create Issue From File + if: steps.lychee.outputs.exit_code != 0 + uses: peter-evans/create-issue-from-file@v5 + with: + title: Link Checker Report + content-filepath: ./lychee/out.md + labels: report, automated issue \ No newline at end of file diff --git a/hack/lin-rot-checker.py b/hack/lin-rot-checker.py deleted file mode 100644 index 494f3fbd839..00000000000 --- a/hack/lin-rot-checker.py +++ /dev/null @@ -1,27 +0,0 @@ -import re -import glob -import requests - -# Regex pattern to extract URLs from markdown links [text](url) -pattern = re.compile(r'\[.*?\]\((.*?)\)') - -links = [] - -# Iterate over all .md files in all directories inclusing childern -for filename in glob.glob("**/*.md",recursive=True): - with open(filename, 'r', encoding='utf-8') as f: - print(f"Processing file: {filename}") - content = f.read() - found_links = pattern.findall(content) - links.extend(found_links) - -print(f"Extracted links:{links}") - -for link in links: - try: - if requests.head(link).status_code==200: - print(f'{link} link is valid') - else: - print (f'{link} is not valid') - except requests.exceptions.RequestException as e: - print("The link has exceeded the dns resolution limit and failed") \ No newline at end of file From d8a0d0624fc0edf7a27ac35fe3f4602fdfce2ee4 Mon Sep 17 00:00:00 2001 From: krishnaduttPanchagnula Date: Thu, 26 Jun 2025 21:13:08 +0530 Subject: [PATCH 3/8] made Yamllint changes Signed-off-by: krishnaduttPanchagnula --- .github/workflows/link-rot-checker.yml | 54 ++++++++++++-------------- 1 file changed, 25 insertions(+), 29 deletions(-) diff --git a/.github/workflows/link-rot-checker.yml b/.github/workflows/link-rot-checker.yml index 6d76be446d1..f014a707400 100644 --- a/.github/workflows/link-rot-checker.yml +++ b/.github/workflows/link-rot-checker.yml @@ -1,29 +1,25 @@ -name: Link-rot-Checker - -on: - repository_dispatch: - workflow_dispatch: - schedule: - - cron: "00 18 * * *" - -jobs: - linkChecker: - runs-on: ubuntu-latest - permissions: - issues: write - steps: - - uses: actions/checkout@v4 - - - name: Link Checker - id: lychee - uses: lycheeverse/lychee-action@v2 - with: - fail: false - - - name: Create Issue From File - if: steps.lychee.outputs.exit_code != 0 - uses: peter-evans/create-issue-from-file@v5 - with: - title: Link Checker Report - content-filepath: ./lychee/out.md - labels: report, automated issue \ No newline at end of file +name: Link-rot-Checker +on: + repository_dispatch: + workflow_dispatch: + schedule: + - cron: "00 18 * * *" +jobs: + linkChecker: + runs-on: ubuntu-latest + permissions: + issues: write + steps: + - uses: actions/checkout@v4 + - name: Link Checker + id: lychee + uses: lycheeverse/lychee-action@v2 + with: + fail: false + - name: Create Issue From File + if: steps.lychee.outputs.exit_code != 0 + uses: peter-evans/create-issue-from-file@v5 + with: + title: Link Checker Report + content-filepath: ./lychee/out.md + labels: report, automated issue From e3d1c85d8a28456d21f5aaf684eb4e305ea5e8b2 Mon Sep 17 00:00:00 2001 From: krishnaduttPanchagnula Date: Fri, 27 Jun 2025 10:17:37 +0530 Subject: [PATCH 4/8] made pipeline changes to improve readibility Signed-off-by: krishnaduttPanchagnula --- ...nk-rot-checker.yml => automatedLinkHealthCheck.yml} | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) rename .github/workflows/{link-rot-checker.yml => automatedLinkHealthCheck.yml} (61%) diff --git a/.github/workflows/link-rot-checker.yml b/.github/workflows/automatedLinkHealthCheck.yml similarity index 61% rename from .github/workflows/link-rot-checker.yml rename to .github/workflows/automatedLinkHealthCheck.yml index f014a707400..fc67230abed 100644 --- a/.github/workflows/link-rot-checker.yml +++ b/.github/workflows/automatedLinkHealthCheck.yml @@ -1,21 +1,21 @@ -name: Link-rot-Checker +name: Automated Link Health Check on: - repository_dispatch: workflow_dispatch: schedule: - - cron: "00 18 * * *" + - cron: "00 18 * * *" #Runs the cron at 1800 hrs UTC Everyday jobs: linkChecker: runs-on: ubuntu-latest permissions: issues: write steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #v4.2.2 - name: Link Checker id: lychee - uses: lycheeverse/lychee-action@v2 + uses: lycheeverse/lychee-action@82202e5e9c2f4ef1a55a3d02563e1cb6041e5332 with: fail: false + output: ./lychee/out.md - name: Create Issue From File if: steps.lychee.outputs.exit_code != 0 uses: peter-evans/create-issue-from-file@v5 From 5f59c10f3243533044328aefb4f7c2c10dab1dea Mon Sep 17 00:00:00 2001 From: krishnaduttPanchagnula Date: Fri, 27 Jun 2025 13:09:52 +0530 Subject: [PATCH 5/8] made pipeline changes to improve readibility Signed-off-by: krishnaduttPanchagnula --- .github/workflows/{automatedLinkHealthCheck.yml => links.yml} | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename .github/workflows/{automatedLinkHealthCheck.yml => links.yml} (85%) diff --git a/.github/workflows/automatedLinkHealthCheck.yml b/.github/workflows/links.yml similarity index 85% rename from .github/workflows/automatedLinkHealthCheck.yml rename to .github/workflows/links.yml index fc67230abed..fca12ec6e06 100644 --- a/.github/workflows/automatedLinkHealthCheck.yml +++ b/.github/workflows/links.yml @@ -12,13 +12,13 @@ jobs: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #v4.2.2 - name: Link Checker id: lychee - uses: lycheeverse/lychee-action@82202e5e9c2f4ef1a55a3d02563e1cb6041e5332 + uses: lycheeverse/lychee-action@82202e5e9c2f4ef1a55a3d02563e1cb6041e5332i #v0.19.1 with: fail: false output: ./lychee/out.md - name: Create Issue From File if: steps.lychee.outputs.exit_code != 0 - uses: peter-evans/create-issue-from-file@v5 + uses: peter-evans/create-issue-from-file@e8ef132d6df98ed982188e460ebb3b5d4ef3a9cd #v5.0.1 with: title: Link Checker Report content-filepath: ./lychee/out.md From 00623a23ec96d2c0a691acb6a20fea1a7de262dc Mon Sep 17 00:00:00 2001 From: krishnaduttPanchagnula Date: Tue, 1 Jul 2025 14:58:16 +0530 Subject: [PATCH 6/8] fixed the lychee version hash Signed-off-by: krishnaduttPanchagnula --- .github/workflows/links.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/links.yml b/.github/workflows/links.yml index fca12ec6e06..2de33635521 100644 --- a/.github/workflows/links.yml +++ b/.github/workflows/links.yml @@ -12,7 +12,7 @@ jobs: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #v4.2.2 - name: Link Checker id: lychee - uses: lycheeverse/lychee-action@82202e5e9c2f4ef1a55a3d02563e1cb6041e5332i #v0.19.1 + uses: lycheeverse/lychee-action@82202e5e9c2f4ef1a55a3d02563e1cb6041e5332 # v2.4.1 with: fail: false output: ./lychee/out.md From d3d44034f90290914948ef800850f13773a9932c Mon Sep 17 00:00:00 2001 From: krishnaduttPanchagnula Date: Tue, 1 Jul 2025 16:31:00 +0530 Subject: [PATCH 7/8] White space fixed Signed-off-by: krishnaduttPanchagnula --- .github/workflows/links.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/links.yml b/.github/workflows/links.yml index 2de33635521..819f6e8e2de 100644 --- a/.github/workflows/links.yml +++ b/.github/workflows/links.yml @@ -9,7 +9,7 @@ jobs: permissions: issues: write steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #v4.2.2 + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: Link Checker id: lychee uses: lycheeverse/lychee-action@82202e5e9c2f4ef1a55a3d02563e1cb6041e5332 # v2.4.1 From 4b69a32b857b44d7eb80a11d61c2d2c2ae5768f4 Mon Sep 17 00:00:00 2001 From: krishnaduttPanchagnula Date: Tue, 1 Jul 2025 16:35:52 +0530 Subject: [PATCH 8/8] White space fixed Signed-off-by: krishnaduttPanchagnula --- .github/workflows/links.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/links.yml b/.github/workflows/links.yml index 819f6e8e2de..82a4d1b72f8 100644 --- a/.github/workflows/links.yml +++ b/.github/workflows/links.yml @@ -2,7 +2,7 @@ name: Automated Link Health Check on: workflow_dispatch: schedule: - - cron: "00 18 * * *" #Runs the cron at 1800 hrs UTC Everyday + - cron: "00 18 * * *" # Runs the cron at 1800 hrs UTC Everyday jobs: linkChecker: runs-on: ubuntu-latest @@ -18,7 +18,7 @@ jobs: output: ./lychee/out.md - name: Create Issue From File if: steps.lychee.outputs.exit_code != 0 - uses: peter-evans/create-issue-from-file@e8ef132d6df98ed982188e460ebb3b5d4ef3a9cd #v5.0.1 + uses: peter-evans/create-issue-from-file@e8ef132d6df98ed982188e460ebb3b5d4ef3a9cd # v5.0.1 with: title: Link Checker Report content-filepath: ./lychee/out.md