This repository has been archived by the owner on Oct 30, 2024. It is now read-only.
Fetch data #346
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 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 |