@@ -15,16 +15,43 @@ jobs:
15
15
# https://github.com/crazy-max/ghaction-github-pages/issues/1#issuecomment-623202206
16
16
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
17
17
steps :
18
- - uses : actions/checkout@v2
18
+ - uses : actions/checkout@v4
19
+ with :
20
+ fetch-depth : ${{ github.event_name == 'pull_request' && 2 || 0 }}
21
+ - name : Get changed files
22
+ id : changed-files
23
+ # source: https://stackoverflow.com/a/74268200, added filtering for markdown files
24
+ run : |
25
+ if ${{ github.event_name == 'pull_request' }}; then
26
+ changed_files=$(git diff --name-only -r HEAD^1 HEAD -z | grep '\.md$' -zZ | xargs -0)
27
+ else
28
+ changed_files=$(git diff --name-only ${{ github.event.before }} ${{ github.event.after }} -z | grep '\.md$' -zZ | xargs -0)
29
+ fi
30
+ echo "changed_files: $changed_files"
31
+ echo "changed_files=$changed_files" >> $GITHUB_OUTPUT
19
32
- name : Lint
20
33
uses : avto-dev/markdown-lint@v1
21
34
with :
22
35
args : ' .'
23
36
config : ' .markdownlint.json'
37
+ - name : Check links
38
+ uses :
lycheeverse/[email protected]
39
+ if : ${{ steps.changed-files.outputs.changed_files != '' }}
40
+ with :
41
+ fail : true
42
+ args : >-
43
+ --verbose
44
+ --no-progress
45
+ --accept '100..=103,200..=299,300..=399'
46
+ --exclude '[^\w]todo[^\w]?'
47
+ --exclude 'https://(www\.|old\.)?reddit\.com'
48
+ ${{ steps.changed-files.outputs.changed_files }}
24
49
- name : Install Zola
25
- run : curl -L ${BASE_URL}/${VERS}/zola-${VERS}-${ARCH}.tar.gz | tar -xz
26
- - run : ./zola --version
27
- - run : ./zola build
50
+ run : |
51
+ curl -L ${BASE_URL}/${VERS}/zola-${VERS}-${ARCH}.tar.gz | tar -xz
52
+ echo "Zola version: $(./zola --version)"
53
+ - name : Zola build
54
+ run : ./zola build
28
55
- name : Deploy
29
56
if : github.ref == 'refs/heads/source'
30
57
uses : crazy-max/ghaction-github-pages@v1
0 commit comments