Skip to content

Commit

Permalink
ci: test auto fetch
Browse files Browse the repository at this point in the history
  • Loading branch information
wxh06 committed Nov 12, 2023
1 parent 53d9466 commit b9e2687
Showing 1 changed file with 26 additions and 9 deletions.
35 changes: 26 additions & 9 deletions .github/workflows/fetch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@
name: Fetch data

on:
schedule:
# Runs at 00:00 UTC.
- cron: "0 0 * * *"
push:
branches: [dev]

permissions:
contents: write
Expand All @@ -22,15 +21,33 @@ jobs:
with:
go-version: stable

- name: Fetch
run: go run ./cmd/fetch
- name: Fetch data
run: echo Hello

- name: Commit
- name: Configure git
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add src/contests.json public/users.json
git diff-index --quiet HEAD || git commit -m "Fetch data"
- name: Push
- name: Commit fetched data
id: commit_fetched
continue-on-error: true
run: echo Hello

- name: Push to default branch
run: git push

- name: Extract user data
id: extract
if: ${{ steps.commit_fetched.outcome == 'success' }}
run: echo Hello

- name: Commit extracted user
if: ${{ steps.extract.outcome == 'success' }}
run: |
git add -f public/users/
git commit -m "Extract user data"
- name: Push to dist
if: ${{ steps.extract.outcome == 'success' }}
run: git push -f origin main:dist

0 comments on commit b9e2687

Please sign in to comment.