Skip to content

.github/workflows/update-schemas.yml #16

.github/workflows/update-schemas.yml

.github/workflows/update-schemas.yml #16

jobs:
test:
permissions:
contents: write
pull-requests: write
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install Nix
uses: cachix/install-nix-action@v26
with:
extra_nix_config: accept-flake-config = true
- uses: cachix/cachix-action@v14
with:
authToken: ${{ secrets.CACHIX_AUTH_TOKEN }}
name: nickel-schemastore
- env:
GH_TOKEN: ${{ github.token }}
name: Update the schemas from upstream
run: |-
nix develop --command python3 ./extract-schemas.py
if ! git diff --exit-code; then
BRANCH_NAME=update-schemas-from-$GITHUB_RUN_ID
git checkout -b "$BRANCH_NAME"
git add .
git config user.name "Schemas update bot"
git config user.email "noreply@schemaupdate.invalid"
git commit --message="Re-generate the schema files"
git push origin "$BRANCH_NAME"
nix run --inputs-from . nixpkgs\#gh -- pr create \
--head "$BRANCH_NAME" \
--title "Re-generate the schema files" \
--body "Automated update from $GITHUB_RUN_ID"
fi
on:
schedule:
- cron: 0 0 * * 0
workflow_dispatch: {}