Fetch and Save Data #24
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: Fetch and Save Data | |
on: | |
schedule: | |
- cron: '0 8 * * 1-5' # Every weekday at 8am | |
push: | |
branches: | |
- master | |
workflow_dispatch: | |
jobs: | |
fetch_data: | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: ./docs | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '19' | |
- name: Install dependencies | |
run: npm install | |
- name: Fetch and save data | |
env: | |
GITHUB_TOKEN: ${{ secrets.TOKEN_GITHUB }} | |
run: node fetchAndSaveData.js | |
- name: Commit and push changes | |
run: | | |
git config user.name "github-actions[bot]" | |
git config user.email "github-actions[bot]@users.noreply.github.com" | |
git add data.json | |
git commit -m "Update data.json [skip ci]" || exit 0 | |
git push |