update-latest-quiz #46
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: update-latest-quiz | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: "0 9 * * 5" | |
jobs: | |
update-quiz: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Run script | |
id: run_script | |
run: | | |
OUTPUT=$(./scripts/sync.sh) | |
echo "$OUTPUT" | |
echo "SLUG=$OUTPUT" >> $GITHUB_ENV | |
- name: Check for changes | |
id: check_changes | |
run: | | |
git diff --exit-code && exit 1 || exit 0 | |
- name: Install latest rust toolchain | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
default: true | |
override: true | |
- name: Setup go-task | |
uses: pnorton5432/setup-task@v1 | |
with: | |
task-version: 3.29.1 | |
- name: Save questions | |
run: | | |
cd kviss-db | |
cargo build --release | |
./target/release/kviss-db --slug "$SLUG" | |
- name: Make thematic image | |
env: | |
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | |
run: | | |
./scripts/image-gen.sh "$SLUG" | |
- name: Commit and push changes | |
run: | | |
git config --global user.name 'github-actions[bot]' | |
git config --global user.email 'github-actions[bot]@users.noreply.github.com' | |
git add . | |
git commit -m "chore: update content" | |
git push |