Skip to content

Update Card Database #2

Update Card Database

Update Card Database #2

Workflow file for this run

name: Update Card Database
on:
schedule:
- cron: '0 0 * * 1' # Runs every Monday at midnight
workflow_dispatch: # Allows manual triggering
permissions:
contents: write
pull-requests: write
jobs:
update-cards:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup Bun
uses: oven-sh/setup-bun@v1
- name: Install dependencies
run: bun install
- name: Download latest Scryfall data
run: |
# Fetch the bulk data URL for all cards
DOWNLOAD_URL=$(curl -s https://api.scryfall.com/bulk-data | jq -r '.data[] | select(.type=="all_cards") | .download_uri')
echo "Downloading from: $DOWNLOAD_URL"
# Download and extract the data
curl -L -o processing/cards.json "$DOWNLOAD_URL"
- name: Process cards
run: |
cd processing
bun process.ts
- name: Move processed file
run: |
rm -f public/cards.json
mv processing/processed.json public/cards.json
- name: Create Pull Request
uses: peter-evans/create-pull-request@v6
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: "chore: update card database"
title: "Update Scryfall card database"
body: |
Automated update of the Scryfall card database.
This PR was automatically generated by the update-cards workflow.
- Data source: https://api.scryfall.com/bulk-data
branch: update-cards
delete-branch: true