-
Notifications
You must be signed in to change notification settings - Fork 2.4k
62 lines (54 loc) · 1.76 KB
/
audit-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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
name: Audit Wiki Links
on:
schedule:
- cron: '0 0 * * * ' # At the end of everyday
workflow_dispatch: # Or manually from GitHub UI
jobs:
Audit_Links:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Set credentials
run: |
git config --global user.email "polkadot-kusama-automation-bot@users.noreply.github.com"
git config --global user.name "Polkadot-Kusama Bot"
- name: Check for existing branch
run: |
if [[ $(git ls-remote --heads origin refs/heads/audit-links | wc -l) == "1" ]]; then
echo deleting existing branch
git push origin --delete audit-links
else
echo no existing branch found
fi
- name: Create new branch
run: |
git branch audit-links
git checkout audit-links
- name: Execute python
run: |
python -m pip install --upgrade pip
pip install requests
python './scripts/auditLinks.py'
- name: Check results for broken links
run: |
File="./Audit-Results.md"
echo Reading Audit...
if test -f "$File"; then
TEXT=$(cat ./Audit-Results.md)
echo "audit_result=true" >> $GITHUB_ENV
else
echo "$File does not exist"
echo "audit_result=false" >> $GITHUB_ENV
fi
- name: Create GitHub Issue
if: ${{ env.audit_result == 'true' }}
uses: "JasonEtco/create-an-issue@v2"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
filename: ./Audit-Results.md