Skip to content

Production

Production #20

Workflow file for this run

name: Check broken links
on:
deployment:
schedule:
- cron: "0 13 * * *"
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install dependencies
run: npm install -g linkinator
- name: Check links
run: linkinator https://docs.pimlico.io https://pimlico.io -r --retry --format json --skip api.pimlico.io > links-report.json
- name: Prepare report
id: prepare-report
run: |
LENGTH=$(jq '[.links[] | select(.state == "BROKEN")] | length' links-report.json)
if [ "$LENGTH" -gt 0 ]; then
echo "send_report=true" >> $GITHUB_OUTPUT
else
echo "send_report=false" >> $GITHUB_OUTPUT
fi
{
echo 'report_list<<EOF'
jq '[.links[] | select(.state == "BROKEN") | "• `\(.url)` (status: `\(.status)`) on the page \(.parent)"]' links-report.json
echo EOF
} >> "$GITHUB_OUTPUT"
- name: Send report
uses: slackapi/[email protected]
if: steps.prepare-report.outputs.send_report == 'true'
with:
channel-id: "#alerts-test"
slack-message: |
Broken links found in the docs 😱:
${{ join(fromJson(steps.prepare-report.outputs.report_list), '%0A') }}
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}