Skip to content

Link Checker

Link Checker #14

Workflow file for this run

name: Link Checker
# Run this workflow every time a new commit pushed to your repository
on:
# Automatic Schedule Trigger
schedule:
# Run on 1st day of every month
- cron: '0 0 1 * *'
# Manual Trigger
workflow_dispatch:
inputs:
logLevel:
description: 'Log level'
required: true
default: 'warning'
tags:
description: 'Test scenario tags'
jobs:
website-checker:
name: Check links on www.dragonfly.co.nz
runs-on: ubuntu-latest
continue-on-error: true
steps:
- name: Install Python
uses: actions/setup-python@v2
with:
python-version: '3.8'
- name: Setup Environment
run: |
pip3 install git+https://github.com/linkchecker/linkchecker.git
mkdir ./logs
- name: Check Links
run: |
linkchecker \
--no-warnings \
--check-extern \
-t 100 \
-o csv \
https://www.dragonfly.co.nz > ./logs/www.dragonfly.co.nz.csv
- name: Process Link Log
if: always()
continue-on-error: true
run: |
echo LC_SUMMARY=$( awk '/\d* warnings found/' ./logs/www.dragonfly.co.nz.csv) >> $GITHUB_ENV
echo $(awk '/\d* warnings found/' ./logs/www.dragonfly.co.nz.csv )
echo $GITHUB_ENV
- name: Upload Artifact Logs
uses: actions/upload-artifact@v2
if: ${{ always() }}
with:
name: www.dragonfly.co.nz.csv
path: ./logs/www.dragonfly.co.nz.csv
# # Slack Notification of broken links found
# - name: Slack Notification
# uses: rtCamp/action-slack-notify@v2
# if: ${{ failure() }}
# env:
# SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
# SLACK_CHANNEL: channel_name
# SLACK_USERNAME: Link Checker Bot
# SLACK_TITLE: WARNING - broken links found on www.dragonfly.co.nz
# MSG_MINIMAL: true
# SLACK_ICON_EMOJI: ':failed:'
# SLACK_MESSAGE: |
# `${{ env.LC_SUMMARY }}`
# link check: broken links detected on www.dragonfly.co.nz. Please see report artifact.