Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
98 changes: 98 additions & 0 deletions .github/workflows/link-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
#
# Copyright 2026 ABSA Group Limited
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

name: "Link check"

on:
push:
branches: [ "master" ]
pull_request:
types: [ opened, synchronize, reopened ]
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: read

jobs:
detect:
name: Detect Docs Changes
runs-on: ubuntu-latest
outputs:
docs_changed: ${{ steps.changes.outputs.docs_changed }}
steps:
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
with:
fetch-depth: 0
persist-credentials: false

- name: Check whether Markdown files changed
id: changes
shell: bash
env:
GH_TOKEN: ${{ github.token }}
run: |
set -euo pipefail

if [[ "${{ github.event_name }}" == "pull_request" ]]; then
changed_files=$(gh api \
"repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/files" \
--paginate --jq '.[].filename')
else
changed_files=$(git diff --name-only "${{ github.sha }}~1" "${{ github.sha }}")
fi

if echo "$changed_files" | grep -E '\.md$' > /dev/null; then
echo "docs_changed=true" >> "$GITHUB_OUTPUT"
else
echo "docs_changed=false" >> "$GITHUB_OUTPUT"
fi

link-check:
needs: detect
if: needs.detect.outputs.docs_changed == 'true'
runs-on: ubuntu-latest
name: Markdown Link Check
steps:
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
with:
persist-credentials: false

- name: Check cross-reference and cross-repo links
uses: lycheeverse/lychee-action@e7477775783ea5526144ba13e8db5eec57747ce8
with:
args: >-
--no-progress
--include-fragments
--max-retries 3
--retry-wait-time 5
'./**/*.md'
fail: true
env:
GITHUB_TOKEN: ${{ github.token }}

noop:
needs: detect
if: needs.detect.outputs.docs_changed != 'true'
runs-on: ubuntu-latest
name: No Docs Changes
steps:
- run: echo "No Markdown changes detected — link check skipped."
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: GitHub Draft Release
name: Draft Release
on:
workflow_dispatch:
inputs:
Expand Down