Update data #769
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |