Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 12c9b0f

Browse files
authored
Add markdown links check (open-telemetry#2812)
1 parent fe26ada commit 12c9b0f

File tree

2 files changed

+56
-0
lines changed

2 files changed

+56
-0
lines changed

.github/workflows/check-links.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: check-links
2+
on:
3+
push:
4+
branches: [ main ]
5+
pull_request:
6+
7+
jobs:
8+
changedfiles:
9+
name: changed files
10+
runs-on: ubuntu-latest
11+
if: ${{ github.actor != 'dependabot[bot]' }}
12+
outputs:
13+
md: ${{ steps.changes.outputs.md }}
14+
steps:
15+
- name: Checkout Repo
16+
uses: actions/checkout@v3
17+
with:
18+
fetch-depth: 0
19+
- name: Get changed files
20+
id: changes
21+
run: |
22+
echo "::set-output name=md::$(git diff --name-only --diff-filter=ACMRTUXB $(git merge-base origin/main ${{ github.event.pull_request.head.sha }}) ${{ github.event.pull_request.head.sha }} | grep .md$ | xargs)"
23+
check-links:
24+
runs-on: ubuntu-latest
25+
needs: changedfiles
26+
if: ${{needs.changedfiles.outputs.md}}
27+
steps:
28+
- name: Checkout Repo
29+
uses: actions/checkout@v3
30+
with:
31+
fetch-depth: 0
32+
33+
- name: Install markdown-link-check
34+
run: npm install -g markdown-link-check
35+
36+
- name: Run markdown-link-check
37+
run: |
38+
markdown-link-check \
39+
--verbose \
40+
--config .github/workflows/check_links_config.json \
41+
${{needs.changedfiles.outputs.md}} \
42+
|| { echo "Check that anchor links are lowercase"; exit 1; }
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"ignorePatterns": [
3+
{
4+
"pattern": "http(s)?://\\d+\\.\\d+\\.\\d+\\.\\d+"
5+
},
6+
{
7+
"pattern": "http(s)?://localhost"
8+
},
9+
{
10+
"pattern": "http(s)?://example.com"
11+
}
12+
],
13+
"aliveStatusCodes": [429, 200]
14+
}

0 commit comments

Comments
 (0)