forked from w3f/polkadot-wiki
-
Notifications
You must be signed in to change notification settings - Fork 0
55 lines (48 loc) · 1.7 KB
/
audit-images.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
name: Audit Wiki Images
on:
schedule:
- cron: '0 0 1 * * ' # Once a month
workflow_dispatch: # Or manually from GitHub UI
jobs:
Audit_Images:
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 "[email protected]"
git config --global user.name "Polkadot-Kusama Bot"
- name: Check for existing branch
run: |
if [[ $(git ls-remote --heads origin refs/heads/audit-images | wc -l) == "1" ]]; then
echo deleting existing branch
git push origin --delete audit-images
else
echo no existing branch found
fi
- name: Create new branch
run: |
git branch audit-images
git checkout audit-images
- name: Execute python
run: |
python -m pip install --upgrade pip
pip install requests
python './scripts/auditImages.py'
- name: Commit any changes from image archiving execution and make new PR
run: |
if [[ `git status --porcelain` ]]; then
git add -A
git commit -a -m 'Archiving unused images'
git push --set-upstream origin audit-images
gh pr create -B master -H audit-images --title 'Automated image archiving' --body 'Automated image auditing over entire repo.'
else
echo No unused images found, no changes to commit.
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}