Skip to content

Commit 7e58bb0

Browse files
committed
test
Signed-off-by: emdneto <9735060+emdneto@users.noreply.github.com>
1 parent 0f47f66 commit 7e58bb0

File tree

1 file changed

+22
-23
lines changed

1 file changed

+22
-23
lines changed

.github/workflows/check-links.yml

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -3,45 +3,44 @@ on:
33
push:
44
branches: [ main ]
55
pull_request:
6+
paths:
7+
- '**/*.md'
8+
- '.github/workflows/check-links.yml'
9+
- '.github/workflows/check_links_config.json'
610

711
permissions:
812
contents: read
913

14+
concurrency:
15+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }}
16+
cancel-in-progress: true
17+
1018
jobs:
11-
changedfiles:
12-
name: changed files
13-
runs-on: ubuntu-latest
14-
if: ${{ github.actor != 'dependabot[bot]' }}
15-
outputs:
16-
md: ${{ steps.changes.outputs.md }}
17-
steps:
18-
- name: Checkout Repo
19-
uses: actions/checkout@v4
20-
with:
21-
fetch-depth: 0
22-
- name: Get changed files
23-
id: changes
24-
run: |
25-
echo "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)" >> $GITHUB_OUTPUT
2619
check-links:
2720
runs-on: ubuntu-latest
28-
needs: changedfiles
29-
if: |
30-
github.event.pull_request.user.login != 'otelbot[bot]' && github.event_name == 'pull_request'
31-
&& ${{needs.changedfiles.outputs.md}}
21+
timeout-minutes: 15
22+
if: ${{ github.actor != 'dependabot[bot]' && github.actor != 'otelbot[bot]' }}
3223
steps:
3324
- name: Checkout Repo
34-
uses: actions/checkout@v4
25+
uses: actions/checkout@v6
26+
27+
- name: Get changed markdown files
28+
id: changed-files
29+
uses: tj-actions/changed-files@v46
3530
with:
36-
fetch-depth: 0
31+
files: |
32+
**/*.md
3733
3834
- name: Install markdown-link-check
35+
if: steps.changed-files.outputs.any_changed == 'true'
3936
run: npm install -g markdown-link-check@v3.12.2
4037

4138
- name: Run markdown-link-check
39+
if: steps.changed-files.outputs.any_changed == 'true'
40+
env:
41+
CHANGED_MARKDOWN_FILES: ${{ steps.changed-files.outputs.all_changed_files }}
4242
run: |
43-
markdown-link-check \
43+
printf '%s\n' "$CHANGED_MARKDOWN_FILES" | tr ' ' '\n' | xargs -r -n 1 -P 4 markdown-link-check \
4444
--verbose \
4545
--config .github/workflows/check_links_config.json \
46-
${{needs.changedfiles.outputs.md}} \
4746
|| { echo "Check that anchor links are lowercase"; exit 1; }

0 commit comments

Comments
 (0)