Skip to content

Find broken links

Find broken links #18

name: Find broken links
on:
schedule:
# 0: At the start of the minute (0th minute)
# 3: At 3 o'clock
# *: Every day of the month
# *: Every month
# 1: On Monday
- cron: '0 3 * * 1' # Every Monday at 3:00 AM
workflow_dispatch:
jobs:
findbrokenlinks:
name: Find broken links
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 19
cache: npm
- name: Install dependencies
run: npm ci
##############################
# Find broken links
##############################
- name: Find broken links
env:
GITHUB_ISSUE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: node maintenance/findBrokenLinks.js
# Since this GitHub Action is specifically designed to only handle the /logs/brokenLinks.md file and the runner environment is ephemeral, you can safely use this:
- name: Force push changes for /logs/brokenLinks.md
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add ./logs/brokenLinks.md # Using the full relative path from the root
# Check if there are changes in /logs/brokenLinks.md
git diff --cached --exit-code && exit 0 # Exit if no changes
# Commit and force push only /logs/brokenLinks.md
git commit -m "Update /logs/brokenLinks.md"
git push origin +HEAD:main
##############################