Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .github/workflows/classifier-gate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,14 @@ jobs:
with:
path: schemata-codegen

- name: Read schemata version
run: echo "SCHEMATA_VERSION=$(cat schemata-codegen/.schemata-version | tr -d '[:space:]')" >> "$GITHUB_ENV"

- name: Checkout schemata
uses: actions/checkout@v4
with:
repository: nostrability/schemata
ref: v0.3.1
ref: ${{ env.SCHEMATA_VERSION }}
path: schemata

- name: Setup Node.js
Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/compile-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,14 @@ jobs:
- name: Build codegen
run: npm run build

- name: Read schemata version
run: echo "SCHEMATA_VERSION=$(cat .schemata-version | tr -d '[:space:]')" >> "$GITHUB_ENV"

- name: Download schemata schemas
run: |
gh release download v0.3.0 -R nostrability/schemata -p '*.zip' -D /tmp
gh release download "$SCHEMATA_VERSION" -R nostrability/schemata -p '*.zip' -D /tmp
mkdir -p /tmp/schemata-dist
unzip -q /tmp/schemata-v0.3.0.zip -d /tmp/schemata-dist
unzip -q /tmp/schemata-*.zip -d /tmp/schemata-dist
echo "SCHEMAS_DIR=/tmp/schemata-dist" >> "$GITHUB_ENV"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
75 changes: 75 additions & 0 deletions .github/workflows/update-schemata.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: Update schemata version

on:
repository_dispatch:
types: [schema-update]
workflow_dispatch:
inputs:
tag:
description: "Schemata release tag (e.g. v0.4.0)"
required: true

jobs:
bump-version:
runs-on: ubuntu-latest
steps:
- name: Determine tag
run: |
if [ "${{ github.event_name }}" = "repository_dispatch" ]; then
TAG="${{ github.event.client_payload.tag }}"
else
TAG="${{ github.event.inputs.tag }}"
fi
if [ -z "$TAG" ]; then
echo "::error::Missing TAG — neither client_payload.tag nor inputs.tag was set" >&2
exit 1
fi
echo "TAG=$TAG" >> "$GITHUB_ENV"
echo "BRANCH=chore/bump-schemata-${TAG}" >> "$GITHUB_ENV"
Comment thread
coderabbitai[bot] marked this conversation as resolved.

- uses: actions/checkout@v4
with:
token: ${{ secrets.CODEGEN_PAT }}

- name: Check if already up to date
run: |
CURRENT="$(cat .schemata-version | tr -d '[:space:]')"
if [ "$CURRENT" = "$TAG" ]; then
echo "Already at $TAG — nothing to do."
echo "SKIP=true" >> "$GITHUB_ENV"
fi

- name: Close existing bump PRs
if: env.SKIP != 'true'
run: |
gh pr list --state open --head "chore/bump-schemata-" --json number --jq '.[].number' \
| xargs -I{} gh pr close {} --comment "Superseded by bump to $TAG" || true
env:
GH_TOKEN: ${{ secrets.CODEGEN_PAT }}

- name: Create branch and update version
if: env.SKIP != 'true'
run: |
git checkout -b "$BRANCH"
echo "$TAG" > .schemata-version
git add .schemata-version
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git commit -m "chore: bump schemata to $TAG"
git push --force-with-lease -u origin "$BRANCH"

- name: Create pull request
if: env.SKIP != 'true'
run: |
gh pr create \
--title "chore: bump schemata to $TAG" \
--body "Automated bump triggered by upstream schemata release.

- Updates \`.schemata-version\` to \`$TAG\`
- CI (classifier-gate + compile-check) will validate compatibility

If CI fails, new unclassified patterns may need attention." \
--head "$BRANCH" \
--base main
env:
GH_TOKEN: ${{ secrets.CODEGEN_PAT }}
1 change: 1 addition & 0 deletions .schemata-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v0.3.1
Loading