Load data #644
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: Load data | |
on: | |
workflow_dispatch: | |
schedule: | |
# run every day at 02:00 | |
- cron: '0 2 * * *' | |
jobs: | |
load: | |
runs-on: ubuntu-latest | |
name: Load project | |
environment: load | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v3 | |
- name: Configure git | |
run: | | |
git config user.name "${{ github.actor }}" | |
git config user.email "${{ github.actor }}@users.noreply.github.com" | |
- name: Install node 16 | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '16' | |
cache: npm | |
- name: Install project modules | |
run: npm ci | |
- name: Load contributions | |
env: | |
ORG_GITHUB_TOKEN: ${{ secrets.ORG_GITHUB_TOKEN }} | |
run: npm run load-contributions | |
- name: Verify new contributions | |
id: verify_contributions | |
# exit-code will exit 1 if found diff | |
run: git diff --exit-code src/resources/contributions.json | |
continue-on-error: true | |
- name: Push new contributions | |
# failure (exit 1) means diff found - needs to push | |
if: steps.verify_contributions.outcome == 'failure' | |
run: | | |
git add src/resources/contributions.json | |
git commit -m "chore: updated contributions" | |
git push origin HEAD |