Skip to content

Create broken link checker cron jobs #5

Create broken link checker cron jobs

Create broken link checker cron jobs #5

name: new link check
on:
push:
pull_request: # temporarily execute on all branches
schedule:
- cron: "8 8 * * *" # Cron job will run at 08h08 UTC time
jobs:
get-links:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- id: set-matrix
run: |
flatpages=$(curl https://cantusdatabase.org/flatpages-list/ | awk '{ gsub (" ", "\",\"", $0); print}')
articles=$(curl https://cantusdatabase.org/articles-list/ | awk '{ gsub (" ", "\",\"", $0); print}')
list="{\"links\": [\"${flatpages}\",\"${articles}\"]}"
echo $list
echo "matrix=$list" >> $GITHUB_OUTPUT
link-Checker:
runs-on: ubuntu-latest
needs: get-links
strategy:
fail-fast: false
max-parallel: 4
matrix: ${{fromJson(needs.get-links.outputs.matrix)}}
steps:
- uses: actions/checkout@v3
- name: Link Checker
id: lychee
uses: lycheeverse/[email protected]
with:
args: --exclude http:\/\/cantus\.sk.* ${{ matrix.links }}
format: json
output: /tmp/link-checker.txt
- name: parsing output
run: |
echo "***Python Version***"
python --version
echo "***Invoking parsing script***"
python "$GITHUB_WORKSPACE/scripts/parse_broken_link_checker_output.py" >> $GITHUB_STEP_SUMMARY
echo "***Printing step summary***"
cat $GITHUB_STEP_SUMMARY