Skip to content

Commit

Permalink
Add workflow to automatically update ODB schema weekly
Browse files Browse the repository at this point in the history
  • Loading branch information
hugo-vrijswijk committed Jan 12, 2024
1 parent 29b1a39 commit 1c83c0f
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions .github/workflows/update-schema.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Update schemas

on:
schedule:
# Every week
- cron: '0 0 * * 1'
workflow_dispatch:
# TODO: Remove after testing
push:
branches:
- schema-gha

permissions:
contents: write
pull-requests: write

jobs:
update-odb-schema:
runs-on: ubuntu-latest
steps:
- name: Checkout current branch (full)
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup node
uses: actions/setup-node@v2
with:
node-version: 20
- name: Install graphqurl
run: npm install -g graphqurl
- name: Fetch latest ODB schema
run: ./fetchODBSchema.sh dev
env:
ODB_API_KEY: ${{ secrets.ODB_DEV_API_KEY }}
- name: Commit and push changes
run: |
git config --local user.name 'lucuma-steward[bot]'
git config --local user.email '106720676+lucuma-steward[bot]@users.noreply.github.com'
git checkout -b steward/update-odb-schema
git add .
git commit -m 'Update ODB Schema' || exit 0
git push --force --set-upstream origin steward/update-odb-schema
gh pr create --fill --base main || exit 0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit 1c83c0f

Please sign in to comment.