Skip to content

Krsjenmt patch 1 #20237

Krsjenmt patch 1

Krsjenmt patch 1 #20237

name: 'Link Checker: On PR'
# **What it does**: Checks internal links in changed content files.
# **Why we have it**: To catch broken links before they're merged.
# **Who does it impact**: Docs content.
on:
workflow_dispatch:
merge_group:
pull_request:
permissions:
contents: read
pull-requests: write
issues: write
# Cancel in-progress runs for the same PR
concurrency:
group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}'
cancel-in-progress: true
jobs:
check-links:
name: Check links
runs-on: ubuntu-latest
if: github.repository == 'github/docs-internal' || github.repository == 'github/docs'
steps:
- name: Checkout
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
- uses: ./.github/actions/node-npm-setup
- uses: ./.github/actions/get-docs-early-access
if: ${{ github.repository == 'github/docs-internal' }}
with:
token: ${{ secrets.DOCS_BOT_PAT_BASE }}
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@48d8f15b2aaa3d255ca5af3eba4870f807ce6b3c # v45
with:
files: |
content/**/*.md
data/**/*.md
- name: Check links in changed files
if: steps.changed-files.outputs.any_changed == 'true'
env:
FILES_CHANGED: ${{ steps.changed-files.outputs.all_changed_files }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ACTION_RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
SHOULD_COMMENT: ${{ secrets.DOCS_BOT_PAT_BASE != '' }}
FAIL_ON_FLAW: true
ENABLED_LANGUAGES: en
run: npm run check-links-pr
- name: No content changes
if: steps.changed-files.outputs.any_changed != 'true'
run: echo "No content files changed. Skipping link check."