-
Notifications
You must be signed in to change notification settings - Fork 56
50 lines (41 loc) · 1.26 KB
/
auto.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: Auto Updater
on:
schedule:
- cron: '34 4,16 * * *' # every day at 4:34 and 16:34
workflow_dispatch:
jobs:
run-scripts:
runs-on: ubuntu-latest
environment: OhEarningsCal
steps:
- uses: actions/checkout@v4
- name: Reset local changes
run: |
git fetch origin main
git reset --hard origin/main
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install dependencies
run: npm install
- name: Run fetchEarningsCalendarData script
run: node ./api/github_get.js
env:
SHOULD_GEN_SELECTED: ${{ vars.SHOULD_GEN_SELECTED }}
SHOULD_GEN_ALL: ${{ vars.SHOULD_GEN_ALL }}
- name: Waiting for 10 seconds
run: sleep 10
- name: Run genAllIcs script
run: node ./api/github_gen.js
env:
SHOULD_GEN_SELECTED: ${{ vars.SHOULD_GEN_SELECTED }}
SHOULD_GEN_ALL: ${{ vars.SHOULD_GEN_ALL }}
- name: Commit files
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add -A
CURRENT_DATE=$(date +"%Y-%m-%d")
git commit -m "Bot auto update - $CURRENT_DATE" -a || echo "No changes to commit"
git push --force