-
Notifications
You must be signed in to change notification settings - Fork 0
chore: automate schemata version updates #33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
| 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" | ||
|
|
||
| - 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 }} | ||
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| v0.3.1 |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.