From 1358598de51c470f42873a24c8dfe049d479b874 Mon Sep 17 00:00:00 2001 From: Vamshi-Microsoft Date: Mon, 26 May 2025 14:02:22 +0530 Subject: [PATCH 01/57] Create lychee-links.yml --- .github/workflows/lychee-links.yml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 .github/workflows/lychee-links.yml diff --git a/.github/workflows/lychee-links.yml b/.github/workflows/lychee-links.yml new file mode 100644 index 000000000..fc148b3e6 --- /dev/null +++ b/.github/workflows/lychee-links.yml @@ -0,0 +1,20 @@ +name: Check for Broken Links + +on: + pull_request: + workflow_dispatch: + +jobs: + lychee: + name: Broken Link Checker + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Run Lychee link checker + uses: lycheeverse/lychee-action@v2.4.1 + with: + args: "--verbose --exclude-mail --no-progress '**/*.md'" + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 0f6209a65c3eda5c2319da0673462ba7afaa9d86 Mon Sep 17 00:00:00 2001 From: Vamshi-Microsoft Date: Mon, 26 May 2025 14:44:19 +0530 Subject: [PATCH 02/57] Update lychee-links.yml --- .github/workflows/lychee-links.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/lychee-links.yml b/.github/workflows/lychee-links.yml index fc148b3e6..7163b2420 100644 --- a/.github/workflows/lychee-links.yml +++ b/.github/workflows/lychee-links.yml @@ -15,6 +15,11 @@ jobs: - name: Run Lychee link checker uses: lycheeverse/lychee-action@v2.4.1 with: - args: "--verbose --exclude-mail --no-progress '**/*.md'" + args: > + --verbose + --exclude-mail + --no-progress + --exclude ^https?:// + '**/*.md' env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From f28ccf35993abebad03d2de08a9d6ed7cc0b95ef Mon Sep 17 00:00:00 2001 From: Vamshi-Microsoft Date: Mon, 26 May 2025 15:15:40 +0530 Subject: [PATCH 03/57] Check Broken links in Markdown files that are changed in the current PR --- .github/workflows/lychee-links.yml | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/.github/workflows/lychee-links.yml b/.github/workflows/lychee-links.yml index 7163b2420..2cc647525 100644 --- a/.github/workflows/lychee-links.yml +++ b/.github/workflows/lychee-links.yml @@ -1,18 +1,28 @@ -name: Check for Broken Links +name: Check Broken links in PR on: pull_request: - workflow_dispatch: jobs: lychee: - name: Broken Link Checker runs-on: ubuntu-latest + steps: - - name: Checkout code + - name: Checkout PR code uses: actions/checkout@v4 - - name: Run Lychee link checker + - name: Get changed Markdown files + id: changed-files + run: | + echo "Fetching changed markdown files..." + files=$(git diff --name-only ${{ github.event.before }} ${{ github.sha }} | grep '\.md$' || true) + echo "Changed Markdown files: $files" + echo "md_files<> $GITHUB_OUTPUT + echo "$files" >> $GITHUB_OUTPUT + echo "EOF" >> $GITHUB_OUTPUT + + - name: Run Lychee only on internal links in changed .md files + if: steps.changed-files.outputs.md_files != '' uses: lycheeverse/lychee-action@v2.4.1 with: args: > @@ -20,6 +30,6 @@ jobs: --exclude-mail --no-progress --exclude ^https?:// - '**/*.md' + ${{ steps.changed-files.outputs.md_files }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 9169fb92e8041efdf561f3c25545b350840953c3 Mon Sep 17 00:00:00 2001 From: Vamshi-Microsoft Date: Mon, 26 May 2025 15:27:43 +0530 Subject: [PATCH 04/57] Updated catching new md files --- .github/workflows/lychee-links.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/lychee-links.yml b/.github/workflows/lychee-links.yml index 2cc647525..7b188bb49 100644 --- a/.github/workflows/lychee-links.yml +++ b/.github/workflows/lychee-links.yml @@ -8,20 +8,21 @@ jobs: runs-on: ubuntu-latest steps: - - name: Checkout PR code + - name: Checkout code uses: actions/checkout@v4 + with: + fetch-depth: 0 # important to allow full diff - name: Get changed Markdown files id: changed-files run: | - echo "Fetching changed markdown files..." - files=$(git diff --name-only ${{ github.event.before }} ${{ github.sha }} | grep '\.md$' || true) - echo "Changed Markdown files: $files" + git fetch origin main + files=$(git diff --name-only origin/main...HEAD | grep '\.md$' || true) echo "md_files<> $GITHUB_OUTPUT echo "$files" >> $GITHUB_OUTPUT echo "EOF" >> $GITHUB_OUTPUT - - name: Run Lychee only on internal links in changed .md files + - name: Run Lychee on changed Markdown files (internal links only) if: steps.changed-files.outputs.md_files != '' uses: lycheeverse/lychee-action@v2.4.1 with: From 39215ab4cad963959be788b0849399739055d58d Mon Sep 17 00:00:00 2001 From: Vamshi-Microsoft Date: Fri, 6 Jun 2025 14:43:32 +0530 Subject: [PATCH 05/57] trigger only when .md files are changed in a PR --- .github/workflows/lychee-links.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/lychee-links.yml b/.github/workflows/lychee-links.yml index 7b188bb49..027d9fea6 100644 --- a/.github/workflows/lychee-links.yml +++ b/.github/workflows/lychee-links.yml @@ -2,6 +2,8 @@ name: Check Broken links in PR on: pull_request: + paths: + - '**/*.md' jobs: lychee: From 6b7fc08efa97b207487e91f39d02d29ea046dba2 Mon Sep 17 00:00:00 2001 From: Vamshi-Microsoft Date: Mon, 9 Jun 2025 13:48:07 +0530 Subject: [PATCH 06/57] PRs targeting any branch --- .github/workflows/lychee-links.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/lychee-links.yml b/.github/workflows/lychee-links.yml index 027d9fea6..bf7841339 100644 --- a/.github/workflows/lychee-links.yml +++ b/.github/workflows/lychee-links.yml @@ -18,8 +18,8 @@ jobs: - name: Get changed Markdown files id: changed-files run: | - git fetch origin main - files=$(git diff --name-only origin/main...HEAD | grep '\.md$' || true) + git fetch origin ${{ github.base_ref }} + files=$(git diff --name-only origin/${{ github.base_ref }}...HEAD | grep '\.md$' || true) echo "md_files<> $GITHUB_OUTPUT echo "$files" >> $GITHUB_OUTPUT echo "EOF" >> $GITHUB_OUTPUT From c65c5ec7a634858e50146e19713f46c6d418b37b Mon Sep 17 00:00:00 2001 From: Vamshi-Microsoft Date: Mon, 16 Jun 2025 15:18:46 +0530 Subject: [PATCH 07/57] Changed Naming Conversations --- .../workflows/{lychee-links.yml => check-broken-links.yml} | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) rename .github/workflows/{lychee-links.yml => check-broken-links.yml} (91%) diff --git a/.github/workflows/lychee-links.yml b/.github/workflows/check-broken-links.yml similarity index 91% rename from .github/workflows/lychee-links.yml rename to .github/workflows/check-broken-links.yml index bf7841339..3e36deb8f 100644 --- a/.github/workflows/lychee-links.yml +++ b/.github/workflows/check-broken-links.yml @@ -1,4 +1,4 @@ -name: Check Broken links in PR +name: Markdown Links Checker on: pull_request: @@ -6,11 +6,11 @@ on: - '**/*.md' jobs: - lychee: + Validate_Markdown_Links: runs-on: ubuntu-latest steps: - - name: Checkout code + - name: Checkout Repository uses: actions/checkout@v4 with: fetch-depth: 0 # important to allow full diff From 499e36e122ce9114eb2dde6f3ce9175378859fae Mon Sep 17 00:00:00 2001 From: Vamshi-Microsoft Date: Mon, 16 Jun 2025 15:39:37 +0530 Subject: [PATCH 08/57] Run it Daily and create Issue --- .github/workflows/check-broken-links.yml | 42 +++++++++++++----------- 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/.github/workflows/check-broken-links.yml b/.github/workflows/check-broken-links.yml index 3e36deb8f..6aa6e5232 100644 --- a/.github/workflows/check-broken-links.yml +++ b/.github/workflows/check-broken-links.yml @@ -1,31 +1,21 @@ -name: Markdown Links Checker +name: Daily Broken Link Check on: - pull_request: - paths: - - '**/*.md' + schedule: + - cron: '0 2 * * *' # Every day at 2:00 AM UTC + workflow_dispatch: # Optional: allows manual run jobs: - Validate_Markdown_Links: + lychee: + name: Broken Link Checker runs-on: ubuntu-latest steps: - - name: Checkout Repository + - name: Checkout code uses: actions/checkout@v4 - with: - fetch-depth: 0 # important to allow full diff - - - name: Get changed Markdown files - id: changed-files - run: | - git fetch origin ${{ github.base_ref }} - files=$(git diff --name-only origin/${{ github.base_ref }}...HEAD | grep '\.md$' || true) - echo "md_files<> $GITHUB_OUTPUT - echo "$files" >> $GITHUB_OUTPUT - echo "EOF" >> $GITHUB_OUTPUT - - name: Run Lychee on changed Markdown files (internal links only) - if: steps.changed-files.outputs.md_files != '' + - name: Run Lychee link checker + id: lychee uses: lycheeverse/lychee-action@v2.4.1 with: args: > @@ -33,6 +23,18 @@ jobs: --exclude-mail --no-progress --exclude ^https?:// - ${{ steps.changed-files.outputs.md_files }} + --output lychee/out.md + '**/*.md' env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Create or update GitHub Issue if broken links found + if: failure() # Only runs if Lychee exits with error (broken links found) + uses: peter-evans/create-issue-from-file@v4 + with: + title: "🚨 Broken Links Detected" + content-filepath: lychee/out.md + labels: bug, links + assignees: your-github-username # optional: assign to yourself + update-existing: true # ✅ Avoids duplicate issues + issue-pattern: "Broken Links Detected" # Matches existing issue title From d4aa64f2217cdaaffd0c570e7c7d930e83f25d8d Mon Sep 17 00:00:00 2001 From: Vamshi-Microsoft Date: Mon, 16 Jun 2025 15:46:00 +0530 Subject: [PATCH 09/57] Check Daily and create Issue check-broken-links.yml --- .github/workflows/check-broken-links.yml | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/.github/workflows/check-broken-links.yml b/.github/workflows/check-broken-links.yml index 6aa6e5232..4a525622c 100644 --- a/.github/workflows/check-broken-links.yml +++ b/.github/workflows/check-broken-links.yml @@ -3,7 +3,7 @@ name: Daily Broken Link Check on: schedule: - cron: '0 2 * * *' # Every day at 2:00 AM UTC - workflow_dispatch: # Optional: allows manual run + workflow_dispatch: jobs: lychee: @@ -23,18 +23,17 @@ jobs: --exclude-mail --no-progress --exclude ^https?:// - --output lychee/out.md '**/*.md' + output: lychee/out.md # ✅ Set output file here, not in args env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Create or update GitHub Issue if broken links found - if: failure() # Only runs if Lychee exits with error (broken links found) + if: failure() uses: peter-evans/create-issue-from-file@v4 with: title: "🚨 Broken Links Detected" content-filepath: lychee/out.md labels: bug, links - assignees: your-github-username # optional: assign to yourself - update-existing: true # ✅ Avoids duplicate issues - issue-pattern: "Broken Links Detected" # Matches existing issue title + update-existing: true + issue-pattern: "Broken Links Detected" From c8479d01fe7c41e7602528f91e4ab9a002a18f52 Mon Sep 17 00:00:00 2001 From: Vamshi-Microsoft Date: Mon, 16 Jun 2025 16:01:22 +0530 Subject: [PATCH 10/57] Update check-broken-links.yml --- .github/workflows/check-broken-links.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/check-broken-links.yml b/.github/workflows/check-broken-links.yml index 4a525622c..c8a0cce5b 100644 --- a/.github/workflows/check-broken-links.yml +++ b/.github/workflows/check-broken-links.yml @@ -32,8 +32,8 @@ jobs: if: failure() uses: peter-evans/create-issue-from-file@v4 with: - title: "🚨 Broken Links Detected" + title: "Broken Links Detected" content-filepath: lychee/out.md labels: bug, links update-existing: true - issue-pattern: "Broken Links Detected" + issue-pattern: "^Broken Links Detected$" From 21e1d4eb92f665cb65ae9c1af7a80fd221006ccb Mon Sep 17 00:00:00 2001 From: Vamshi-Microsoft Date: Mon, 16 Jun 2025 16:09:34 +0530 Subject: [PATCH 11/57] Update check-broken-links.yml --- .github/workflows/check-broken-links.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/check-broken-links.yml b/.github/workflows/check-broken-links.yml index c8a0cce5b..c1a7b9870 100644 --- a/.github/workflows/check-broken-links.yml +++ b/.github/workflows/check-broken-links.yml @@ -36,4 +36,4 @@ jobs: content-filepath: lychee/out.md labels: bug, links update-existing: true - issue-pattern: "^Broken Links Detected$" + issue-pattern: "Broken Links Detected" From 4a722f369b3f64521fa1a2c293291467e94e0501 Mon Sep 17 00:00:00 2001 From: Vamshi-Microsoft Date: Mon, 16 Jun 2025 16:20:18 +0530 Subject: [PATCH 12/57] Update check-broken-links.yml --- .github/workflows/check-broken-links.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/check-broken-links.yml b/.github/workflows/check-broken-links.yml index c1a7b9870..5d4ebc03f 100644 --- a/.github/workflows/check-broken-links.yml +++ b/.github/workflows/check-broken-links.yml @@ -34,6 +34,6 @@ jobs: with: title: "Broken Links Detected" content-filepath: lychee/out.md - labels: bug, links + labels: links update-existing: true issue-pattern: "Broken Links Detected" From 88f39e1891f4adb22692b2df480805bea10f7987 Mon Sep 17 00:00:00 2001 From: Vamshi-Microsoft Date: Mon, 16 Jun 2025 16:26:12 +0530 Subject: [PATCH 13/57] Update check-broken-links.yml --- .github/workflows/check-broken-links.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/check-broken-links.yml b/.github/workflows/check-broken-links.yml index 5d4ebc03f..def0bcb23 100644 --- a/.github/workflows/check-broken-links.yml +++ b/.github/workflows/check-broken-links.yml @@ -35,5 +35,5 @@ jobs: title: "Broken Links Detected" content-filepath: lychee/out.md labels: links - update-existing: true + update_existing: true issue-pattern: "Broken Links Detected" From fe592487a7bb826ee8d1e2ead5474dadad1c5bc4 Mon Sep 17 00:00:00 2001 From: Vamshi-Microsoft Date: Mon, 16 Jun 2025 16:36:13 +0530 Subject: [PATCH 14/57] Added enhancement to fetch the issue number --- .github/workflows/check-broken-links.yml | 26 +++++++++++++++--------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/.github/workflows/check-broken-links.yml b/.github/workflows/check-broken-links.yml index def0bcb23..54ebd0666 100644 --- a/.github/workflows/check-broken-links.yml +++ b/.github/workflows/check-broken-links.yml @@ -2,12 +2,11 @@ name: Daily Broken Link Check on: schedule: - - cron: '0 2 * * *' # Every day at 2:00 AM UTC + - cron: '0 0 * * *' # Daily at midnight UTC workflow_dispatch: jobs: - lychee: - name: Broken Link Checker + broken-link-check: runs-on: ubuntu-latest steps: @@ -24,16 +23,23 @@ jobs: --no-progress --exclude ^https?:// '**/*.md' - output: lychee/out.md # ✅ Set output file here, not in args + output: lychee/out.md env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Create or update GitHub Issue if broken links found - if: failure() - uses: peter-evans/create-issue-from-file@v4 + - name: Find existing broken-link issue + uses: micalevisk/last-issue-action@v2 + id: find_issue + with: + state: open + labels: link-checker + + - name: Create or update issue + if: steps.lychee.outputs.exit_code != '0' + uses: peter-evans/create-issue-from-file@v5 with: title: "Broken Links Detected" content-filepath: lychee/out.md - labels: links - update_existing: true - issue-pattern: "Broken Links Detected" + labels: link-checker + issue-number: ${{ steps.find_issue.outputs.issue_number }} + From ee411ea1d28cafb8b4ff38c45b7ca933826005af Mon Sep 17 00:00:00 2001 From: Vamshi-Microsoft Date: Mon, 16 Jun 2025 16:47:32 +0530 Subject: [PATCH 15/57] Update check-broken-links.yml --- .github/workflows/check-broken-links.yml | 29 +++++++++++++++++++----- 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/.github/workflows/check-broken-links.yml b/.github/workflows/check-broken-links.yml index 54ebd0666..b594b8094 100644 --- a/.github/workflows/check-broken-links.yml +++ b/.github/workflows/check-broken-links.yml @@ -6,7 +6,7 @@ on: workflow_dispatch: jobs: - broken-link-check: + link-check: runs-on: ubuntu-latest steps: @@ -27,19 +27,36 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Check for broken links + id: broken + run: | + if grep -q "✗" lychee/out.md; then + echo "found=true" >> "$GITHUB_OUTPUT" + else + echo "found=false" >> "$GITHUB_OUTPUT" + fi + - name: Find existing broken-link issue + if: steps.broken.outputs.found == 'true' uses: micalevisk/last-issue-action@v2 id: find_issue with: state: open - labels: link-checker + labels: broken-link-check + + - name: Create new issue if no existing one + if: steps.broken.outputs.found == 'true' && steps.find_issue.outputs.issue_number == '' + uses: peter-evans/create-issue-from-file@v5 + with: + title: "Broken Links Detected" + content-filepath: lychee/out.md + labels: broken-link-check - - name: Create or update issue - if: steps.lychee.outputs.exit_code != '0' + - name: Update existing issue if found + if: steps.broken.outputs.found == 'true' && steps.find_issue.outputs.issue_number != '' uses: peter-evans/create-issue-from-file@v5 with: title: "Broken Links Detected" content-filepath: lychee/out.md - labels: link-checker + labels: broken-link-check issue-number: ${{ steps.find_issue.outputs.issue_number }} - From 7f22ea42dbe5dfbbc278d4dc0118016d5e80fe76 Mon Sep 17 00:00:00 2001 From: Vamshi-Microsoft Date: Mon, 16 Jun 2025 22:35:19 +0530 Subject: [PATCH 16/57] New Updated File which creates/ updates existing Issue --- .github/workflows/check-broken-links.yml | 40 ++++++++++-------------- 1 file changed, 16 insertions(+), 24 deletions(-) diff --git a/.github/workflows/check-broken-links.yml b/.github/workflows/check-broken-links.yml index b594b8094..671e9a650 100644 --- a/.github/workflows/check-broken-links.yml +++ b/.github/workflows/check-broken-links.yml @@ -2,11 +2,11 @@ name: Daily Broken Link Check on: schedule: - - cron: '0 0 * * *' # Daily at midnight UTC + - cron: '0 2 * * *' # Every day at 2:00 AM UTC workflow_dispatch: jobs: - link-check: + broken-link-check: runs-on: ubuntu-latest steps: @@ -27,36 +27,28 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Check for broken links - id: broken + - name: Check if output file is empty + id: check_file run: | - if grep -q "✗" lychee/out.md; then - echo "found=true" >> "$GITHUB_OUTPUT" + if [ -s lychee/out.md ]; then + echo "has_issues=true" >> $GITHUB_OUTPUT else - echo "found=false" >> "$GITHUB_OUTPUT" + echo "has_issues=false" >> $GITHUB_OUTPUT fi - - name: Find existing broken-link issue - if: steps.broken.outputs.found == 'true' - uses: micalevisk/last-issue-action@v2 + - name: Find existing issue id: find_issue - with: - state: open - labels: broken-link-check - - - name: Create new issue if no existing one - if: steps.broken.outputs.found == 'true' && steps.find_issue.outputs.issue_number == '' - uses: peter-evans/create-issue-from-file@v5 + if: steps.check_file.outputs.has_issues == 'true' + uses: peter-evans/find-issue@v2 with: title: "Broken Links Detected" - content-filepath: lychee/out.md - labels: broken-link-check + state: open - - name: Update existing issue if found - if: steps.broken.outputs.found == 'true' && steps.find_issue.outputs.issue_number != '' - uses: peter-evans/create-issue-from-file@v5 + - name: Create or update GitHub Issue + if: steps.check_file.outputs.has_issues == 'true' + uses: peter-evans/create-issue-from-file@v4 with: title: "Broken Links Detected" content-filepath: lychee/out.md - labels: broken-link-check - issue-number: ${{ steps.find_issue.outputs.issue_number }} + labels: bug, links + issue-number: ${{ steps.find_issue.outputs.issue-number }} From d66cff910bcdaa5edfc9cf62948537af2d3a3aaa Mon Sep 17 00:00:00 2001 From: Vamshi-Microsoft Date: Mon, 16 Jun 2025 22:37:01 +0530 Subject: [PATCH 17/57] Update check-broken-links.yml --- .github/workflows/check-broken-links.yml | 30 ++++++++++++------------ 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/.github/workflows/check-broken-links.yml b/.github/workflows/check-broken-links.yml index 671e9a650..9adcaa20c 100644 --- a/.github/workflows/check-broken-links.yml +++ b/.github/workflows/check-broken-links.yml @@ -2,7 +2,7 @@ name: Daily Broken Link Check on: schedule: - - cron: '0 2 * * *' # Every day at 2:00 AM UTC + - cron: '0 2 * * *' workflow_dispatch: jobs: @@ -36,19 +36,19 @@ jobs: echo "has_issues=false" >> $GITHUB_OUTPUT fi - - name: Find existing issue - id: find_issue - if: steps.check_file.outputs.has_issues == 'true' - uses: peter-evans/find-issue@v2 - with: - title: "Broken Links Detected" - state: open - - name: Create or update GitHub Issue if: steps.check_file.outputs.has_issues == 'true' - uses: peter-evans/create-issue-from-file@v4 - with: - title: "Broken Links Detected" - content-filepath: lychee/out.md - labels: bug, links - issue-number: ${{ steps.find_issue.outputs.issue-number }} + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + ISSUE_TITLE="🚨 Broken Links Detected" + ISSUE_BODY="$(cat lychee/out.md)" + EXISTING_ISSUE=$(gh issue list --state open --search "$ISSUE_TITLE" --json number,title | jq -r '.[] | select(.title == "'"$ISSUE_TITLE"'") | .number') + + if [ -n "$EXISTING_ISSUE" ]; then + echo "Updating existing issue #$EXISTING_ISSUE" + gh issue edit "$EXISTING_ISSUE" --body "$ISSUE_BODY" + else + echo "Creating new issue" + gh issue create --title "$ISSUE_TITLE" --body "$ISSUE_BODY" --label "bug,links" + fi From 7aa5a04960a857e9b49e21496ac2d13ed0f4041a Mon Sep 17 00:00:00 2001 From: Vamshi-Microsoft Date: Mon, 16 Jun 2025 22:45:18 +0530 Subject: [PATCH 18/57] Update check-broken-links.yml --- .github/workflows/check-broken-links.yml | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/.github/workflows/check-broken-links.yml b/.github/workflows/check-broken-links.yml index 9adcaa20c..052e66ba3 100644 --- a/.github/workflows/check-broken-links.yml +++ b/.github/workflows/check-broken-links.yml @@ -31,20 +31,23 @@ jobs: id: check_file run: | if [ -s lychee/out.md ]; then - echo "has_issues=true" >> $GITHUB_OUTPUT + echo "has_issues=true" >> $GITHUB_ENV else - echo "has_issues=false" >> $GITHUB_OUTPUT + echo "has_issues=false" >> $GITHUB_ENV fi - + - name: Create or update GitHub Issue - if: steps.check_file.outputs.has_issues == 'true' + if: env.has_issues == 'true' env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | ISSUE_TITLE="🚨 Broken Links Detected" ISSUE_BODY="$(cat lychee/out.md)" - EXISTING_ISSUE=$(gh issue list --state open --search "$ISSUE_TITLE" --json number,title | jq -r '.[] | select(.title == "'"$ISSUE_TITLE"'") | .number') - + echo "Searching for existing issue..." + gh issue list --state open --search "$ISSUE_TITLE" --json number,title > issues.json + cat issues.json + EXISTING_ISSUE=$(jq -r '.[] | select(.title == "'"$ISSUE_TITLE"'") | .number' issues.json) + if [ -n "$EXISTING_ISSUE" ]; then echo "Updating existing issue #$EXISTING_ISSUE" gh issue edit "$EXISTING_ISSUE" --body "$ISSUE_BODY" From bdf0632b7a8c7e544ca2bebb4824225f1b63e2c5 Mon Sep 17 00:00:00 2001 From: Vamshi-Microsoft Date: Mon, 16 Jun 2025 22:50:32 +0530 Subject: [PATCH 19/57] Update check-broken-links.yml --- .github/workflows/check-broken-links.yml | 51 ++++++++++++------------ 1 file changed, 25 insertions(+), 26 deletions(-) diff --git a/.github/workflows/check-broken-links.yml b/.github/workflows/check-broken-links.yml index 052e66ba3..02fb899de 100644 --- a/.github/workflows/check-broken-links.yml +++ b/.github/workflows/check-broken-links.yml @@ -1,17 +1,8 @@ -name: Daily Broken Link Check - -on: - schedule: - - cron: '0 2 * * *' - workflow_dispatch: - jobs: broken-link-check: runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v4 + - uses: actions/checkout@v4 - name: Run Lychee link checker id: lychee @@ -27,31 +18,39 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Check if output file is empty - id: check_file + - name: Detect broken links + id: detect run: | if [ -s lychee/out.md ]; then - echo "has_issues=true" >> $GITHUB_ENV + echo "has_issues=true" >> $GITHUB_OUTPUT else - echo "has_issues=false" >> $GITHUB_ENV + echo "has_issues=false" >> $GITHUB_OUTPUT fi - + - name: Create or update GitHub Issue - if: env.has_issues == 'true' + if: steps.detect.outputs.has_issues == 'true' env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | - ISSUE_TITLE="🚨 Broken Links Detected" - ISSUE_BODY="$(cat lychee/out.md)" + TITLE="🚨 Broken Links Detected" + BODY="$(cat lychee/out.md)" echo "Searching for existing issue..." - gh issue list --state open --search "$ISSUE_TITLE" --json number,title > issues.json - cat issues.json - EXISTING_ISSUE=$(jq -r '.[] | select(.title == "'"$ISSUE_TITLE"'") | .number' issues.json) - - if [ -n "$EXISTING_ISSUE" ]; then - echo "Updating existing issue #$EXISTING_ISSUE" - gh issue edit "$EXISTING_ISSUE" --body "$ISSUE_BODY" + gh issue list \ + --state open \ + --label bug,links \ + --search "$TITLE" \ + --json number,title \ + > issues.json + + ISSUE_NUM=$(jq -r '.[] | select(.title==env.TITLE) | .number' issues.json) + + if [ -n "$ISSUE_NUM" ]; then + echo "Updating issue #$ISSUE_NUM" + gh issue edit "$ISSUE_NUM" --body "$BODY" else echo "Creating new issue" - gh issue create --title "$ISSUE_TITLE" --body "$ISSUE_BODY" --label "bug,links" + gh issue create \ + --title "$TITLE" \ + --body "$BODY" \ + --label "bug,links" fi From b218eb0e9dbf14fca82b503adde1fee6be376772 Mon Sep 17 00:00:00 2001 From: Vamshi-Microsoft Date: Mon, 16 Jun 2025 22:52:27 +0530 Subject: [PATCH 20/57] Update check-broken-links.yml --- .github/workflows/check-broken-links.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/check-broken-links.yml b/.github/workflows/check-broken-links.yml index 02fb899de..3f88d7b0c 100644 --- a/.github/workflows/check-broken-links.yml +++ b/.github/workflows/check-broken-links.yml @@ -1,3 +1,10 @@ +name: Daily Broken Link Check + +on: + schedule: + - cron: '0 2 * * *' + workflow_dispatch: + jobs: broken-link-check: runs-on: ubuntu-latest @@ -32,7 +39,7 @@ jobs: env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | - TITLE="🚨 Broken Links Detected" + TITLE="Broken Links Detected" BODY="$(cat lychee/out.md)" echo "Searching for existing issue..." gh issue list \ From 61831a3fc77ef89b830f27663a62566aee14df7c Mon Sep 17 00:00:00 2001 From: Vamshi-Microsoft Date: Mon, 16 Jun 2025 22:54:40 +0530 Subject: [PATCH 21/57] Update check-broken-links.yml From b3f8f98f3bf28e9dd5f8d3de7158c5eebe393a84 Mon Sep 17 00:00:00 2001 From: Vamshi-Microsoft Date: Mon, 16 Jun 2025 22:57:37 +0530 Subject: [PATCH 22/57] Update check-broken-links.yml --- .github/workflows/check-broken-links.yml | 56 +++++++----------------- 1 file changed, 16 insertions(+), 40 deletions(-) diff --git a/.github/workflows/check-broken-links.yml b/.github/workflows/check-broken-links.yml index 3f88d7b0c..c1a7b9870 100644 --- a/.github/workflows/check-broken-links.yml +++ b/.github/workflows/check-broken-links.yml @@ -2,14 +2,17 @@ name: Daily Broken Link Check on: schedule: - - cron: '0 2 * * *' + - cron: '0 2 * * *' # Every day at 2:00 AM UTC workflow_dispatch: jobs: - broken-link-check: + lychee: + name: Broken Link Checker runs-on: ubuntu-latest + steps: - - uses: actions/checkout@v4 + - name: Checkout code + uses: actions/checkout@v4 - name: Run Lychee link checker id: lychee @@ -21,43 +24,16 @@ jobs: --no-progress --exclude ^https?:// '**/*.md' - output: lychee/out.md + output: lychee/out.md # ✅ Set output file here, not in args env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Detect broken links - id: detect - run: | - if [ -s lychee/out.md ]; then - echo "has_issues=true" >> $GITHUB_OUTPUT - else - echo "has_issues=false" >> $GITHUB_OUTPUT - fi - - - name: Create or update GitHub Issue - if: steps.detect.outputs.has_issues == 'true' - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - TITLE="Broken Links Detected" - BODY="$(cat lychee/out.md)" - echo "Searching for existing issue..." - gh issue list \ - --state open \ - --label bug,links \ - --search "$TITLE" \ - --json number,title \ - > issues.json - - ISSUE_NUM=$(jq -r '.[] | select(.title==env.TITLE) | .number' issues.json) - - if [ -n "$ISSUE_NUM" ]; then - echo "Updating issue #$ISSUE_NUM" - gh issue edit "$ISSUE_NUM" --body "$BODY" - else - echo "Creating new issue" - gh issue create \ - --title "$TITLE" \ - --body "$BODY" \ - --label "bug,links" - fi + - name: Create or update GitHub Issue if broken links found + if: failure() + uses: peter-evans/create-issue-from-file@v4 + with: + title: "Broken Links Detected" + content-filepath: lychee/out.md + labels: bug, links + update-existing: true + issue-pattern: "Broken Links Detected" From 5020b6dffcb0e3cc73c15ed455df661c0bc6d379 Mon Sep 17 00:00:00 2001 From: Vamshi-Microsoft Date: Mon, 16 Jun 2025 23:13:30 +0530 Subject: [PATCH 23/57] Update check-broken-links.yml --- .github/workflows/check-broken-links.yml | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/workflows/check-broken-links.yml b/.github/workflows/check-broken-links.yml index c1a7b9870..68f63d7d4 100644 --- a/.github/workflows/check-broken-links.yml +++ b/.github/workflows/check-broken-links.yml @@ -28,12 +28,14 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Create or update GitHub Issue if broken links found + - name: Create or update GitHub issue if broken links found if: failure() - uses: peter-evans/create-issue-from-file@v4 + uses: JasonEtco/create-an-issue@v2 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: + filename: lychee/out.md title: "Broken Links Detected" - content-filepath: lychee/out.md labels: bug, links - update-existing: true - issue-pattern: "Broken Links Detected" + update_existing: true + search_existing: all From 18719a2fd705fe310f07f48276019a560ff9713d Mon Sep 17 00:00:00 2001 From: Vamshi-Microsoft Date: Mon, 16 Jun 2025 23:35:56 +0530 Subject: [PATCH 24/57] Update check-broken-links.yml --- .github/workflows/check-broken-links.yml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/workflows/check-broken-links.yml b/.github/workflows/check-broken-links.yml index 68f63d7d4..8c4e77648 100644 --- a/.github/workflows/check-broken-links.yml +++ b/.github/workflows/check-broken-links.yml @@ -28,14 +28,18 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Create or update GitHub issue if broken links found + - name: Add front-matter for issue + if: failure() + run: | + echo -e "---\ntitle: Broken Links Detected\nlabels: bug, links\n---\n$(cat lychee/out.md)" > lychee/out.md + + - name: Create or update GitHub issue if: failure() uses: JasonEtco/create-an-issue@v2 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: filename: lychee/out.md - title: "Broken Links Detected" - labels: bug, links update_existing: true search_existing: all + From c4f62d09c331673da5a6ac0008aaf6909df6a0a1 Mon Sep 17 00:00:00 2001 From: Vamshi-Microsoft Date: Mon, 16 Jun 2025 23:40:19 +0530 Subject: [PATCH 25/57] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 179ef8d2d..4419ea8e2 100644 --- a/README.md +++ b/README.md @@ -68,7 +68,7 @@ By default, this repo comes with one specific set of RAG configurations includin The accelerator presented here provides several options, for example: * The ability to ground a model using both data and public web pages -* A backend with support for 'custom' and 'On Your Data' [conversation flows](./docs/conversation_flow_options.md) +* A backend with support for 'custom' and 'On Your Data' [conversation flows](./docs/conversation_flow_options_test.md) * Advanced prompt engineering capabilities * An admin site for ingesting/inspecting/configuring your dataset on the fly * Push or Pull model for data ingestion: See [integrated vectorization](./docs/integrated_vectorization.md) documentation for more details From 0811b60dd3c787d8d3f25057617504e262eb6045 Mon Sep 17 00:00:00 2001 From: Vamshi-Microsoft Date: Mon, 16 Jun 2025 23:46:01 +0530 Subject: [PATCH 26/57] Final changes to issue creation --- .github/workflows/check-broken-links.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/check-broken-links.yml b/.github/workflows/check-broken-links.yml index 8c4e77648..046cedde5 100644 --- a/.github/workflows/check-broken-links.yml +++ b/.github/workflows/check-broken-links.yml @@ -31,7 +31,7 @@ jobs: - name: Add front-matter for issue if: failure() run: | - echo -e "---\ntitle: Broken Links Detected\nlabels: bug, links\n---\n$(cat lychee/out.md)" > lychee/out.md + echo -e "---\ntitle: Broken Links Detected\nlabels: broken-links\n---\n$(cat lychee/out.md)" > lychee/out.md - name: Create or update GitHub issue if: failure() @@ -41,5 +41,5 @@ jobs: with: filename: lychee/out.md update_existing: true - search_existing: all + search_existing: open From 696a94d1ad9034adaa2ac3bd63eace608d2461c6 Mon Sep 17 00:00:00 2001 From: Vamshi-Microsoft Date: Tue, 17 Jun 2025 15:08:10 +0530 Subject: [PATCH 27/57] Create Broken-links-checker-Manual --- .github/workflows/Broken-links-checker-Manual | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 .github/workflows/Broken-links-checker-Manual diff --git a/.github/workflows/Broken-links-checker-Manual b/.github/workflows/Broken-links-checker-Manual new file mode 100644 index 000000000..3edce65e7 --- /dev/null +++ b/.github/workflows/Broken-links-checker-Manual @@ -0,0 +1,32 @@ +name: Manual Broken Link Check + +on: + workflow_dispatch: # Only run manually + +jobs: + lychee: + name: Broken Link Checker + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Run Lychee link checker + id: lychee + uses: lycheeverse/lychee-action@v2.4.1 + with: + args: > + --verbose + --exclude-mail + --no-progress + --exclude ^https?:// + '**/*.md' + output: lychee/out.md + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Show report + run: | + echo "=== Broken Link Report ===" + cat lychee/out.md From 02759b0372561ba8be3d8bb813fec295084a7421 Mon Sep 17 00:00:00 2001 From: Vamshi-Microsoft Date: Tue, 17 Jun 2025 15:10:48 +0530 Subject: [PATCH 28/57] Rename Broken-links-checker-Manual to Broken-links-checker-Manual.yml --- ...roken-links-checker-Manual => Broken-links-checker-Manual.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{Broken-links-checker-Manual => Broken-links-checker-Manual.yml} (100%) diff --git a/.github/workflows/Broken-links-checker-Manual b/.github/workflows/Broken-links-checker-Manual.yml similarity index 100% rename from .github/workflows/Broken-links-checker-Manual rename to .github/workflows/Broken-links-checker-Manual.yml From 48443e196f4bad4913eb64394148ac752d6b5f32 Mon Sep 17 00:00:00 2001 From: Vamshi-Microsoft Date: Tue, 17 Jun 2025 15:13:12 +0530 Subject: [PATCH 29/57] Update Broken-links-checker-Manual.yml --- .github/workflows/Broken-links-checker-Manual.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.github/workflows/Broken-links-checker-Manual.yml b/.github/workflows/Broken-links-checker-Manual.yml index 3edce65e7..32eb459f2 100644 --- a/.github/workflows/Broken-links-checker-Manual.yml +++ b/.github/workflows/Broken-links-checker-Manual.yml @@ -25,8 +25,3 @@ jobs: output: lychee/out.md env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Show report - run: | - echo "=== Broken Link Report ===" - cat lychee/out.md From f52f3ebc261afc9ee02e5cda172c249a680d18e4 Mon Sep 17 00:00:00 2001 From: Vamshi-Microsoft Date: Tue, 17 Jun 2025 15:29:57 +0530 Subject: [PATCH 30/57] Update Broken-links-checker-Manual.yml --- .github/workflows/Broken-links-checker-Manual.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/Broken-links-checker-Manual.yml b/.github/workflows/Broken-links-checker-Manual.yml index 32eb459f2..841b73585 100644 --- a/.github/workflows/Broken-links-checker-Manual.yml +++ b/.github/workflows/Broken-links-checker-Manual.yml @@ -1,19 +1,19 @@ -name: Manual Broken Link Check +name: Markdown Broken Link Check Manual on: workflow_dispatch: # Only run manually jobs: - lychee: - name: Broken Link Checker + broken-link-check: + name: Run Broken Link Checker runs-on: ubuntu-latest steps: - - name: Checkout code + - name: Checkout Repository uses: actions/checkout@v4 - - name: Run Lychee link checker - id: lychee + - name: Check Markdown Files for Broken Links + id: link-check uses: lycheeverse/lychee-action@v2.4.1 with: args: > From bff95745840673143f2e2f26b63506d024adb62a Mon Sep 17 00:00:00 2001 From: Vamshi-Microsoft Date: Tue, 17 Jun 2025 17:42:50 +0530 Subject: [PATCH 31/57] FInal Github action including PR and full repo --- .../workflows/Broken-links-checker-Manual.yml | 27 -------- .../workflows/Broken-links-checker-final.yml | 63 +++++++++++++++++++ 2 files changed, 63 insertions(+), 27 deletions(-) delete mode 100644 .github/workflows/Broken-links-checker-Manual.yml create mode 100644 .github/workflows/Broken-links-checker-final.yml diff --git a/.github/workflows/Broken-links-checker-Manual.yml b/.github/workflows/Broken-links-checker-Manual.yml deleted file mode 100644 index 841b73585..000000000 --- a/.github/workflows/Broken-links-checker-Manual.yml +++ /dev/null @@ -1,27 +0,0 @@ -name: Markdown Broken Link Check Manual - -on: - workflow_dispatch: # Only run manually - -jobs: - broken-link-check: - name: Run Broken Link Checker - runs-on: ubuntu-latest - - steps: - - name: Checkout Repository - uses: actions/checkout@v4 - - - name: Check Markdown Files for Broken Links - id: link-check - uses: lycheeverse/lychee-action@v2.4.1 - with: - args: > - --verbose - --exclude-mail - --no-progress - --exclude ^https?:// - '**/*.md' - output: lychee/out.md - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/Broken-links-checker-final.yml b/.github/workflows/Broken-links-checker-final.yml new file mode 100644 index 000000000..d20230676 --- /dev/null +++ b/.github/workflows/Broken-links-checker-final.yml @@ -0,0 +1,63 @@ +name: Markdown Broken Links Checker + +on: + pull_request: + paths: + - '**/*.md' + workflow_dispatch: # Manual trigger for full repo check + +jobs: + validate-markdown-links-pr: + name: Check Broken Links in PR + if: github.event_name == 'pull_request' + runs-on: ubuntu-latest + + steps: + - name: Checkout Repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Get changed Markdown files + id: changed-files + run: | + git fetch origin ${{ github.base_ref }} + files=$(git diff --name-only origin/${{ github.base_ref }}...HEAD | grep '\.md$' || true) + echo "md_files<> $GITHUB_OUTPUT + echo "$files" >> $GITHUB_OUTPUT + echo "EOF" >> $GITHUB_OUTPUT + + - name: Run Lychee on changed Markdown files (internal links only) + if: steps.changed-files.outputs.md_files != '' + uses: lycheeverse/lychee-action@v2.4.1 + with: + args: > + --verbose + --exclude-mail + --no-progress + --exclude ^https?:// + ${{ steps.changed-files.outputs.md_files }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + validate-markdown-links-fullRepo: + name: Check Broken Links in Full Repo (Manual) + if: github.event_name == 'workflow_dispatch' + runs-on: ubuntu-latest + + steps: + - name: Checkout Repository + uses: actions/checkout@v4 + + - name: Run Lychee on All Markdown Files (internal links only) + uses: lycheeverse/lychee-action@v2.4.1 + with: + args: > + --verbose + --exclude-mail + --no-progress + --exclude ^https?:// + '**/*.md' + output: lychee/out.md + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 2d22d359149071ff975ee3104ef13a8d1057dcb7 Mon Sep 17 00:00:00 2001 From: Vamshi-Microsoft Date: Wed, 18 Jun 2025 09:51:28 +0530 Subject: [PATCH 32/57] Update Broken-links-checker-final.yml --- .../workflows/Broken-links-checker-final.yml | 40 ++++++------------- 1 file changed, 13 insertions(+), 27 deletions(-) diff --git a/.github/workflows/Broken-links-checker-final.yml b/.github/workflows/Broken-links-checker-final.yml index d20230676..e257c30fa 100644 --- a/.github/workflows/Broken-links-checker-final.yml +++ b/.github/workflows/Broken-links-checker-final.yml @@ -1,25 +1,25 @@ -name: Markdown Broken Links Checker +name: Markdown Link Checker on: pull_request: paths: - '**/*.md' - workflow_dispatch: # Manual trigger for full repo check + workflow_dispatch: jobs: - validate-markdown-links-pr: - name: Check Broken Links in PR - if: github.event_name == 'pull_request' + markdown-link-check: + name: Check Markdown Links runs-on: ubuntu-latest steps: - - name: Checkout Repository + - name: Checkout Repo uses: actions/checkout@v4 with: fetch-depth: 0 - - name: Get changed Markdown files + - name: Get Changed Markdown Files (PR only) id: changed-files + if: github.event_name == 'pull_request' run: | git fetch origin ${{ github.base_ref }} files=$(git diff --name-only origin/${{ github.base_ref }}...HEAD | grep '\.md$' || true) @@ -27,36 +27,22 @@ jobs: echo "$files" >> $GITHUB_OUTPUT echo "EOF" >> $GITHUB_OUTPUT - - name: Run Lychee on changed Markdown files (internal links only) - if: steps.changed-files.outputs.md_files != '' + - name: Run Lychee on Changed Files (PR) + if: github.event_name == 'pull_request' && steps.changed-files.outputs.md_files != '' uses: lycheeverse/lychee-action@v2.4.1 with: args: > - --verbose - --exclude-mail - --no-progress - --exclude ^https?:// + --verbose --exclude-mail --no-progress --exclude ^https?:// ${{ steps.changed-files.outputs.md_files }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - validate-markdown-links-fullRepo: - name: Check Broken Links in Full Repo (Manual) - if: github.event_name == 'workflow_dispatch' - runs-on: ubuntu-latest - - steps: - - name: Checkout Repository - uses: actions/checkout@v4 - - - name: Run Lychee on All Markdown Files (internal links only) + - name: Run Lychee on All Files (Manual) + if: github.event_name == 'workflow_dispatch' uses: lycheeverse/lychee-action@v2.4.1 with: args: > - --verbose - --exclude-mail - --no-progress - --exclude ^https?:// + --verbose --exclude-mail --no-progress --exclude ^https?:// '**/*.md' output: lychee/out.md env: From fa039ef6e59de59cf4db353a13c326c2fb1b2635 Mon Sep 17 00:00:00 2001 From: Vamshi-Microsoft Date: Wed, 18 Jun 2025 11:44:54 +0530 Subject: [PATCH 33/57] Updated Names --- .github/workflows/Broken-links-checker-final.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/Broken-links-checker-final.yml b/.github/workflows/Broken-links-checker-final.yml index e257c30fa..ac5a2516a 100644 --- a/.github/workflows/Broken-links-checker-final.yml +++ b/.github/workflows/Broken-links-checker-final.yml @@ -1,4 +1,4 @@ -name: Markdown Link Checker +name: Broken Link Checker on: pull_request: @@ -8,7 +8,7 @@ on: jobs: markdown-link-check: - name: Check Markdown Links + name: Check Markdown Broken Links runs-on: ubuntu-latest steps: @@ -27,7 +27,7 @@ jobs: echo "$files" >> $GITHUB_OUTPUT echo "EOF" >> $GITHUB_OUTPUT - - name: Run Lychee on Changed Files (PR) + - name: Check Broken Links on Changed Files (PR) if: github.event_name == 'pull_request' && steps.changed-files.outputs.md_files != '' uses: lycheeverse/lychee-action@v2.4.1 with: @@ -37,7 +37,7 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Run Lychee on All Files (Manual) + - name: Check Broken Links on Entire Repo (Manual) if: github.event_name == 'workflow_dispatch' uses: lycheeverse/lychee-action@v2.4.1 with: From a3a1845eb154f5f05efc4aaa2df29b51b3c6d644 Mon Sep 17 00:00:00 2001 From: Vamshi-Microsoft Date: Wed, 18 Jun 2025 12:01:01 +0530 Subject: [PATCH 34/57] Update Broken-links-checker-final.yml --- .github/workflows/Broken-links-checker-final.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/Broken-links-checker-final.yml b/.github/workflows/Broken-links-checker-final.yml index ac5a2516a..cc0e7bc34 100644 --- a/.github/workflows/Broken-links-checker-final.yml +++ b/.github/workflows/Broken-links-checker-final.yml @@ -17,7 +17,7 @@ jobs: with: fetch-depth: 0 - - name: Get Changed Markdown Files (PR only) + - name: Get Added/Modified Markdown Files (PR only) id: changed-files if: github.event_name == 'pull_request' run: | @@ -27,7 +27,7 @@ jobs: echo "$files" >> $GITHUB_OUTPUT echo "EOF" >> $GITHUB_OUTPUT - - name: Check Broken Links on Changed Files (PR) + - name: Check Broken Links in Added/Modified Files (PR) if: github.event_name == 'pull_request' && steps.changed-files.outputs.md_files != '' uses: lycheeverse/lychee-action@v2.4.1 with: @@ -37,7 +37,7 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Check Broken Links on Entire Repo (Manual) + - name: Check Broken Links in Entire Repo (Manual) if: github.event_name == 'workflow_dispatch' uses: lycheeverse/lychee-action@v2.4.1 with: From e7401dcd6e10f32cb92996d5922765159893a0c9 Mon Sep 17 00:00:00 2001 From: Vamshi-Microsoft Date: Mon, 23 Jun 2025 17:42:24 +0530 Subject: [PATCH 35/57] Added changes to skip code within comments Broken-links-checker-final.yml --- .github/workflows/Broken-links-checker-final.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/Broken-links-checker-final.yml b/.github/workflows/Broken-links-checker-final.yml index cc0e7bc34..645cfe460 100644 --- a/.github/workflows/Broken-links-checker-final.yml +++ b/.github/workflows/Broken-links-checker-final.yml @@ -33,6 +33,7 @@ jobs: with: args: > --verbose --exclude-mail --no-progress --exclude ^https?:// + --include-comments false ${{ steps.changed-files.outputs.md_files }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -43,6 +44,7 @@ jobs: with: args: > --verbose --exclude-mail --no-progress --exclude ^https?:// + --include-comments false '**/*.md' output: lychee/out.md env: From 7824fc2ea814970c0484aa98d60a11fb37bce43b Mon Sep 17 00:00:00 2001 From: Vamshi-Microsoft Date: Mon, 23 Jun 2025 18:13:38 +0530 Subject: [PATCH 36/57] Update Broken-links-checker-final.yml --- .../workflows/Broken-links-checker-final.yml | 24 +++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/.github/workflows/Broken-links-checker-final.yml b/.github/workflows/Broken-links-checker-final.yml index 645cfe460..fde58f4ed 100644 --- a/.github/workflows/Broken-links-checker-final.yml +++ b/.github/workflows/Broken-links-checker-final.yml @@ -27,25 +27,41 @@ jobs: echo "$files" >> $GITHUB_OUTPUT echo "EOF" >> $GITHUB_OUTPUT + - name: Strip HTML Comments from Changed Markdown Files (PR only) + if: github.event_name == 'pull_request' && steps.changed-files.outputs.md_files != '' + run: | + mkdir sanitized_md + for file in ${{ steps.changed-files.outputs.md_files }}; do + mkdir -p "sanitized_md/$(dirname "$file")" + sed '//d' "$file" > "sanitized_md/$file" + done + - name: Check Broken Links in Added/Modified Files (PR) if: github.event_name == 'pull_request' && steps.changed-files.outputs.md_files != '' uses: lycheeverse/lychee-action@v2.4.1 with: args: > --verbose --exclude-mail --no-progress --exclude ^https?:// - --include-comments false - ${{ steps.changed-files.outputs.md_files }} + sanitized_md/**/*.md env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Strip HTML Comments from All Markdown Files (Manual) + if: github.event_name == 'workflow_dispatch' + run: | + mkdir sanitized_md + for file in $(find . -name "*.md"); do + mkdir -p "sanitized_md/$(dirname "$file")" + sed '//d' "$file" > "sanitized_md/$file" + done + - name: Check Broken Links in Entire Repo (Manual) if: github.event_name == 'workflow_dispatch' uses: lycheeverse/lychee-action@v2.4.1 with: args: > --verbose --exclude-mail --no-progress --exclude ^https?:// - --include-comments false - '**/*.md' + sanitized_md/**/*.md output: lychee/out.md env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 1f3235180039922826020d9cb795ef6ed2951235 Mon Sep 17 00:00:00 2001 From: Vamshi-Microsoft Date: Mon, 23 Jun 2025 22:29:28 +0530 Subject: [PATCH 37/57] Update Broken-links-checker-final.yml --- .../workflows/Broken-links-checker-final.yml | 32 +++++++++---------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/.github/workflows/Broken-links-checker-final.yml b/.github/workflows/Broken-links-checker-final.yml index fde58f4ed..c49cec55f 100644 --- a/.github/workflows/Broken-links-checker-final.yml +++ b/.github/workflows/Broken-links-checker-final.yml @@ -12,7 +12,7 @@ jobs: runs-on: ubuntu-latest steps: - - name: Checkout Repo + - name: Checkout Repository uses: actions/checkout@v4 with: fetch-depth: 0 @@ -27,41 +27,39 @@ jobs: echo "$files" >> $GITHUB_OUTPUT echo "EOF" >> $GITHUB_OUTPUT - - name: Strip HTML Comments from Changed Markdown Files (PR only) + - name: Prepare Sanitized Markdown Files (PR) if: github.event_name == 'pull_request' && steps.changed-files.outputs.md_files != '' run: | - mkdir sanitized_md + rsync -av --exclude '.git' --exclude 'node_modules' ./ sanitized_md/ for file in ${{ steps.changed-files.outputs.md_files }}; do - mkdir -p "sanitized_md/$(dirname "$file")" - sed '//d' "$file" > "sanitized_md/$file" + [ -f "sanitized_md/$file" ] && sed -i '//d' "sanitized_md/$file" done - - name: Check Broken Links in Added/Modified Files (PR) + - name: Run Lychee on Changed Markdown Files (PR) if: github.event_name == 'pull_request' && steps.changed-files.outputs.md_files != '' uses: lycheeverse/lychee-action@v2.4.1 with: args: > - --verbose --exclude-mail --no-progress --exclude ^https?:// - sanitized_md/**/*.md + --verbose --no-progress --exclude-mail + --exclude ^https?:// + sanitized_md/${{ steps.changed-files.outputs.md_files }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Strip HTML Comments from All Markdown Files (Manual) + - name: Prepare Sanitized Markdown Files (Manual) if: github.event_name == 'workflow_dispatch' run: | - mkdir sanitized_md - for file in $(find . -name "*.md"); do - mkdir -p "sanitized_md/$(dirname "$file")" - sed '//d' "$file" > "sanitized_md/$file" - done + rsync -av --exclude '.git' --exclude 'node_modules' ./ sanitized_md/ + find sanitized_md -name "*.md" -exec sed -i '//d' {} + - - name: Check Broken Links in Entire Repo (Manual) + - name: Run Lychee on Entire Repo (Manual) if: github.event_name == 'workflow_dispatch' uses: lycheeverse/lychee-action@v2.4.1 with: args: > - --verbose --exclude-mail --no-progress --exclude ^https?:// - sanitized_md/**/*.md + --verbose --no-progress --exclude-mail + --exclude ^https?:// + 'sanitized_md/**/*.md' output: lychee/out.md env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 829ea2d332caf0a4d59cef329957c0b217e6f060 Mon Sep 17 00:00:00 2001 From: Vamshi-Microsoft Date: Mon, 23 Jun 2025 22:36:57 +0530 Subject: [PATCH 38/57] Update Broken-links-checker-final.yml --- .github/workflows/Broken-links-checker-final.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/Broken-links-checker-final.yml b/.github/workflows/Broken-links-checker-final.yml index c49cec55f..2587d4229 100644 --- a/.github/workflows/Broken-links-checker-final.yml +++ b/.github/workflows/Broken-links-checker-final.yml @@ -32,7 +32,9 @@ jobs: run: | rsync -av --exclude '.git' --exclude 'node_modules' ./ sanitized_md/ for file in ${{ steps.changed-files.outputs.md_files }}; do - [ -f "sanitized_md/$file" ] && sed -i '//d' "sanitized_md/$file" + if [ -f "sanitized_md/$file" ]; then + sed -i -e 's///g' -e '//d' "sanitized_md/$file" + fi done - name: Run Lychee on Changed Markdown Files (PR) @@ -50,7 +52,7 @@ jobs: if: github.event_name == 'workflow_dispatch' run: | rsync -av --exclude '.git' --exclude 'node_modules' ./ sanitized_md/ - find sanitized_md -name "*.md" -exec sed -i '//d' {} + + find sanitized_md -name "*.md" -exec sed -i -e 's///g' -e '//d' {} + - name: Run Lychee on Entire Repo (Manual) if: github.event_name == 'workflow_dispatch' From 32ef11433954796c67ef1379b6ae5bfaa733afa0 Mon Sep 17 00:00:00 2001 From: Vamshi-Microsoft Date: Mon, 23 Jun 2025 22:43:45 +0530 Subject: [PATCH 39/57] Update Broken-links-checker-final.yml --- .github/workflows/Broken-links-checker-final.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/Broken-links-checker-final.yml b/.github/workflows/Broken-links-checker-final.yml index 2587d4229..97e7e9d16 100644 --- a/.github/workflows/Broken-links-checker-final.yml +++ b/.github/workflows/Broken-links-checker-final.yml @@ -52,7 +52,8 @@ jobs: if: github.event_name == 'workflow_dispatch' run: | rsync -av --exclude '.git' --exclude 'node_modules' ./ sanitized_md/ - find sanitized_md -name "*.md" -exec sed -i -e 's///g' -e '//d' {} + + find sanitized_md -name "*.md" -exec perl -0777 -i -pe 's///gs' {} + + - name: Run Lychee on Entire Repo (Manual) if: github.event_name == 'workflow_dispatch' From c1326bd945df24877268a133db46e4810fb71793 Mon Sep 17 00:00:00 2001 From: Vamshi-Microsoft Date: Mon, 23 Jun 2025 22:49:31 +0530 Subject: [PATCH 40/57] Update Broken-links-checker-final.yml --- .../workflows/Broken-links-checker-final.yml | 59 +++++++++++++------ 1 file changed, 40 insertions(+), 19 deletions(-) diff --git a/.github/workflows/Broken-links-checker-final.yml b/.github/workflows/Broken-links-checker-final.yml index 97e7e9d16..bc9ac9a58 100644 --- a/.github/workflows/Broken-links-checker-final.yml +++ b/.github/workflows/Broken-links-checker-final.yml @@ -12,12 +12,12 @@ jobs: runs-on: ubuntu-latest steps: - - name: Checkout Repository + - name: Checkout Repo uses: actions/checkout@v4 with: fetch-depth: 0 - - name: Get Added/Modified Markdown Files (PR only) + - name: Get Changed Markdown Files (PR only) id: changed-files if: github.event_name == 'pull_request' run: | @@ -27,42 +27,63 @@ jobs: echo "$files" >> $GITHUB_OUTPUT echo "EOF" >> $GITHUB_OUTPUT - - name: Prepare Sanitized Markdown Files (PR) + - name: Run Initial Lychee Check (PR) if: github.event_name == 'pull_request' && steps.changed-files.outputs.md_files != '' + uses: lycheeverse/lychee-action@v2.4.1 + with: + args: > + --verbose --no-progress --exclude-mail --exclude ^https?:// + --output lychee/initial.out + ${{ steps.changed-files.outputs.md_files }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract Markdown Files with Broken Links + if: github.event_name == 'pull_request' + id: affected-md run: | - rsync -av --exclude '.git' --exclude 'node_modules' ./ sanitized_md/ - for file in ${{ steps.changed-files.outputs.md_files }}; do - if [ -f "sanitized_md/$file" ]; then - sed -i -e 's///g' -e '//d' "sanitized_md/$file" - fi + mkdir -p sanitized_md + # Extract only .md file paths from the lychee output + affected=$(grep -E 'file://.*\.md' lychee/initial.out | cut -d' ' -f1 | sed 's|file://||' | sort -u) + echo "$affected" + echo "affected_files<> $GITHUB_OUTPUT + echo "$affected" >> $GITHUB_OUTPUT + echo "EOF" >> $GITHUB_OUTPUT + + - name: Strip HTML Comments from Affected Markdown Files Only + if: steps.affected-md.outputs.affected_files != '' + run: | + for file in ${{ steps.affected-md.outputs.affected_files }}; do + target="sanitized_md/$file" + mkdir -p "$(dirname "$target")" + # Copy the file and strip only comments + perl -0777 -pe 's///gs' "$file" > "$target" done - - name: Run Lychee on Changed Markdown Files (PR) - if: github.event_name == 'pull_request' && steps.changed-files.outputs.md_files != '' + - name: Rerun Lychee on Cleaned Files + if: steps.affected-md.outputs.affected_files != '' uses: lycheeverse/lychee-action@v2.4.1 with: args: > - --verbose --no-progress --exclude-mail - --exclude ^https?:// - sanitized_md/${{ steps.changed-files.outputs.md_files }} + --verbose --no-progress --exclude-mail --exclude ^https?:// + sanitized_md/**/*.md env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Prepare Sanitized Markdown Files (Manual) + - name: Full Repo Scan (Manual) if: github.event_name == 'workflow_dispatch' run: | + mkdir -p sanitized_md rsync -av --exclude '.git' --exclude 'node_modules' ./ sanitized_md/ find sanitized_md -name "*.md" -exec perl -0777 -i -pe 's///gs' {} + - - name: Run Lychee on Entire Repo (Manual) if: github.event_name == 'workflow_dispatch' uses: lycheeverse/lychee-action@v2.4.1 with: args: > - --verbose --no-progress --exclude-mail - --exclude ^https?:// - 'sanitized_md/**/*.md' - output: lychee/out.md + --verbose --no-progress --exclude-mail --exclude ^https?:// + sanitized_md/**/*.md + output: lychee/full.out env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 64e0586e51bb7b94e0b46f619c5c5817e98a419a Mon Sep 17 00:00:00 2001 From: Vamshi-Microsoft Date: Tue, 24 Jun 2025 02:01:16 +0530 Subject: [PATCH 41/57] Update Broken-links-checker-final.yml --- .../workflows/Broken-links-checker-final.yml | 74 +++++++++++++------ 1 file changed, 51 insertions(+), 23 deletions(-) diff --git a/.github/workflows/Broken-links-checker-final.yml b/.github/workflows/Broken-links-checker-final.yml index bc9ac9a58..d9a2f172d 100644 --- a/.github/workflows/Broken-links-checker-final.yml +++ b/.github/workflows/Broken-links-checker-final.yml @@ -12,12 +12,13 @@ jobs: runs-on: ubuntu-latest steps: - - name: Checkout Repo + - name: Checkout Repository uses: actions/checkout@v4 with: fetch-depth: 0 - - name: Get Changed Markdown Files (PR only) + # === PR MODE === + - name: Get Changed Markdown Files (PR) id: changed-files if: github.event_name == 'pull_request' run: | @@ -27,41 +28,41 @@ jobs: echo "$files" >> $GITHUB_OUTPUT echo "EOF" >> $GITHUB_OUTPUT - - name: Run Initial Lychee Check (PR) + - name: Run Lychee on Changed Markdown Files (PR) if: github.event_name == 'pull_request' && steps.changed-files.outputs.md_files != '' uses: lycheeverse/lychee-action@v2.4.1 with: args: > --verbose --no-progress --exclude-mail --exclude ^https?:// - --output lychee/initial.out + --output lychee/pr.out ${{ steps.changed-files.outputs.md_files }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Extract Markdown Files with Broken Links + - name: Extract Affected Markdown Files (PR) if: github.event_name == 'pull_request' - id: affected-md + id: affected-pr run: | mkdir -p sanitized_md - # Extract only .md file paths from the lychee output - affected=$(grep -E 'file://.*\.md' lychee/initial.out | cut -d' ' -f1 | sed 's|file://||' | sort -u) + affected=$(grep -Eo 'file://[^ ]+\.md' lychee/pr.out | sed 's|file://||' | sort -u) echo "$affected" echo "affected_files<> $GITHUB_OUTPUT echo "$affected" >> $GITHUB_OUTPUT echo "EOF" >> $GITHUB_OUTPUT - - name: Strip HTML Comments from Affected Markdown Files Only - if: steps.affected-md.outputs.affected_files != '' + - name: Strip HTML Comments from Affected Files (PR) + if: steps.affected-pr.outputs.affected_files != '' run: | - for file in ${{ steps.affected-md.outputs.affected_files }}; do - target="sanitized_md/$file" - mkdir -p "$(dirname "$target")" - # Copy the file and strip only comments - perl -0777 -pe 's///gs' "$file" > "$target" + echo "${{ steps.affected-pr.outputs.affected_files }}" | while read file; do + if [ -f "$file" ]; then + target="sanitized_md/$file" + mkdir -p "$(dirname "$target")" + perl -0777 -pe 's///gs' "$file" > "$target" + fi done - - name: Rerun Lychee on Cleaned Files - if: steps.affected-md.outputs.affected_files != '' + - name: Re-check Sanitized Affected Files (PR) + if: steps.affected-pr.outputs.affected_files != '' uses: lycheeverse/lychee-action@v2.4.1 with: args: > @@ -70,20 +71,47 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Full Repo Scan (Manual) + # === MANUAL MODE === + - name: Run Lychee on Entire Repo (Manual) + if: github.event_name == 'workflow_dispatch' + uses: lycheeverse/lychee-action@v2.4.1 + with: + args: > + --verbose --no-progress --exclude-mail --exclude ^https?:// + --output lychee/manual.out + '**/*.md' + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract Affected Markdown Files (Manual) if: github.event_name == 'workflow_dispatch' + id: affected-manual run: | mkdir -p sanitized_md - rsync -av --exclude '.git' --exclude 'node_modules' ./ sanitized_md/ - find sanitized_md -name "*.md" -exec perl -0777 -i -pe 's///gs' {} + + affected=$(grep -Eo 'file://[^ ]+\.md' lychee/manual.out | sed 's|file://||' | sort -u) + echo "$affected" + echo "affected_files<> $GITHUB_OUTPUT + echo "$affected" >> $GITHUB_OUTPUT + echo "EOF" >> $GITHUB_OUTPUT - - name: Run Lychee on Entire Repo (Manual) - if: github.event_name == 'workflow_dispatch' + - name: Strip HTML Comments from Affected Files (Manual) + if: steps.affected-manual.outputs.affected_files != '' + run: | + echo "${{ steps.affected-manual.outputs.affected_files }}" | while read file; do + if [ -f "$file" ]; then + target="sanitized_md/$file" + mkdir -p "$(dirname "$target")" + perl -0777 -pe 's///gs' "$file" > "$target" + fi + done + + - name: Re-check Sanitized Affected Files (Manual) + if: steps.affected-manual.outputs.affected_files != '' uses: lycheeverse/lychee-action@v2.4.1 with: args: > --verbose --no-progress --exclude-mail --exclude ^https?:// sanitized_md/**/*.md - output: lychee/full.out + output: lychee/manual-cleaned.out env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 26343ad66627256a0a0656266de49cabe874bfb2 Mon Sep 17 00:00:00 2001 From: Vamshi-Microsoft Date: Tue, 24 Jun 2025 02:02:47 +0530 Subject: [PATCH 42/57] Update Broken-links-checker-final.yml --- .github/workflows/Broken-links-checker-final.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/Broken-links-checker-final.yml b/.github/workflows/Broken-links-checker-final.yml index d9a2f172d..c63adab7e 100644 --- a/.github/workflows/Broken-links-checker-final.yml +++ b/.github/workflows/Broken-links-checker-final.yml @@ -112,6 +112,6 @@ jobs: args: > --verbose --no-progress --exclude-mail --exclude ^https?:// sanitized_md/**/*.md - output: lychee/manual-cleaned.out env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + From 7f41f8deac728f293c654dd09debed50c047f86a Mon Sep 17 00:00:00 2001 From: Vamshi-Microsoft Date: Tue, 24 Jun 2025 02:05:02 +0530 Subject: [PATCH 43/57] Update Broken-links-checker-final.yml --- .../workflows/Broken-links-checker-final.yml | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/.github/workflows/Broken-links-checker-final.yml b/.github/workflows/Broken-links-checker-final.yml index c63adab7e..dfdae2617 100644 --- a/.github/workflows/Broken-links-checker-final.yml +++ b/.github/workflows/Broken-links-checker-final.yml @@ -28,12 +28,13 @@ jobs: echo "$files" >> $GITHUB_OUTPUT echo "EOF" >> $GITHUB_OUTPUT - - name: Run Lychee on Changed Markdown Files (PR) + - name: Run Lychee on Changed Files (PR) if: github.event_name == 'pull_request' && steps.changed-files.outputs.md_files != '' uses: lycheeverse/lychee-action@v2.4.1 with: args: > - --verbose --no-progress --exclude-mail --exclude ^https?:// + --verbose --no-progress --exclude-mail + --exclude ^https?:// --output lychee/pr.out ${{ steps.changed-files.outputs.md_files }} env: @@ -66,7 +67,8 @@ jobs: uses: lycheeverse/lychee-action@v2.4.1 with: args: > - --verbose --no-progress --exclude-mail --exclude ^https?:// + --verbose --no-progress --exclude-mail + --exclude ^https?:// sanitized_md/**/*.md env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -77,7 +79,8 @@ jobs: uses: lycheeverse/lychee-action@v2.4.1 with: args: > - --verbose --no-progress --exclude-mail --exclude ^https?:// + --verbose --no-progress --exclude-mail + --exclude ^https?:// --output lychee/manual.out '**/*.md' env: @@ -105,13 +108,14 @@ jobs: fi done - - name: Re-check Sanitized Affected Files (Manual) + - name: Re-run Lychee on Sanitized Affected Files (Manual) if: steps.affected-manual.outputs.affected_files != '' uses: lycheeverse/lychee-action@v2.4.1 with: args: > - --verbose --no-progress --exclude-mail --exclude ^https?:// + --verbose --no-progress --exclude-mail + --exclude ^https?:// + --output lychee/manual-cleaned.out sanitized_md/**/*.md env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - From 7369b43a07211bc517cd6e87ed97e6ef5ca7ef1d Mon Sep 17 00:00:00 2001 From: Vamshi-Microsoft Date: Tue, 24 Jun 2025 02:07:34 +0530 Subject: [PATCH 44/57] Update Broken-links-checker-final.yml --- .../workflows/Broken-links-checker-final.yml | 31 ++++++++----------- 1 file changed, 13 insertions(+), 18 deletions(-) diff --git a/.github/workflows/Broken-links-checker-final.yml b/.github/workflows/Broken-links-checker-final.yml index dfdae2617..98d0d880d 100644 --- a/.github/workflows/Broken-links-checker-final.yml +++ b/.github/workflows/Broken-links-checker-final.yml @@ -28,19 +28,18 @@ jobs: echo "$files" >> $GITHUB_OUTPUT echo "EOF" >> $GITHUB_OUTPUT - - name: Run Lychee on Changed Files (PR) + - name: Initial Lychee Check on Changed Files (PR) if: github.event_name == 'pull_request' && steps.changed-files.outputs.md_files != '' uses: lycheeverse/lychee-action@v2.4.1 with: + output: lychee/pr.out args: > - --verbose --no-progress --exclude-mail - --exclude ^https?:// - --output lychee/pr.out + --verbose --no-progress --exclude-mail --exclude '^https?://' ${{ steps.changed-files.outputs.md_files }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Extract Affected Markdown Files (PR) + - name: Extract Affected Files (PR) if: github.event_name == 'pull_request' id: affected-pr run: | @@ -54,7 +53,7 @@ jobs: - name: Strip HTML Comments from Affected Files (PR) if: steps.affected-pr.outputs.affected_files != '' run: | - echo "${{ steps.affected-pr.outputs.affected_files }}" | while read file; do + echo "${{ steps.affected-pr.outputs.affected_files }}" | while read -r file; do if [ -f "$file" ]; then target="sanitized_md/$file" mkdir -p "$(dirname "$target")" @@ -67,26 +66,24 @@ jobs: uses: lycheeverse/lychee-action@v2.4.1 with: args: > - --verbose --no-progress --exclude-mail - --exclude ^https?:// + --verbose --no-progress --exclude-mail --exclude '^https?://' sanitized_md/**/*.md env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # === MANUAL MODE === - - name: Run Lychee on Entire Repo (Manual) + - name: Initial Lychee Check on All Markdown (Manual) if: github.event_name == 'workflow_dispatch' uses: lycheeverse/lychee-action@v2.4.1 with: + output: lychee/manual.out args: > - --verbose --no-progress --exclude-mail - --exclude ^https?:// - --output lychee/manual.out + --verbose --no-progress --exclude-mail --exclude '^https?://' '**/*.md' env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Extract Affected Markdown Files (Manual) + - name: Extract Affected Files (Manual) if: github.event_name == 'workflow_dispatch' id: affected-manual run: | @@ -100,7 +97,7 @@ jobs: - name: Strip HTML Comments from Affected Files (Manual) if: steps.affected-manual.outputs.affected_files != '' run: | - echo "${{ steps.affected-manual.outputs.affected_files }}" | while read file; do + echo "${{ steps.affected-manual.outputs.affected_files }}" | while read -r file; do if [ -f "$file" ]; then target="sanitized_md/$file" mkdir -p "$(dirname "$target")" @@ -108,14 +105,12 @@ jobs: fi done - - name: Re-run Lychee on Sanitized Affected Files (Manual) + - name: Re-check Sanitized Affected Files (Manual) if: steps.affected-manual.outputs.affected_files != '' uses: lycheeverse/lychee-action@v2.4.1 with: args: > - --verbose --no-progress --exclude-mail - --exclude ^https?:// - --output lychee/manual-cleaned.out + --verbose --no-progress --exclude-mail --exclude '^https?://' sanitized_md/**/*.md env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 368c4ea3f850a63270868b3840c73d83273aacda Mon Sep 17 00:00:00 2001 From: Vamshi-Microsoft Date: Tue, 24 Jun 2025 02:10:34 +0530 Subject: [PATCH 45/57] Update Broken-links-checker-final.yml --- .../workflows/Broken-links-checker-final.yml | 59 +++++++++++-------- 1 file changed, 34 insertions(+), 25 deletions(-) diff --git a/.github/workflows/Broken-links-checker-final.yml b/.github/workflows/Broken-links-checker-final.yml index 98d0d880d..c8f01510f 100644 --- a/.github/workflows/Broken-links-checker-final.yml +++ b/.github/workflows/Broken-links-checker-final.yml @@ -12,22 +12,28 @@ jobs: runs-on: ubuntu-latest steps: - - name: Checkout Repository + - name: Checkout Repo uses: actions/checkout@v4 with: fetch-depth: 0 - # === PR MODE === + - name: Mirror Repo to sanitized_md/ + run: | + rsync -av --exclude '.git' --exclude 'node_modules' ./ sanitized_md/ + + # ‣ PR: get only changed .md files - name: Get Changed Markdown Files (PR) id: changed-files if: github.event_name == 'pull_request' run: | git fetch origin ${{ github.base_ref }} - files=$(git diff --name-only origin/${{ github.base_ref }}...HEAD | grep '\.md$' || true) + files=$(git diff --name-only origin/${{ github.base_ref }}...HEAD \ + | grep '\.md$' || true) echo "md_files<> $GITHUB_OUTPUT echo "$files" >> $GITHUB_OUTPUT echo "EOF" >> $GITHUB_OUTPUT + # ‣ PR: initial Lychee run - name: Initial Lychee Check on Changed Files (PR) if: github.event_name == 'pull_request' && steps.changed-files.outputs.md_files != '' uses: lycheeverse/lychee-action@v2.4.1 @@ -39,28 +45,31 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # ‣ PR: extract only the .md files with errors - name: Extract Affected Files (PR) if: github.event_name == 'pull_request' id: affected-pr run: | mkdir -p sanitized_md - affected=$(grep -Eo 'file://[^ ]+\.md' lychee/pr.out | sed 's|file://||' | sort -u) - echo "$affected" + grep -Eo 'file://[^ ]+\.md' lychee/pr.out \ + | sed 's|file://||' \ + | sort -u \ + | tee affected.txt echo "affected_files<> $GITHUB_OUTPUT - echo "$affected" >> $GITHUB_OUTPUT + cat affected.txt >> $GITHUB_OUTPUT echo "EOF" >> $GITHUB_OUTPUT + # ‣ PR: strip comments **in the copies** - name: Strip HTML Comments from Affected Files (PR) if: steps.affected-pr.outputs.affected_files != '' run: | - echo "${{ steps.affected-pr.outputs.affected_files }}" | while read -r file; do - if [ -f "$file" ]; then - target="sanitized_md/$file" - mkdir -p "$(dirname "$target")" - perl -0777 -pe 's///gs' "$file" > "$target" - fi - done + while read -r file; do + src="sanitized_md/$file" + perl -0777 -pe 's///gs' "$src" > "$src.tmp" \ + && mv "$src.tmp" "$src" + done < affected.txt + # ‣ PR: **re-run** Lychee on the **sanitized** files - name: Re-check Sanitized Affected Files (PR) if: steps.affected-pr.outputs.affected_files != '' uses: lycheeverse/lychee-action@v2.4.1 @@ -71,7 +80,7 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # === MANUAL MODE === + # --- Manual Dispatch: same two-pass logic --- - name: Initial Lychee Check on All Markdown (Manual) if: github.event_name == 'workflow_dispatch' uses: lycheeverse/lychee-action@v2.4.1 @@ -88,22 +97,22 @@ jobs: id: affected-manual run: | mkdir -p sanitized_md - affected=$(grep -Eo 'file://[^ ]+\.md' lychee/manual.out | sed 's|file://||' | sort -u) - echo "$affected" + grep -Eo 'file://[^ ]+\.md' lychee/manual.out \ + | sed 's|file://||' \ + | sort -u \ + | tee affected-manual.txt echo "affected_files<> $GITHUB_OUTPUT - echo "$affected" >> $GITHUB_OUTPUT + cat affected-manual.txt >> $GITHUB_OUTPUT echo "EOF" >> $GITHUB_OUTPUT - - name: Strip HTML Comments from Affected Files (Manual) + - name: Strip HTML Comments (Manual) if: steps.affected-manual.outputs.affected_files != '' run: | - echo "${{ steps.affected-manual.outputs.affected_files }}" | while read -r file; do - if [ -f "$file" ]; then - target="sanitized_md/$file" - mkdir -p "$(dirname "$target")" - perl -0777 -pe 's///gs' "$file" > "$target" - fi - done + while read -r file; do + src="sanitized_md/$file" + perl -0777 -pe 's///gs' "$src" > "$src.tmp" \ + && mv "$src.tmp" "$src" + done < affected-manual.txt - name: Re-check Sanitized Affected Files (Manual) if: steps.affected-manual.outputs.affected_files != '' From f525e0d6276f90120089fd11d325145602f9d22e Mon Sep 17 00:00:00 2001 From: Vamshi-Microsoft Date: Tue, 24 Jun 2025 09:58:20 +0530 Subject: [PATCH 46/57] Update Broken-links-checker-final.yml --- .../workflows/Broken-links-checker-final.yml | 104 ++++-------------- 1 file changed, 23 insertions(+), 81 deletions(-) diff --git a/.github/workflows/Broken-links-checker-final.yml b/.github/workflows/Broken-links-checker-final.yml index c8f01510f..83e22df2c 100644 --- a/.github/workflows/Broken-links-checker-final.yml +++ b/.github/workflows/Broken-links-checker-final.yml @@ -6,6 +6,9 @@ on: - '**/*.md' workflow_dispatch: +permissions: + contents: read + jobs: markdown-link-check: name: Check Markdown Broken Links @@ -17,109 +20,48 @@ jobs: with: fetch-depth: 0 - - name: Mirror Repo to sanitized_md/ - run: | - rsync -av --exclude '.git' --exclude 'node_modules' ./ sanitized_md/ - - # ‣ PR: get only changed .md files - - name: Get Changed Markdown Files (PR) + - name: Get Added/Modified Markdown Files (PR only) id: changed-files if: github.event_name == 'pull_request' run: | git fetch origin ${{ github.base_ref }} - files=$(git diff --name-only origin/${{ github.base_ref }}...HEAD \ - | grep '\.md$' || true) + files=$(git diff --name-only origin/${{ github.base_ref }}...HEAD | grep '\.md$' || true) echo "md_files<> $GITHUB_OUTPUT echo "$files" >> $GITHUB_OUTPUT echo "EOF" >> $GITHUB_OUTPUT - # ‣ PR: initial Lychee run - - name: Initial Lychee Check on Changed Files (PR) + - name: Strip HTML comments from markdown if: github.event_name == 'pull_request' && steps.changed-files.outputs.md_files != '' - uses: lycheeverse/lychee-action@v2.4.1 - with: - output: lychee/pr.out - args: > - --verbose --no-progress --exclude-mail --exclude '^https?://' - ${{ steps.changed-files.outputs.md_files }} - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - # ‣ PR: extract only the .md files with errors - - name: Extract Affected Files (PR) - if: github.event_name == 'pull_request' - id: affected-pr run: | - mkdir -p sanitized_md - grep -Eo 'file://[^ ]+\.md' lychee/pr.out \ - | sed 's|file://||' \ - | sort -u \ - | tee affected.txt - echo "affected_files<> $GITHUB_OUTPUT - cat affected.txt >> $GITHUB_OUTPUT - echo "EOF" >> $GITHUB_OUTPUT + for file in ${{ steps.changed-files.outputs.md_files }}; do + # Remove all HTML comments (multi-line aware) in-place + sed -z -i 's///g' "$file" + done - # ‣ PR: strip comments **in the copies** - - name: Strip HTML Comments from Affected Files (PR) - if: steps.affected-pr.outputs.affected_files != '' - run: | - while read -r file; do - src="sanitized_md/$file" - perl -0777 -pe 's///gs' "$src" > "$src.tmp" \ - && mv "$src.tmp" "$src" - done < affected.txt - - # ‣ PR: **re-run** Lychee on the **sanitized** files - - name: Re-check Sanitized Affected Files (PR) - if: steps.affected-pr.outputs.affected_files != '' - uses: lycheeverse/lychee-action@v2.4.1 - with: - args: > - --verbose --no-progress --exclude-mail --exclude '^https?://' - sanitized_md/**/*.md - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - # --- Manual Dispatch: same two-pass logic --- - - name: Initial Lychee Check on All Markdown (Manual) - if: github.event_name == 'workflow_dispatch' + - name: Check Broken Links in Added/Modified Files (PR) + if: github.event_name == 'pull_request' && steps.changed-files.outputs.md_files != '' uses: lycheeverse/lychee-action@v2.4.1 with: - output: lychee/manual.out args: > - --verbose --no-progress --exclude-mail --exclude '^https?://' - '**/*.md' + --verbose --exclude-mail --no-progress --exclude ^https?:// + ${{ steps.changed-files.outputs.md_files }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Extract Affected Files (Manual) + - name: Strip HTML comments (manual run) if: github.event_name == 'workflow_dispatch' - id: affected-manual run: | - mkdir -p sanitized_md - grep -Eo 'file://[^ ]+\.md' lychee/manual.out \ - | sed 's|file://||' \ - | sort -u \ - | tee affected-manual.txt - echo "affected_files<> $GITHUB_OUTPUT - cat affected-manual.txt >> $GITHUB_OUTPUT - echo "EOF" >> $GITHUB_OUTPUT + for file in **/*.md; do + sed -z -i 's///g' "$file" + done - - name: Strip HTML Comments (Manual) - if: steps.affected-manual.outputs.affected_files != '' - run: | - while read -r file; do - src="sanitized_md/$file" - perl -0777 -pe 's///gs' "$src" > "$src.tmp" \ - && mv "$src.tmp" "$src" - done < affected-manual.txt - - - name: Re-check Sanitized Affected Files (Manual) - if: steps.affected-manual.outputs.affected_files != '' + - name: Check Broken Links in Entire Repo (Manual) + if: github.event_name == 'workflow_dispatch' uses: lycheeverse/lychee-action@v2.4.1 with: args: > - --verbose --no-progress --exclude-mail --exclude '^https?://' - sanitized_md/**/*.md + --verbose --exclude-mail --no-progress --exclude ^https?:// + '**/*.md' + output: lychee/out.md env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From fc7b1755c130f508180b2a04ca5550ad6259adde Mon Sep 17 00:00:00 2001 From: Vamshi-Microsoft Date: Tue, 24 Jun 2025 10:01:16 +0530 Subject: [PATCH 47/57] Update Broken-links-checker-final.yml --- .../workflows/Broken-links-checker-final.yml | 69 +++++++++++++++---- 1 file changed, 57 insertions(+), 12 deletions(-) diff --git a/.github/workflows/Broken-links-checker-final.yml b/.github/workflows/Broken-links-checker-final.yml index 83e22df2c..d8e3f3299 100644 --- a/.github/workflows/Broken-links-checker-final.yml +++ b/.github/workflows/Broken-links-checker-final.yml @@ -20,8 +20,8 @@ jobs: with: fetch-depth: 0 - - name: Get Added/Modified Markdown Files (PR only) - id: changed-files + - name: Get Added/Modified Markdown Files + id: changed if: github.event_name == 'pull_request' run: | git fetch origin ${{ github.base_ref }} @@ -30,21 +30,43 @@ jobs: echo "$files" >> $GITHUB_OUTPUT echo "EOF" >> $GITHUB_OUTPUT - - name: Strip HTML comments from markdown - if: github.event_name == 'pull_request' && steps.changed-files.outputs.md_files != '' + - name: Strip HTML comments from Markdown + if: github.event_name == 'pull_request' && steps.changed.outputs.md_files != '' run: | - for file in ${{ steps.changed-files.outputs.md_files }}; do - # Remove all HTML comments (multi-line aware) in-place - sed -z -i 's///g' "$file" + for file in ${{ steps.changed.outputs.md_files }}; do + awk -v FS="" ' + BEGIN { in_comment = 0 } + { + if (in_comment) { + if (match($0, /-->/)) { + $0 = substr($0, RSTART + RLENGTH) + in_comment = 0 + } else { next } + } + while (match($0, //)) { + rest = substr(rest, RSTART + RLENGTH) + $0 = prefix rest + } else { + $0 = prefix + in_comment = 1 + break + } + } + print + } + ' "$file" > tmp && mv tmp "$file" done - - name: Check Broken Links in Added/Modified Files (PR) - if: github.event_name == 'pull_request' && steps.changed-files.outputs.md_files != '' + - name: Check Broken Links in Added/Modified Files + if: github.event_name == 'pull_request' && steps.changed.outputs.md_files != '' uses: lycheeverse/lychee-action@v2.4.1 with: args: > --verbose --exclude-mail --no-progress --exclude ^https?:// - ${{ steps.changed-files.outputs.md_files }} + ${{ steps.changed.outputs.md_files }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -52,10 +74,33 @@ jobs: if: github.event_name == 'workflow_dispatch' run: | for file in **/*.md; do - sed -z -i 's///g' "$file" + awk -v FS="" ' + BEGIN { in_comment = 0 } + { + if (in_comment) { + if (match($0, /-->/)) { + $0 = substr($0, RSTART + RLENGTH) + in_comment = 0 + } else { next } + } + while (match($0, //)) { + rest = substr(rest, RSTART + RLENGTH) + $0 = prefix rest + } else { + $0 = prefix + in_comment = 1 + break + } + } + print + } + ' "$file" > tmp && mv tmp "$file" done - - name: Check Broken Links in Entire Repo (Manual) + - name: Check Broken Links in Entire Repo if: github.event_name == 'workflow_dispatch' uses: lycheeverse/lychee-action@v2.4.1 with: From 41afa7453324bacb56881bfc12fe203a75e9abd9 Mon Sep 17 00:00:00 2001 From: Vamshi-Microsoft Date: Tue, 24 Jun 2025 10:05:39 +0530 Subject: [PATCH 48/57] Update Broken-links-checker-final.yml --- .../workflows/Broken-links-checker-final.yml | 177 +++++++----------- 1 file changed, 68 insertions(+), 109 deletions(-) diff --git a/.github/workflows/Broken-links-checker-final.yml b/.github/workflows/Broken-links-checker-final.yml index d8e3f3299..3e2168718 100644 --- a/.github/workflows/Broken-links-checker-final.yml +++ b/.github/workflows/Broken-links-checker-final.yml @@ -1,112 +1,71 @@ -name: Broken Link Checker - +name: Broken Link Checker (lychee with comment strip) on: - pull_request: - paths: - - '**/*.md' - workflow_dispatch: - + pull_request: + paths: + - '**/*.md' + workflow_dispatch: permissions: - contents: read - + contents: read jobs: - markdown-link-check: - name: Check Markdown Broken Links - runs-on: ubuntu-latest - - steps: - - name: Checkout Repo - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Get Added/Modified Markdown Files - id: changed - if: github.event_name == 'pull_request' - run: | - git fetch origin ${{ github.base_ref }} - files=$(git diff --name-only origin/${{ github.base_ref }}...HEAD | grep '\.md$' || true) - echo "md_files<> $GITHUB_OUTPUT - echo "$files" >> $GITHUB_OUTPUT - echo "EOF" >> $GITHUB_OUTPUT - - - name: Strip HTML comments from Markdown - if: github.event_name == 'pull_request' && steps.changed.outputs.md_files != '' - run: | - for file in ${{ steps.changed.outputs.md_files }}; do - awk -v FS="" ' - BEGIN { in_comment = 0 } - { - if (in_comment) { - if (match($0, /-->/)) { - $0 = substr($0, RSTART + RLENGTH) - in_comment = 0 - } else { next } - } - while (match($0, //)) { - rest = substr(rest, RSTART + RLENGTH) - $0 = prefix rest - } else { - $0 = prefix - in_comment = 1 - break - } - } - print - } - ' "$file" > tmp && mv tmp "$file" - done - - - name: Check Broken Links in Added/Modified Files - if: github.event_name == 'pull_request' && steps.changed.outputs.md_files != '' - uses: lycheeverse/lychee-action@v2.4.1 - with: - args: > - --verbose --exclude-mail --no-progress --exclude ^https?:// - ${{ steps.changed.outputs.md_files }} - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Strip HTML comments (manual run) - if: github.event_name == 'workflow_dispatch' - run: | - for file in **/*.md; do - awk -v FS="" ' - BEGIN { in_comment = 0 } - { - if (in_comment) { - if (match($0, /-->/)) { - $0 = substr($0, RSTART + RLENGTH) - in_comment = 0 - } else { next } - } - while (match($0, //)) { - rest = substr(rest, RSTART + RLENGTH) - $0 = prefix rest - } else { - $0 = prefix - in_comment = 1 - break - } - } - print - } - ' "$file" > tmp && mv tmp "$file" - done - - - name: Check Broken Links in Entire Repo - if: github.event_name == 'workflow_dispatch' - uses: lycheeverse/lychee-action@v2.4.1 - with: - args: > - --verbose --exclude-mail --no-progress --exclude ^https?:// - '**/*.md' - output: lychee/out.md - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + markdown-link-check: + runs-on: ubuntu-latest + steps: + - name: Checkout Repo + uses: actions/checkout@v4 + - name: Install Python + uses: actions/setup-python@v4 + with: + python-version: '3.x' + - name: Strip HTML comments from changed Markdown files + if: github.event_name == 'pull_request' + id: strip + run: | + echo "cleaned_files=" >> $GITHUB_OUTPUT + for file in ${{ github.event.pull_request.changed_files }}; do + [ "${file##*.}" != "md" ] && continue + python3 - <<'EOF' + import re, sys + path = sys.argv[1] + with open(path, 'r') as f: + content = f.read() + clean = re.sub(r'', '', content, flags=re.DOTALL) + out = path + ".cleaned" + with open(out, 'w') as f: + f.write(clean) + print(out) + EOF + echo "cleaned_files<> $GITHUB_OUTPUT + echo "${file}.cleaned" >> $GITHUB_OUTPUT + echo "EOF" >> $GITHUB_OUTPUT + done + - name: Run lychee on cleaned files + if: github.event_name == 'pull_request' && steps.strip.outputs.cleaned_files != '' + uses: lycheeverse/lychee-action@v2.4.1 + with: + args: > + --verbose --exclude-mail --no-progress --exclude ^https?:// + ${{ steps.strip.outputs.cleaned_files }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Run lychee on all Markdown (manual) + if: github.event_name == 'workflow_dispatch' + run: | + python3 - <<'EOF' + import re, glob + for path in glob.glob('**/*.md', recursive=True): + with open(path) as f: data = f.read() + clean = re.sub(r'', '', data, flags=re.DOTALL) + with open(path + ".cleaned", 'w') as f: f.write(clean) + EOF + echo "::set-output name=all_cleaned::$(echo **/*.md.cleaned)" + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Check all Markdown (manual) + if: github.event_name == 'workflow_dispatch' + uses: lycheeverse/lychee-action@v2.4.1 + with: + args: > + --verbose --exclude-mail --no-progress --exclude ^https?:// + ${{ steps.strip.outputs.all_cleaned }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 7fa1a2f5a7ccf06149ab1bd28e86b7a867f786d8 Mon Sep 17 00:00:00 2001 From: Vamshi-Microsoft Date: Tue, 24 Jun 2025 10:11:18 +0530 Subject: [PATCH 49/57] Update Broken-links-checker-final.yml --- .../workflows/Broken-links-checker-final.yml | 152 ++++++++++-------- 1 file changed, 83 insertions(+), 69 deletions(-) diff --git a/.github/workflows/Broken-links-checker-final.yml b/.github/workflows/Broken-links-checker-final.yml index 3e2168718..853126a19 100644 --- a/.github/workflows/Broken-links-checker-final.yml +++ b/.github/workflows/Broken-links-checker-final.yml @@ -1,71 +1,85 @@ -name: Broken Link Checker (lychee with comment strip) +name: Broken Link Checker + on: - pull_request: - paths: - - '**/*.md' - workflow_dispatch: -permissions: - contents: read + pull_request: + paths: + - '**/*.md' + workflow_dispatch: + jobs: - markdown-link-check: - runs-on: ubuntu-latest - steps: - - name: Checkout Repo - uses: actions/checkout@v4 - - name: Install Python - uses: actions/setup-python@v4 - with: - python-version: '3.x' - - name: Strip HTML comments from changed Markdown files - if: github.event_name == 'pull_request' - id: strip - run: | - echo "cleaned_files=" >> $GITHUB_OUTPUT - for file in ${{ github.event.pull_request.changed_files }}; do - [ "${file##*.}" != "md" ] && continue - python3 - <<'EOF' - import re, sys - path = sys.argv[1] - with open(path, 'r') as f: - content = f.read() - clean = re.sub(r'', '', content, flags=re.DOTALL) - out = path + ".cleaned" - with open(out, 'w') as f: - f.write(clean) - print(out) - EOF - echo "cleaned_files<> $GITHUB_OUTPUT - echo "${file}.cleaned" >> $GITHUB_OUTPUT - echo "EOF" >> $GITHUB_OUTPUT - done - - name: Run lychee on cleaned files - if: github.event_name == 'pull_request' && steps.strip.outputs.cleaned_files != '' - uses: lycheeverse/lychee-action@v2.4.1 - with: - args: > - --verbose --exclude-mail --no-progress --exclude ^https?:// - ${{ steps.strip.outputs.cleaned_files }} - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Run lychee on all Markdown (manual) - if: github.event_name == 'workflow_dispatch' - run: | - python3 - <<'EOF' - import re, glob - for path in glob.glob('**/*.md', recursive=True): - with open(path) as f: data = f.read() - clean = re.sub(r'', '', data, flags=re.DOTALL) - with open(path + ".cleaned", 'w') as f: f.write(clean) - EOF - echo "::set-output name=all_cleaned::$(echo **/*.md.cleaned)" - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Check all Markdown (manual) - if: github.event_name == 'workflow_dispatch' - uses: lycheeverse/lychee-action@v2.4.1 - with: - args: > - --verbose --exclude-mail --no-progress --exclude ^https?:// - ${{ steps.strip.outputs.all_cleaned }} - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + markdown-link-check: + name: Check Markdown Broken Links + runs-on: ubuntu-latest + + steps: + - name: Checkout Repo + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Get Changed Markdown Files (PR only) + id: changed-files + if: github.event_name == 'pull_request' + run: | + git fetch origin ${{ github.base_ref }} + files=$(git diff --name-only origin/${{ github.base_ref }}...HEAD | grep '\.md$' || true) + echo "md_files<> $GITHUB_OUTPUT + echo "$files" >> $GITHUB_OUTPUT + echo "EOF" >> $GITHUB_OUTPUT + - name: Run Initial Lychee Check (PR) + if: github.event_name == 'pull_request' && steps.changed-files.outputs.md_files != '' + uses: lycheeverse/lychee-action@v2.4.1 + with: + args: > + --verbose --no-progress --exclude-mail --exclude ^https?:// + --output lychee/initial.out + ${{ steps.changed-files.outputs.md_files }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract Markdown Files with Broken Links + if: github.event_name == 'pull_request' + id: affected-md + run: | + mkdir -p sanitized_md + # Extract only .md file paths from the lychee output + affected=$(grep -E 'file://.*\.md' lychee/initial.out | cut -d' ' -f1 | sed 's|file://||' | sort -u) + echo "$affected" + echo "affected_files<> $GITHUB_OUTPUT + echo "$affected" >> $GITHUB_OUTPUT + echo "EOF" >> $GITHUB_OUTPUT + - name: Strip HTML Comments from Affected Markdown Files Only + if: steps.affected-md.outputs.affected_files != '' + run: | + for file in ${{ steps.affected-md.outputs.affected_files }}; do + target="sanitized_md/$file" + mkdir -p "$(dirname "$target")" + # Copy the file and strip only comments + perl -0777 -pe 's///gs' "$file" > "$target" + done + - name: Rerun Lychee on Cleaned Files + if: steps.affected-md.outputs.affected_files != '' + uses: lycheeverse/lychee-action@v2.4.1 + with: + args: > + --verbose --no-progress --exclude-mail --exclude ^https?:// + sanitized_md/**/*.md + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Full Repo Scan (Manual) + if: github.event_name == 'workflow_dispatch' + run: | + mkdir -p sanitized_md + rsync -av --exclude '.git' --exclude 'node_modules' ./ sanitized_md/ + find sanitized_md -name "*.md" -exec perl -0777 -i -pe 's///gs' {} + + - name: Run Lychee on Entire Repo (Manual) + if: github.event_name == 'workflow_dispatch' + uses: lycheeverse/lychee-action@v2.4.1 + with: + args: > + --verbose --no-progress --exclude-mail --exclude ^https?:// + sanitized_md/**/*.md + output: lychee/full.out + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From e31a57fe2a4bf473879fb578705646e9500fea84 Mon Sep 17 00:00:00 2001 From: Vamshi-Microsoft Date: Tue, 24 Jun 2025 10:16:38 +0530 Subject: [PATCH 50/57] Update Broken-links-checker-final.yml --- .github/workflows/Broken-links-checker-final.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/Broken-links-checker-final.yml b/.github/workflows/Broken-links-checker-final.yml index 853126a19..909589aa2 100644 --- a/.github/workflows/Broken-links-checker-final.yml +++ b/.github/workflows/Broken-links-checker-final.yml @@ -78,7 +78,7 @@ jobs: uses: lycheeverse/lychee-action@v2.4.1 with: args: > - --verbose --no-progress --exclude-mail --exclude ^https?:// + --verbose --no-progress --exclude-mail --exclude ^https?:// --include-file sanitized_md/**/*.md output: lychee/full.out env: From 0f7116cc88a5b8a6d85455c56536054890c1efc4 Mon Sep 17 00:00:00 2001 From: Vamshi-Microsoft Date: Tue, 24 Jun 2025 10:29:58 +0530 Subject: [PATCH 51/57] Update Broken-links-checker-final.yml --- .../workflows/Broken-links-checker-final.yml | 61 ++++++------------- 1 file changed, 18 insertions(+), 43 deletions(-) diff --git a/.github/workflows/Broken-links-checker-final.yml b/.github/workflows/Broken-links-checker-final.yml index 909589aa2..78900f544 100644 --- a/.github/workflows/Broken-links-checker-final.yml +++ b/.github/workflows/Broken-links-checker-final.yml @@ -6,6 +6,9 @@ on: - '**/*.md' workflow_dispatch: +permissions: + contents: read + jobs: markdown-link-check: name: Check Markdown Broken Links @@ -17,7 +20,7 @@ jobs: with: fetch-depth: 0 - - name: Get Changed Markdown Files (PR only) + - name: Get Added/Modified Markdown Files (PR only) id: changed-files if: github.event_name == 'pull_request' run: | @@ -26,60 +29,32 @@ jobs: echo "md_files<> $GITHUB_OUTPUT echo "$files" >> $GITHUB_OUTPUT echo "EOF" >> $GITHUB_OUTPUT - - name: Run Initial Lychee Check (PR) + - name: Check Broken Links in Added/Modified Files (PR) if: github.event_name == 'pull_request' && steps.changed-files.outputs.md_files != '' uses: lycheeverse/lychee-action@v2.4.1 with: args: > - --verbose --no-progress --exclude-mail --exclude ^https?:// - --output lychee/initial.out + --verbose --exclude-mail --no-progress --exclude ^https?:// ${{ steps.changed-files.outputs.md_files }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Extract Markdown Files with Broken Links - if: github.event_name == 'pull_request' - id: affected-md - run: | - mkdir -p sanitized_md - # Extract only .md file paths from the lychee output - affected=$(grep -E 'file://.*\.md' lychee/initial.out | cut -d' ' -f1 | sed 's|file://||' | sort -u) - echo "$affected" - echo "affected_files<> $GITHUB_OUTPUT - echo "$affected" >> $GITHUB_OUTPUT - echo "EOF" >> $GITHUB_OUTPUT - - name: Strip HTML Comments from Affected Markdown Files Only - if: steps.affected-md.outputs.affected_files != '' - run: | - for file in ${{ steps.affected-md.outputs.affected_files }}; do - target="sanitized_md/$file" - mkdir -p "$(dirname "$target")" - # Copy the file and strip only comments - perl -0777 -pe 's///gs' "$file" > "$target" - done - - name: Rerun Lychee on Cleaned Files - if: steps.affected-md.outputs.affected_files != '' - uses: lycheeverse/lychee-action@v2.4.1 - with: - args: > - --verbose --no-progress --exclude-mail --exclude ^https?:// - sanitized_md/**/*.md - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Full Repo Scan (Manual) + + - name: Preprocess All Markdown Files (strip comments) if: github.event_name == 'workflow_dispatch' run: | - mkdir -p sanitized_md - rsync -av --exclude '.git' --exclude 'node_modules' ./ sanitized_md/ - find sanitized_md -name "*.md" -exec perl -0777 -i -pe 's///gs' {} + - - name: Run Lychee on Entire Repo (Manual) + mkdir -p cleaned_md + find . -name "*.md" ! -path "./cleaned_md/*" | while read file; do + mkdir -p "cleaned_md/$(dirname "$file")" + sed -E '//d' "$file" > "cleaned_md/$file" + done + + - name: Check Broken Links in Entire Repo (Manual) if: github.event_name == 'workflow_dispatch' uses: lycheeverse/lychee-action@v2.4.1 with: args: > - --verbose --no-progress --exclude-mail --exclude ^https?:// --include-file - sanitized_md/**/*.md - output: lychee/full.out + --verbose --exclude-mail --no-progress --exclude ^https?:// + cleaned_md/**/*.md + output: lychee/out.md env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From eac4c9fd1093d9da28259be234882ad8f5f7f6f2 Mon Sep 17 00:00:00 2001 From: Vamshi-Microsoft Date: Tue, 24 Jun 2025 10:46:49 +0530 Subject: [PATCH 52/57] Update Broken-links-checker-final.yml --- .../workflows/Broken-links-checker-final.yml | 120 ++++++++++++------ 1 file changed, 81 insertions(+), 39 deletions(-) diff --git a/.github/workflows/Broken-links-checker-final.yml b/.github/workflows/Broken-links-checker-final.yml index 78900f544..fc6459646 100644 --- a/.github/workflows/Broken-links-checker-final.yml +++ b/.github/workflows/Broken-links-checker-final.yml @@ -1,4 +1,4 @@ -name: Broken Link Checker +name: Smart Broken Link Checker on: pull_request: @@ -10,51 +10,93 @@ permissions: contents: read jobs: - markdown-link-check: - name: Check Markdown Broken Links + smart-link-check: + name: Filtered Markdown Broken Links runs-on: ubuntu-latest steps: - - name: Checkout Repo + - name: Checkout Repository uses: actions/checkout@v4 with: fetch-depth: 0 - - name: Get Added/Modified Markdown Files (PR only) - id: changed-files - if: github.event_name == 'pull_request' + - name: Install lychee run: | - git fetch origin ${{ github.base_ref }} - files=$(git diff --name-only origin/${{ github.base_ref }}...HEAD | grep '\.md$' || true) - echo "md_files<> $GITHUB_OUTPUT - echo "$files" >> $GITHUB_OUTPUT - echo "EOF" >> $GITHUB_OUTPUT - - name: Check Broken Links in Added/Modified Files (PR) - if: github.event_name == 'pull_request' && steps.changed-files.outputs.md_files != '' - uses: lycheeverse/lychee-action@v2.4.1 - with: - args: > - --verbose --exclude-mail --no-progress --exclude ^https?:// - ${{ steps.changed-files.outputs.md_files }} - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Preprocess All Markdown Files (strip comments) - if: github.event_name == 'workflow_dispatch' + curl -Ls https://github.com/lycheeverse/lychee/releases/latest/download/lychee-linux.zip -o lychee.zip + unzip lychee.zip -d lychee-bin + chmod +x lychee-bin/lychee + echo "$PWD/lychee-bin" >> $GITHUB_PATH + + - name: Determine Target Files + id: target-files + run: | + if [[ "${{ github.event_name }}" == "pull_request" ]]; then + git fetch origin ${{ github.base_ref }} + files=$(git diff --name-only origin/${{ github.base_ref }}...HEAD | grep '\.md$' || true) + else + files=$(find . -type f -name "*.md") + fi + echo "$files" > all-md-files.txt + echo "files=$(cat all-md-files.txt | paste -sd ' ' -)" >> $GITHUB_OUTPUT + + - name: Run Lychee (Initial) + run: | + mkdir -p lychee-output + lychee --verbose --no-progress --exclude-mail --format json \ + ${{ steps.target-files.outputs.files }} > lychee-output/report.json + # Also produce plain-text report for human reading + lychee --verbose --no-progress --exclude-mail \ + ${{ steps.target-files.outputs.files }} > lychee-output/report.txt || true + + - name: Extract Failed Files + id: extract-failed + run: | + mkdir -p sanitize-targets + jq -r '.failures[].input' lychee-output/report.json | sort -u > failed-files.txt + if [[ -s failed-files.txt ]]; then + echo "files_to_sanitize=$(cat failed-files.txt | paste -sd ' ' -)" >> $GITHUB_OUTPUT + fi + + - name: Sanitize Failed Files (Remove Comments) + if: steps.extract-failed.outputs.files_to_sanitize != '' run: | - mkdir -p cleaned_md - find . -name "*.md" ! -path "./cleaned_md/*" | while read file; do - mkdir -p "cleaned_md/$(dirname "$file")" - sed -E '//d' "$file" > "cleaned_md/$file" - done - - - name: Check Broken Links in Entire Repo (Manual) - if: github.event_name == 'workflow_dispatch' - uses: lycheeverse/lychee-action@v2.4.1 + mkdir -p sanitized_md + while IFS= read -r file; do + [ -f "$file" ] || continue + mkdir -p "sanitized_md/$(dirname "$file")" + perl -0777 -pe 's///gs' "$file" > "sanitized_md/$file" + done < failed-files.txt + + - name: Re-run Lychee on Sanitized Files + if: steps.extract-failed.outputs.files_to_sanitize != '' + run: | + mkdir -p lychee-output-sanitized + while IFS= read -r file; do + [ -f "sanitized_md/$file" ] || continue + echo "🔍 Rechecking: sanitized_md/$file" + lychee --verbose --no-progress --exclude-mail "sanitized_md/$file" || echo "$file" >> final-failures.txt + done < failed-files.txt + + - name: Upload Lychee Reports + uses: actions/upload-artifact@v4 with: - args: > - --verbose --exclude-mail --no-progress --exclude ^https?:// - cleaned_md/**/*.md - output: lychee/out.md - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + name: lychee-original-reports + path: lychee-output + + - name: Upload Sanitized Report Failures + if: steps.extract-failed.outputs.files_to_sanitize != '' + uses: actions/upload-artifact@v4 + with: + name: lychee-sanitized-failures + path: | + final-failures.txt + sanitized_md + + - name: Fail if Broken Links Remain + if: failure() && steps.extract-failed.outputs.files_to_sanitize != '' + run: | + if [ -s final-failures.txt ]; then + echo "🚫 Broken links still exist after comment-stripping:" + cat final-failures.txt + exit 1 + fi From fd356405fe0eb258424a3e27a4c295b73a57ab19 Mon Sep 17 00:00:00 2001 From: Vamshi-Microsoft Date: Tue, 24 Jun 2025 11:14:29 +0530 Subject: [PATCH 53/57] Update Broken-links-checker-final.yml --- .../workflows/Broken-links-checker-final.yml | 142 +++++++++--------- 1 file changed, 73 insertions(+), 69 deletions(-) diff --git a/.github/workflows/Broken-links-checker-final.yml b/.github/workflows/Broken-links-checker-final.yml index fc6459646..e2109ca31 100644 --- a/.github/workflows/Broken-links-checker-final.yml +++ b/.github/workflows/Broken-links-checker-final.yml @@ -1,4 +1,4 @@ -name: Smart Broken Link Checker +name: Broken Link Checker on: pull_request: @@ -10,93 +10,97 @@ permissions: contents: read jobs: - smart-link-check: - name: Filtered Markdown Broken Links + markdown-link-check: + name: Check Markdown Broken Links runs-on: ubuntu-latest steps: - - name: Checkout Repository + - name: Checkout Repo uses: actions/checkout@v4 with: fetch-depth: 0 - - name: Install lychee + - name: Get Added/Modified Markdown Files (PR only) + id: changed-files + if: github.event_name == 'pull_request' run: | - curl -Ls https://github.com/lycheeverse/lychee/releases/latest/download/lychee-linux.zip -o lychee.zip - unzip lychee.zip -d lychee-bin - chmod +x lychee-bin/lychee - echo "$PWD/lychee-bin" >> $GITHUB_PATH + git fetch origin ${{ github.base_ref }} + files=$(git diff --name-only origin/${{ github.base_ref }}...HEAD | grep '\.md$' || true) + echo "md_files<> $GITHUB_OUTPUT + echo "$files" >> $GITHUB_OUTPUT + echo "EOF" >> $GITHUB_OUTPUT - - name: Determine Target Files - id: target-files + - name: Run Lychee (PR) + if: github.event_name == 'pull_request' && steps.changed-files.outputs.md_files != '' run: | - if [[ "${{ github.event_name }}" == "pull_request" ]]; then - git fetch origin ${{ github.base_ref }} - files=$(git diff --name-only origin/${{ github.base_ref }}...HEAD | grep '\.md$' || true) - else - files=$(find . -type f -name "*.md") - fi - echo "$files" > all-md-files.txt - echo "files=$(cat all-md-files.txt | paste -sd ' ' -)" >> $GITHUB_OUTPUT + npx lychee --verbose --exclude-mail --no-progress --exclude ^https?:// ${{ steps.changed-files.outputs.md_files }} > lychee_output.txt || true - - name: Run Lychee (Initial) - run: | - mkdir -p lychee-output - lychee --verbose --no-progress --exclude-mail --format json \ - ${{ steps.target-files.outputs.files }} > lychee-output/report.json - # Also produce plain-text report for human reading - lychee --verbose --no-progress --exclude-mail \ - ${{ steps.target-files.outputs.files }} > lychee-output/report.txt || true - - - name: Extract Failed Files - id: extract-failed + - name: Run Lychee (Manual) + if: github.event_name == 'workflow_dispatch' run: | - mkdir -p sanitize-targets - jq -r '.failures[].input' lychee-output/report.json | sort -u > failed-files.txt - if [[ -s failed-files.txt ]]; then - echo "files_to_sanitize=$(cat failed-files.txt | paste -sd ' ' -)" >> $GITHUB_OUTPUT - fi + npx lychee --verbose --exclude-mail --no-progress --exclude ^https?:// '**/*.md' > lychee_output.txt || true - - name: Sanitize Failed Files (Remove Comments) - if: steps.extract-failed.outputs.files_to_sanitize != '' + - name: Filter Commented-Out Links from Output run: | - mkdir -p sanitized_md - while IFS= read -r file; do - [ -f "$file" ] || continue - mkdir -p "sanitized_md/$(dirname "$file")" - perl -0777 -pe 's///gs' "$file" > "sanitized_md/$file" - done < failed-files.txt - - - name: Re-run Lychee on Sanitized Files - if: steps.extract-failed.outputs.files_to_sanitize != '' + cat > filter_lychee_output.sh <<'EOF' + #!/bin/bash + LYCHEE_OUTPUT_FILE="lychee_output.txt" + FINAL_OUTPUT_FILE="lychee_final_output.txt" + > "$FINAL_OUTPUT_FILE" + + current_file="" + + while IFS= read -r line; do + if [[ "$line" =~ ^Errors\ in\ (.*)\ \[ERROR\]?$ ]]; then + current_file="${BASH_REMATCH[1]}" + echo "$line" >> "$FINAL_OUTPUT_FILE" + continue + fi + + if [[ "$line" =~ file://(.*)\ \| ]]; then + full_path="${BASH_REMATCH[1]}" + broken_link=$(basename "$full_path") + + if [ -f "$current_file" ]; then + if grep -zoP "(?s)" "$current_file" > /dev/null; then + echo "Skipping commented-out link: $broken_link in $current_file" + continue + fi + fi + + echo "$line" >> "$FINAL_OUTPUT_FILE" + fi + done < "$LYCHEE_OUTPUT_FILE" + + echo "Filtered Lychee output saved to $FINAL_OUTPUT_FILE" + EOF + + chmod +x filter_lychee_output.sh + ./filter_lychee_output.sh + + - name: Save Filtered Errors to Markdown File run: | - mkdir -p lychee-output-sanitized - while IFS= read -r file; do - [ -f "sanitized_md/$file" ] || continue - echo "🔍 Rechecking: sanitized_md/$file" - lychee --verbose --no-progress --exclude-mail "sanitized_md/$file" || echo "$file" >> final-failures.txt - done < failed-files.txt - - - name: Upload Lychee Reports - uses: actions/upload-artifact@v4 - with: - name: lychee-original-reports - path: lychee-output + mkdir -p lychee + echo "# 🔗 Broken Link Report" > lychee/out.md + echo "" >> lychee/out.md + if [ -s lychee_final_output.txt ]; then + cat lychee_final_output.txt >> lychee/out.md + else + echo "✅ No non-commented broken links found." >> lychee/out.md + fi - - name: Upload Sanitized Report Failures - if: steps.extract-failed.outputs.files_to_sanitize != '' + - name: Upload Filtered Report as Artifact uses: actions/upload-artifact@v4 with: - name: lychee-sanitized-failures - path: | - final-failures.txt - sanitized_md + name: filtered-link-report + path: lychee/out.md - - name: Fail if Broken Links Remain - if: failure() && steps.extract-failed.outputs.files_to_sanitize != '' + - name: Fail if Real Broken Links Remain run: | - if [ -s final-failures.txt ]; then - echo "🚫 Broken links still exist after comment-stripping:" - cat final-failures.txt + if grep -q "\[ERROR\]" lychee_final_output.txt; then + echo "❌ Found non-commented broken links:" + cat lychee_final_output.txt exit 1 + else + echo "✅ No real broken links found." fi From 94da7b76b8275a6c23e0ecdb52b93a44115e0295 Mon Sep 17 00:00:00 2001 From: Vamshi-Microsoft Date: Tue, 24 Jun 2025 12:56:10 +0530 Subject: [PATCH 54/57] Update Broken-links-checker-final.yml --- .../workflows/Broken-links-checker-final.yml | 136 +++++++++--------- 1 file changed, 67 insertions(+), 69 deletions(-) diff --git a/.github/workflows/Broken-links-checker-final.yml b/.github/workflows/Broken-links-checker-final.yml index e2109ca31..87a741d76 100644 --- a/.github/workflows/Broken-links-checker-final.yml +++ b/.github/workflows/Broken-links-checker-final.yml @@ -30,77 +30,75 @@ jobs: echo "$files" >> $GITHUB_OUTPUT echo "EOF" >> $GITHUB_OUTPUT - - name: Run Lychee (PR) + - name: Check Broken Links in Added/Modified Files (PR) if: github.event_name == 'pull_request' && steps.changed-files.outputs.md_files != '' - run: | - npx lychee --verbose --exclude-mail --no-progress --exclude ^https?:// ${{ steps.changed-files.outputs.md_files }} > lychee_output.txt || true + uses: lycheeverse/lychee-action@v2.4.1 + with: + args: > + --verbose --exclude-mail --no-progress --exclude ^https?:// + ${{ steps.changed-files.outputs.md_files }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Run Lychee (Manual) + - name: Check Broken Links in Entire Repo (Manual) if: github.event_name == 'workflow_dispatch' - run: | - npx lychee --verbose --exclude-mail --no-progress --exclude ^https?:// '**/*.md' > lychee_output.txt || true - - - name: Filter Commented-Out Links from Output - run: | - cat > filter_lychee_output.sh <<'EOF' - #!/bin/bash - LYCHEE_OUTPUT_FILE="lychee_output.txt" - FINAL_OUTPUT_FILE="lychee_final_output.txt" - > "$FINAL_OUTPUT_FILE" - - current_file="" - - while IFS= read -r line; do - if [[ "$line" =~ ^Errors\ in\ (.*)\ \[ERROR\]?$ ]]; then - current_file="${BASH_REMATCH[1]}" - echo "$line" >> "$FINAL_OUTPUT_FILE" - continue - fi - - if [[ "$line" =~ file://(.*)\ \| ]]; then - full_path="${BASH_REMATCH[1]}" - broken_link=$(basename "$full_path") - - if [ -f "$current_file" ]; then - if grep -zoP "(?s)" "$current_file" > /dev/null; then - echo "Skipping commented-out link: $broken_link in $current_file" - continue - fi - fi - - echo "$line" >> "$FINAL_OUTPUT_FILE" - fi - done < "$LYCHEE_OUTPUT_FILE" - - echo "Filtered Lychee output saved to $FINAL_OUTPUT_FILE" - EOF - - chmod +x filter_lychee_output.sh - ./filter_lychee_output.sh - - - name: Save Filtered Errors to Markdown File - run: | - mkdir -p lychee - echo "# 🔗 Broken Link Report" > lychee/out.md - echo "" >> lychee/out.md - if [ -s lychee_final_output.txt ]; then - cat lychee_final_output.txt >> lychee/out.md - else - echo "✅ No non-commented broken links found." >> lychee/out.md - fi - - - name: Upload Filtered Report as Artifact - uses: actions/upload-artifact@v4 + uses: lycheeverse/lychee-action@v2.4.1 with: - name: filtered-link-report - path: lychee/out.md - - - name: Fail if Real Broken Links Remain + args: > + --verbose --exclude-mail --no-progress --exclude ^https?:// + '**/*.md' + output: lychee/out.md + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Clean lychee/out.md by removing errors inside HTML comments + if: github.event_name == 'workflow_dispatch' + run: | + FILTERED="lychee/out.md.cleaned" + > "$FILTERED" + + awk ' + BEGIN { RS="### "; FS="\n" } + NR == 1 { next } + { + header = "### " $1 + file_section = $1 + file_path = "" + + if (match(file_section, /in (.*\.md)/, m)) { + file_path = m[1] + } + + keep_section = "" + for (i = 2; i <= NF; i++) { + line = $i + if (match(line, /\((file:\/\/[^\)]+)\)/, mfile)) { + fullpath = mfile[1] + localpath = substr(fullpath, 8) + filename = gensub(/^.*\//, "", "g", localpath) + + cmd = "awk \047BEGIN{incomment=0} //&&incomment{incomment=0; next} incomment && index(\\\$0, \\\"" filename "\\\")>0 {exit 0} END{exit 1}\047 \"" file_path "\"" + status = system(cmd) + + if (status != 0) { + keep_section = keep_section line "\n" + } + } else { + keep_section = keep_section line "\n" + } + } + + if (length(keep_section) > 0) { + print header "\n" keep_section >> "'"$FILTERED"'" + } + } + ' lychee/out.md + + mv "$FILTERED" lychee/out.md + + - name: Show Cleaned Report + if: github.event_name == 'workflow_dispatch' run: | - if grep -q "\[ERROR\]" lychee_final_output.txt; then - echo "❌ Found non-commented broken links:" - cat lychee_final_output.txt - exit 1 - else - echo "✅ No real broken links found." - fi + echo '```markdown' + cat lychee/out.md + echo '```' From dffae56036c5680c0b6147c1baee7b0ca0dae059 Mon Sep 17 00:00:00 2001 From: Vamshi-Microsoft Date: Tue, 24 Jun 2025 13:11:05 +0530 Subject: [PATCH 55/57] Update template.md --- docs/design/adrs/template.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/design/adrs/template.md b/docs/design/adrs/template.md index b51110faa..b844eb43b 100644 --- a/docs/design/adrs/template.md +++ b/docs/design/adrs/template.md @@ -1,6 +1,6 @@ # [short title of solved problem and solution] -* **Status:** [proposed | rejected | accepted | deprecated | … | superseded by [ADR-0005](0005-example.md)] + * **Proposer:** [list everyone involved in the proposal] * **Date:** [YYYY-MM-DD when the decision was last updated] * **Technical Story:** [description | ticket/issue URL] @@ -58,4 +58,4 @@ Chosen option: "[option 1]", because [justification. e.g., only option, which me ## Links * [Link type] [Link to ADR] -* … \ No newline at end of file +* … From df35a55ce8145f47104c21f3c90191fa08f66fbb Mon Sep 17 00:00:00 2001 From: Vamshi-Microsoft Date: Tue, 24 Jun 2025 13:11:53 +0530 Subject: [PATCH 56/57] Update Broken-links-checker-final.yml --- .../workflows/Broken-links-checker-final.yml | 53 ------------------- 1 file changed, 53 deletions(-) diff --git a/.github/workflows/Broken-links-checker-final.yml b/.github/workflows/Broken-links-checker-final.yml index 87a741d76..80649dc88 100644 --- a/.github/workflows/Broken-links-checker-final.yml +++ b/.github/workflows/Broken-links-checker-final.yml @@ -29,7 +29,6 @@ jobs: echo "md_files<> $GITHUB_OUTPUT echo "$files" >> $GITHUB_OUTPUT echo "EOF" >> $GITHUB_OUTPUT - - name: Check Broken Links in Added/Modified Files (PR) if: github.event_name == 'pull_request' && steps.changed-files.outputs.md_files != '' uses: lycheeverse/lychee-action@v2.4.1 @@ -50,55 +49,3 @@ jobs: output: lychee/out.md env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Clean lychee/out.md by removing errors inside HTML comments - if: github.event_name == 'workflow_dispatch' - run: | - FILTERED="lychee/out.md.cleaned" - > "$FILTERED" - - awk ' - BEGIN { RS="### "; FS="\n" } - NR == 1 { next } - { - header = "### " $1 - file_section = $1 - file_path = "" - - if (match(file_section, /in (.*\.md)/, m)) { - file_path = m[1] - } - - keep_section = "" - for (i = 2; i <= NF; i++) { - line = $i - if (match(line, /\((file:\/\/[^\)]+)\)/, mfile)) { - fullpath = mfile[1] - localpath = substr(fullpath, 8) - filename = gensub(/^.*\//, "", "g", localpath) - - cmd = "awk \047BEGIN{incomment=0} //&&incomment{incomment=0; next} incomment && index(\\\$0, \\\"" filename "\\\")>0 {exit 0} END{exit 1}\047 \"" file_path "\"" - status = system(cmd) - - if (status != 0) { - keep_section = keep_section line "\n" - } - } else { - keep_section = keep_section line "\n" - } - } - - if (length(keep_section) > 0) { - print header "\n" keep_section >> "'"$FILTERED"'" - } - } - ' lychee/out.md - - mv "$FILTERED" lychee/out.md - - - name: Show Cleaned Report - if: github.event_name == 'workflow_dispatch' - run: | - echo '```markdown' - cat lychee/out.md - echo '```' From e232f22e817a30141cdd14394c4d2be4cf915b83 Mon Sep 17 00:00:00 2001 From: Vamshi-Microsoft Date: Tue, 24 Jun 2025 14:56:13 +0530 Subject: [PATCH 57/57] Create test-comments.md --- test-comments.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 test-comments.md diff --git a/test-comments.md b/test-comments.md new file mode 100644 index 000000000..135fbf685 --- /dev/null +++ b/test-comments.md @@ -0,0 +1 @@ +