From ce80ee135ae3bdff638e7a04ee6eda39336f759d Mon Sep 17 00:00:00 2001 From: Vamshi-Microsoft Date: Mon, 23 Jun 2025 10:15:03 +0530 Subject: [PATCH 1/2] feat: Add Broken Link Checker workflow for Markdown files --- .github/workflows/broken-links-checker.yml | 48 ++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 .github/workflows/broken-links-checker.yml diff --git a/.github/workflows/broken-links-checker.yml b/.github/workflows/broken-links-checker.yml new file mode 100644 index 000000000..e421c1fe6 --- /dev/null +++ b/.github/workflows/broken-links-checker.yml @@ -0,0 +1,48 @@ +name: Broken Link Checker + +on: + pull_request: + paths: + - '**/*.md' + workflow_dispatch: + +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 (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: 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: 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?:// + '**/*.md' + output: lychee/out.md + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 1e86b51c8080d9fca2653fbe901a02ebf6602b96 Mon Sep 17 00:00:00 2001 From: Vamshi-Microsoft Date: Mon, 23 Jun 2025 10:24:43 +0530 Subject: [PATCH 2/2] added permission block in broken-links-checker.yml --- .github/workflows/broken-links-checker.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/broken-links-checker.yml b/.github/workflows/broken-links-checker.yml index e421c1fe6..80649dc88 100644 --- a/.github/workflows/broken-links-checker.yml +++ b/.github/workflows/broken-links-checker.yml @@ -6,6 +6,9 @@ on: - '**/*.md' workflow_dispatch: +permissions: + contents: read + jobs: markdown-link-check: name: Check Markdown Broken Links