-
Notifications
You must be signed in to change notification settings - Fork 11
50 lines (47 loc) · 1.42 KB
/
sync_data_by_push.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
name: Sync running data by push running.csv
on:
push:
branches:
- master
paths:
- running.csv
env:
# change env here
GITHUB_NAME: naosense
GITHUB_EMAIL: [email protected]
jobs:
sync:
name: Build
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.11.4
- name: Get pip cache dir
id: pip-cache
run: |
echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT
- name: pip cache
uses: actions/cache@v3
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: |
python -m pip install --upgrade pip
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
if: steps.pip-cache.outputs.cache-hit != 'true'
- name: Generate new SVG file
run: |
python main.py push
- name: Commit and push updated SVG file
run: |
git config --local user.email "${{ env.GITHUB_EMAIL }}"
git config --local user.name "${{ env.GITHUB_NAME }}"
git commit -a -m 'sync running data by push' || echo "nothing to commit"
git push || echo "nothing to push"