-
Notifications
You must be signed in to change notification settings - Fork 0
58 lines (51 loc) · 1.71 KB
/
weekly.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
name: Weekly Download
on:
schedule:
- cron: "0 0 * * 0" # Every Sunday at 00:00
workflow_dispatch:
inputs:
card_count:
description: 'Number of cards to download (leave empty for all)'
required: false
type: number
jobs:
weekly:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.12
uses: actions/setup-python@v2
with:
python-version: "3.12.3"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Run Download
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ] && [ -n "${{ github.event.inputs.card_count }}" ]; then
# Convert to integer by removing decimal part
card_count=$(echo "${{ github.event.inputs.card_count }}" | awk '{print int($1)}')
python ./main.py --card-count $card_count
else
python ./main.py
fi
- name: Configure Git
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
- name: Commit changes
run: |
git add cards/
git add meta.json
git diff --quiet && git diff --staged --quiet || (git commit -m "Update dataset and build: $(date +'%Y-%m-%d %H:%M')")
- name: Install SSH key
uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.ACTION_DEPLOY_KEY }}
- name: Push changes
run: |
git remote set-url origin [email protected]:${{ github.repository }}.git
git push origin HEAD:${{ github.ref }}