@@ -2,46 +2,48 @@ name: check-links
22on :
33 push :
44 branches : [ main ]
5+ paths :
6+ - ' **/*.md'
7+ - ' .github/workflows/check-links.yml'
8+ - ' .github/workflows/check_links_config.json'
59 pull_request :
10+ paths :
11+ - ' **/*.md'
12+ - ' .github/workflows/check-links.yml'
13+ - ' .github/workflows/check_links_config.json'
614
715permissions :
816 contents : read
917
18+ concurrency :
19+ group : ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }}
20+ cancel-in-progress : true
21+
1022jobs :
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
2623 check-links :
2724 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}}
25+ if : ${{ github.actor != 'dependabot[bot]' && github.actor != 'otelbot[bot]' }}
26+ timeout-minutes : 15
3227 steps :
3328 - name : Checkout Repo
34- uses : actions/checkout@v4
29+ uses : actions/checkout@v6
30+
31+ - name : Get changed markdown files
32+ id : changed-files
33+ uses : tj-actions/changed-files@v46
3534 with :
36- fetch-depth : 0
35+ files : |
36+ **/*.md
3737
3838 - name : Install markdown-link-check
39+ if : steps.changed-files.outputs.any_changed == 'true'
3940 run : npm install -g markdown-link-check@v3.12.2
4041
4142 - name : Run markdown-link-check
43+ if : steps.changed-files.outputs.any_changed == 'true'
4244 run : |
4345 markdown-link-check \
4446 --verbose \
4547 --config .github/workflows/check_links_config.json \
46- ${{needs.changedfiles .outputs.md }} \
47- || { echo "Check that anchor links are lowercase"; exit 1; }
48+ ${{ steps.changed-files .outputs.all_changed_files }} \
49+ || { echo "Check that anchor links are lowercase"; exit 1; }
0 commit comments