Skip to content

Check for dead links #5064

Check for dead links

Check for dead links #5064

Workflow file for this run

name: Zola
on:
push:
branches: source
pull_request:
jobs:
zola:
runs-on: ubuntu-latest
env:
BASE_URL: https://github.com/getzola/zola/releases/download
VERS: v0.15.2
ARCH: x86_64-unknown-linux-gnu
# https://github.com/crazy-max/ghaction-github-pages/issues/1#issuecomment-623202206
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: ${{ github.event_name == 'pull_request' && 2 || 0 }}
- name: Get changed files
id: changed-files
# source: https://stackoverflow.com/a/74268200
run: |
if ${{ github.event_name == 'pull_request' }}; then
echo "changed_files=$(git diff --name-only -r HEAD^1 HEAD | xargs)" >> $GITHUB_OUTPUT
else
echo "changed_files=$(git diff --name-only ${{ github.event.before }} ${{ github.event.after }} | xargs)" >> $GITHUB_OUTPUT
fi
- name: Lint
uses: avto-dev/markdown-lint@v1
with:
args: '.'
config: '.markdownlint.json'
- name: Check for dead links
run: |
npm install -g @umbrelladocs/linkspector
echo "linkspector version: $(linkspector --version)"
echo "changed files: ${{ steps.changed-files.outputs.changed_files }}"
cat .github/.linkspector.json | jq '.files=$ARGS.positional' ${{ steps.changed-files.outputs.changed_files }} > .linkspector.yml
linkspector check --config .linkspector.yml
- name: Install Zola
run: |
curl -L ${BASE_URL}/${VERS}/zola-${VERS}-${ARCH}.tar.gz | tar -xz
echo "Zola version: $(./zola --version)"
- name: Zola build
run: ./zola build
- name: Deploy
if: github.ref == 'refs/heads/source'
uses: crazy-max/ghaction-github-pages@v1
with:
build_dir: public
target_branch: master