-
Notifications
You must be signed in to change notification settings - Fork 0
43 lines (40 loc) · 1.32 KB
/
check_links.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# Job to run links availability checker script
name: Run links availability checker
on:
schedule:
- cron: '52 15 * * *'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4.1.4
- uses: actions/setup-python@v5.1.0
with:
python-version: '3.x'
- name: Install dependencies
run: pip install -r .github/links-health-checker/requirements.txt
- name: Call script
run: python .github/links-health-checker/main.py
- name: Prepare creds
run: |
git config user.email "no-reply@github.com"
git config user.name "Broken links checker bot"
- name: Delete branch if there are no broken links
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
test -f broken-links.txt ||
git push origin -d broken-links ||
exit 0
- name: Create commit and push if there are broken links
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
test -f broken-links.txt || exit 0
git branch -f broken-links &&
git checkout broken-links &&
git add broken-links.txt &&
git commit -m "Found broken links" &&
git push -f origin broken-links &&
echo "Found broken links" &&
exit 1