name: regen on: schedule: - cron: "0 7 * * 1" workflow_dispatch: permissions: contents: write pull-requests: write jobs: regen: name: bump protobuf schema pin runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: bufbuild/buf-action@v1 with: setup_only: true - name: Resolve schema commit id: schema run: | json=$(buf registry module commit resolve \ buf.build/openstatus/api:main --format json) commit=$(jq -r '.commit' <<< "$json") source_url=$(jq -r '.source_control_url' <<< "$json") if [[ -z "$commit" || "$commit" == "null" ]]; then echo "::error::schema commit resolution returned empty" exit 1 fi echo "commit=$commit" >> "$GITHUB_OUTPUT" echo "source_url=$source_url" >> "$GITHUB_OUTPUT" - name: Regenerate run: bash scripts/regen.sh "${{ steps.schema.outputs.commit }}" - name: Bump patch version run: | if git diff --quiet -- src/openstatus/_gen; then echo "no schema change; skipping version bump" exit 0 fi cur=$(grep -oP '^version = "\K[^"]+' pyproject.toml) IFS=. read -r maj min pat <<< "$cur" next="$maj.$min.$((pat + 1))" sed -i -E "0,/^version = \"[^\"]+\"/s//version = \"$next\"/" pyproject.toml echo "bumped $cur -> $next" - name: Open PR uses: peter-evans/create-pull-request@v6 with: token: ${{ secrets.SDK_BOT_TOKEN || github.token }} branch: regen/${{ steps.schema.outputs.commit }} commit-message: "chore: bump buf schema to ${{ steps.schema.outputs.commit }}" title: "chore: bump buf schema to ${{ steps.schema.outputs.commit }}" body: | Automated regeneration from `buf.build/openstatus/api` schema commit `${{ steps.schema.outputs.commit }}`. Source: ${{ steps.schema.outputs.source_url }}