Skip to content

release 4.48.1

release 4.48.1 #11

name: Update SchemaStore
on:
push:
tags: ["*"]
permissions:
contents: read
jobs:
update-schemastore:
runs-on: ubuntu-24.04
env:
GH_TOKEN: ${{ secrets.SCHEMASTORE_TOKEN }}
BRANCH: update-tox-schema
steps:
- uses: actions/checkout@v6
- name: Fork and clone SchemaStore
run: gh repo fork SchemaStore/schemastore --clone --remote -- /tmp/schemastore
- name: Create or reset branch from upstream
run: |
git fetch upstream master
git switch -C "$BRANCH" upstream/master
working-directory: /tmp/schemastore
- name: Update schema and check for changes
id: diff
run: |
python3 -c "
import json, sys
with open('${{ github.workspace }}/src/tox/tox.schema.json') as f:
new = json.load(f)
new['\$id'] = 'https://json.schemastore.org/tox.json'
with open('/tmp/schemastore/src/schemas/json/tox.json') as f:
old = json.load(f)
if new == old:
sys.exit(1)
with open('/tmp/schemastore/src/schemas/json/tox.json', 'w') as f:
json.dump(new, f, indent=2)
f.write('\n')
" && echo "changed=true" >> "$GITHUB_OUTPUT" || echo "changed=false" >> "$GITHUB_OUTPUT"
- name: Commit and push
if: steps.diff.outputs.changed == 'true'
run: |
gh auth setup-git
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add src/schemas/json/tox.json
git commit -m "Update tox JSON Schema to ${{ github.ref_name }}"
git push --force origin "$BRANCH"
working-directory: /tmp/schemastore
- name: Create or update pull request
if: steps.diff.outputs.changed == 'true'
run: |
FORK_OWNER=$(gh api user --jq .login)
HEAD="$FORK_OWNER:$BRANCH"
if ! gh pr view "$HEAD" --repo SchemaStore/schemastore > /dev/null 2>&1; then
gh pr create \
--repo SchemaStore/schemastore \
--head "$HEAD" \
--title "Update tox JSON Schema to ${{ github.ref_name }}" \
--body "Updates tox's JSON Schema to [${{ github.sha }}](https://github.com/tox-dev/tox/commit/${{ github.sha }}) (release ${{ github.ref_name }})."
else
gh pr edit "$HEAD" --repo SchemaStore/schemastore \
--title "Update tox JSON Schema to ${{ github.ref_name }}" \
--body "Updates tox's JSON Schema to [${{ github.sha }}](https://github.com/tox-dev/tox/commit/${{ github.sha }}) (release ${{ github.ref_name }})."
fi