notfoundbot is a GitHub Action that helps you automatically maintain the correctness of your website's outgoing links. It finds links that need fixing and opens pull requests that fix them.
This action is intended for websites and blogs powered by static site generators.
notfoundbot does the following fixes:
By using post dates derived from filenames, notfoundbot searches for Wayback Machine archives of linked resources that are contemporary to the post itself: broken links in a 2011 blog post will be linked to archives from around that era.
name: notfoundbot
on:
schedule:
- cron: "0 5 * * *"
jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Fix links
uses: tmcw/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Some websites will return different information for notfoundbot than for a typical user. When false positives become a repetitive issue an exceptions list can be used. The exception list is a space separated list of hosts that will always return an ok status.
name: notfoundbot
on:
schedule:
- cron: "0 5 * * *"
jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Fix links
uses: tmcw/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
EXCEPTIONS: www.host.com thisisok.org
By default notfoundbot will check .md
files in the _posts
directory. You can change this directory:
- name: Fix links
uses: tmcw/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
content-folder: custom-content
Notes:
notfoundbot
here - make sure that it's
the latest!notfoundbot
, exitThen, for each link marked as an error: