-
Notifications
You must be signed in to change notification settings - Fork 0
47 lines (43 loc) · 1.33 KB
/
backup-api.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
# This workflow will run the "tools/scraper.py" script once a day, while also
# committing any changes to the repository.
name: Create API Backup
on:
schedule:
- cron: "0 */6 * * *"
workflow_dispatch: {}
jobs:
backup:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade --user -r tools/requirements.txt
- name: Configure git
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
- name: Run scraper
env:
SERVICE_ID: ${{secrets.REPO_SERVICE_ID}}
run: |
python tools/scraper.py
- name: Cancel workflow on error
if: ${{ failure() }}
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}
- name: Filter changes
run: |
git add data
git stash save --keep-index --include-untracked
- name: Commit and push relevant changes
continue-on-error: true
run: |
git commit -m "Automatic Scraper Update"
git push origin main