|
20 | 20 | if: github.event_name == 'pull_request' |
21 | 21 | env: |
22 | 22 | GITHUB_TOKEN: ${{ github.token }} |
23 | | - run: mise run lint-local-links |
24 | | - |
25 | | - - name: Get modified files |
26 | | - if: github.event_name == 'pull_request' |
27 | | - id: modified-files |
28 | | - run: | |
29 | | - merge_base=$(git merge-base origin/${{ github.base_ref }} HEAD) |
30 | | - # Using lychee's default extension filter here to match when it runs against all files |
31 | | - # Note: --diff-filter=d filters out deleted files |
32 | | - modified_files=$(git diff --name-only --diff-filter=d $merge_base...${{ github.event.pull_request.head.sha }} \ |
33 | | - | grep -E '\.(md|mkd|mdx|mdown|mdwn|mkdn|mkdown|markdown|html|htm|txt)$' \ |
34 | | - | tr '\n' ' ' || true) |
35 | | - echo "files=$modified_files" >> $GITHUB_OUTPUT |
36 | | - echo "Modified files: $modified_files" |
37 | | -
|
38 | | - - name: Check if lychee config was modified |
39 | | - if: github.event_name == 'pull_request' |
40 | | - id: config-check |
41 | | - run: | |
42 | | - merge_base=$(git merge-base origin/${{ github.base_ref }} HEAD) |
43 | | - config_modified=$(git diff --name-only $merge_base...${{ github.event.pull_request.head.sha }} \ |
44 | | - | grep -E '^(\.github/config/lychee\.toml|mise\.toml)$' || true) |
45 | | - if [ -n "$config_modified" ]; then |
46 | | - echo "modified=true" >> $GITHUB_OUTPUT |
47 | | - fi |
| 23 | + run: mise run lint:local-links |
48 | 24 |
|
49 | 25 | - name: Link check (modified files only) |
50 | | - if: github.event_name == 'pull_request' && steps.modified-files.outputs.files != '' && steps.config-check.outputs.modified != 'true' |
51 | | - env: |
52 | | - GITHUB_TOKEN: ${{ github.token }} |
53 | | - run: mise run lint-links ${{ steps.modified-files.outputs.files }} |
54 | | - |
55 | | - - name: Link check (all files) |
56 | | - if: github.event_name != 'pull_request' || steps.config-check.outputs.modified == 'true' |
57 | 26 | env: |
58 | 27 | GITHUB_TOKEN: ${{ github.token }} |
59 | | - run: mise run lint-links |
| 28 | + run: mise run lint:links-in-modified-files --base origin/${{ github.base_ref }} --head ${{ github.event.pull_request.head.sha }} --event ${{ github.event_name }} |
0 commit comments