Skip to content

Commit ae8fb41

Browse files
committed
Test PR link check settings
Signed-off-by: peppi-lotta <[email protected]>
1 parent fb88cf0 commit ae8fb41

File tree

4 files changed

+66
-5
lines changed

4 files changed

+66
-5
lines changed
Lines changed: 63 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,70 @@
1-
name: PR Check Links
1+
name: Check Links In Pull Requests
22

33
on:
44
pull_request:
55
types: [opened, edited, reopened, synchronize, ready_for_review]
6+
workflow_call:
67

7-
permissions:
8-
contents: read
8+
permissions: {}
9+
10+
concurrency:
11+
group: ${{ github.workflow }}-${{ github.ref }}
12+
cancel-in-progress: true
913

1014
jobs:
11-
check-pr-links:
12-
uses: metal3-io/project-infra/.github/workflows/pr-link-check.yml@main
15+
check-links-pr:
16+
runs-on: ubuntu-latest
17+
18+
steps:
19+
- name: Clone repository
20+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
21+
with:
22+
fetch-depth: 0
23+
ref: ${{github.event.pull_request.head.ref}}
24+
repository: ${{github.event.pull_request.head.repo.full_name}}
25+
26+
- name: Add upstream remote
27+
run: |
28+
git remote add upstream https://github.com/metal3-io/metal3-docs.git
29+
git fetch upstream
30+
31+
- name: Checkout base branch
32+
run: git checkout "upstream/${{ github.event.pull_request.base.ref }}"
33+
34+
- name: Get list of changed Markdown files
35+
id: changed-files
36+
run: |
37+
git diff --name-only "upstream/${{ github.event.pull_request.base.ref }}...${{ github.head_ref }}" -- "*.md" > changed-files.txt
38+
cat changed-files.txt
39+
if [[ -s "changed-files.txt" ]]; then
40+
echo "Changed md files found"
41+
echo "foundFiles=true" >> "${GITHUB_ENV}"
42+
fi
43+
44+
- name: Switch to PR branch
45+
run: git checkout ${{ github.head_ref }}
46+
47+
- name: Check links in changed files
48+
if: env.foundFiles == 'true'
49+
uses: lycheeverse/lychee-action@f796c8b7d468feb9b8c0a46da3fac0af6874d374 # v2.2.0
50+
with:
51+
failIfEmpty: false
52+
args: |
53+
--no-progress
54+
--github-token "${GITHUB_TOKEN}"
55+
$(cat changed-files.txt | tr '\n' ' ')
56+
57+
- name: Provide helpful failure message
58+
if: failure()
59+
run: |
60+
echo "::error::Link check failed! Please review the broken links reported above."
61+
echo ""
62+
echo "If certain links are valid but fail due to:"
63+
echo "- CAPTCHA challenges"
64+
echo "- IP blocking"
65+
echo "- Authentication requirements"
66+
echo "- Rate limiting"
67+
echo ""
68+
echo "Consider adding them to .lycheeignore to bypass future checks."
69+
echo "Format: Add one URL pattern per line"
70+
exit 1

docs/user-guide/src/capm3/introduction.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Kubernetes Cluster API Provider Metal3
22

3+
TEST
34
Kubernetes-native declarative infrastructure for Metal3.
45

56
<!-- markdownlint-disable no-inline-html -->

docs/user-guide/src/ipam/introduction.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# IPAM (IP Address Manager)
22

3+
TEST
34
The IPAM project provides a controller to manage static IP address allocations
45
in [Cluster API Provider Metal3](https://github.com/metal3-io/cluster-api-provider-metal3/).
56

docs/user-guide/src/version_support.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Supported release versions
22

3+
TEST
34
The Cluster API Provider Metal3 (CAPM3) team maintains the two most recent minor
45
releases; older minor releases are immediately unsupported when a new
56
major/minor release is available. Test coverage will be maintained for all

0 commit comments

Comments
 (0)