forked from sdruskat/cfftracker
-
Notifications
You must be signed in to change notification settings - Fork 0
59 lines (49 loc) · 1.6 KB
/
update.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
# SPDX-FileCopyrightText: 2021 Stephan Druskat <[email protected]>
# SPDX-License-Identifier: CC0-1.0
name: Update data
on:
schedule:
- cron: "0 22 * * *" #runs at 22:00 UTC everyday
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Set up cache
uses: actions/cache@master
id: cache
with:
path: ${{ env.pythonLocation}}/lib/python3.8/site-packages/*
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
${{ runner.os }}-
- name: Install Python requirements
if: steps.cache.outputs.cache-hit != 'true'
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Update the file count
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # if run.py requires passwords..etc, set it as secrets
run: |
python query_api.py
python clean_plot.py
cat current_count.txt
- name: Commit updated files
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git add -A
git commit -m "Update data"
- name: Push changes
uses: ad-m/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: main