Skip to content

Fetch data

Fetch data #251

Workflow file for this run

---
name: Fetch data
on:
schedule:
# Runs at 00:00 UTC.
- cron: "0 0 * * *"
workflow_dispatch:
permissions:
contents: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
lfs: true
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: stable
- name: Configure git
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
- name: Fetch data
run: go run ./cmd/fetch
- name: Commit fetched data
id: commit_fetched
continue-on-error: true
run: |
git add src/contests.json public/users.json
git commit -m "Fetch data"
- name: Push to default branch
if: ${{ steps.commit_fetched.outcome == 'success' }}
run: git push
- name: Extract user data
if: ${{ steps.commit_fetched.outcome == 'success' }}
run: go run ./cmd/extract
- name: Commit extracted user
if: ${{ steps.commit_fetched.outcome == 'success' }}
run: |
git add -f public/users/
git commit -m "Extract user data"
- name: Push to dist
if: ${{ steps.commit_fetched.outcome == 'success' }}
run: git push -f origin main:dist