-
Notifications
You must be signed in to change notification settings - Fork 3
99 lines (82 loc) · 3.01 KB
/
analyze-wishlist.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
name: analyze-wishlist
on:
schedule:
- cron: '0 4 */7 * *' # 4:00 UTC every 7 days
workflow_dispatch:
permissions:
contents: write
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.13"]
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: get site-packages path
id: site_packages
run: echo "site_dir=$(python -c 'import site; print(site.getsitepackages()[0])')" > "$GITHUB_OUTPUT"
- name: cache installed packages
uses: actions/cache@v4
with:
path: ${{ steps.site_packages.outputs.site_dir }}
key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('**/requirements.txt') }}
restore-keys: ${{ runner.os }}-pip-
- name: install python packages
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: execute py script
run: python swc.py -i=${{ secrets.STEAM_ID }} -d=True
- name: check changes
id: check_changes
run: if [[ $(git diff --name-only HEAD) == *"output/successful.txt"* ]]; then echo "changes=true" > "$GITHUB_OUTPUT"; else echo "changes=false" > "$GITHUB_OUTPUT"; fi
- name: commit files
if: ${{ steps.check_changes.outputs.changes == 'true' }}
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add -A
git commit -m "Update wishlist data." -a
- name: push changes
if: ${{ steps.check_changes.outputs.changes == 'true' }}
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: main
- name: Stash png outputs
if: ${{ steps.check_changes.outputs.changes == 'true' }}
run: |
git add -f output/*.png
git stash
- name: checkout output branch
if: ${{ steps.check_changes.outputs.changes == 'true' }}
uses: actions/checkout@v4
with:
ref: output
- name: Get png outputs from stash
if: ${{ steps.check_changes.outputs.changes == 'true' }}
run: |
set -e
git stash apply || true
git checkout --theirs -- output/*.png
git stash drop
- name: commit plots
if: ${{ steps.check_changes.outputs.changes == 'true' }}
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add -A
git commit --amend --no-edit
- name: push plots to output branch
if: ${{ steps.check_changes.outputs.changes == 'true' }}
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: output
force: True