Skip to content

release 4.51.0

release 4.51.0 #18

name: Update SchemaStore
on:
push:
tags: ["*"]
permissions:
contents: read
jobs:
update-schemastore:
runs-on: ubuntu-24.04
environment: schemastore
env:
GH_TOKEN: ${{ secrets.SCHEMASTORE_TOKEN }}
BRANCH: update-tox-schema
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
persist-credentials: false
- 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