diyhrt/.github/workflows/diyhrt.wiki.yml

42 lines
1.5 KiB
YAML

name: DIYHRT.wiki
on:
workflow_dispatch:
schedule:
- cron: "0 0 * * 2"
jobs:
archive:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
token: ${{ secrets.PAT_TOKEN }}
- name: check for 404
run: |
url="https://diyhrt.wiki"
status=$(curl -o /dev/null -s -w "%{http_code}" $url)
if [ $status -eq 404 ]; then
echo "Got 404. Exiting."
curl -H "Content-Type: application/json" -d '{"content": "${{ secrets.DISCORD_USER_ID }} $URL returned 404"}' ${{ secrets.WEBHOOK_URL }}
exit 1
fi
- name: download diyhrt.wiki
run: |
rm -rf diyhrt.wiki
wget -mkxKE -e robots=off --limit-rate=10m --random-wait --user-agent="github.com/soapingtime/diyhrt" --reject '*age-check*' https://diyhrt.wiki https://diyhrt.wiki/nav.html || true # downloads nav.html because it doesn't crawl properly without it
cd diyhrt.wiki && rm *.orig && cd ..
- name: setup python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: run agebypass.py # removes the age-check.js script because it was causing problems
run: python scripts/agebypass.py
- name: commit changes
if: ${{ success() }}
uses: EndBug/add-and-commit@v9
with:
add: "diyhrt.wiki"
pull: "--rebase --autostash ."
message: "[automated] update diyhrt.wiki"
default_author: github_actions