-
Notifications
You must be signed in to change notification settings - Fork 15
46 lines (44 loc) · 1.33 KB
/
update-data.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
name: Update data
on:
schedule:
# Run every day at 3:30.
- cron: '30 3 * * *'
workflow_dispatch:
jobs:
update-data:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.BOT_TOKEN }}
- uses: actions/setup-node@v4
with:
node-version-file: 'package.json'
cache: npm
- name: Install dependencies
run: npm ci
- name: Get dates for cache
id: dates
run: |
echo "now=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT
echo "yesterday=$(date -d 'yesterday' +'%Y-%m-%d')" >> $GITHUB_OUTPUT
- name: Cache data
uses: actions/cache@v4
with:
path: dump/data
key: ${{ steps.dates.outputs.now }}
restore-keys: ${{ steps.dates.outputs.yesterday }}
- name: Update data
run: |
cd dump
node wiki-ids.js
node wiki-rev.js
node wiki-update.js
node wiki-parse.js -p
- name: Commit changes
run: |
git config --local user.email "[email protected]"
git config --local user.name "cheminfo bot"
git add public/data.json public/smiles.txt public/idcode.txt stats.json
git commit -m "update data" -m "$(tail -2 stats.json | head -1 | jq '.')"
git push