regen #1
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
| 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 | |
| - name: Discover latest archive version | |
| id: latest | |
| run: | | |
| current=$(grep -E 'readonly BUF_PY_VERSION="' scripts/regen.sh \ | |
| | sed -E 's/.*="([^"]+)".*/\1/') | |
| echo "current=$current" >> "$GITHUB_OUTPUT" | |
| # Buf does not expose a public version-list endpoint; we resolve | |
| # `main` to a pinned ref by introspecting the redirect target. | |
| latest=$(curl -sI \ | |
| "https://buf.build/gen/archive/openstatus/api/protocolbuffers/python/main.zip" \ | |
| | grep -i '^location:' | sed -E 's/.*\/([^/]+)\.zip.*/\1/' | tr -d '\r') | |
| echo "latest=$latest" >> "$GITHUB_OUTPUT" | |
| - name: No-op when already up to date | |
| if: steps.latest.outputs.latest == steps.latest.outputs.current | |
| run: echo "Already on ${{ steps.latest.outputs.current }}; nothing to do." | |
| - name: Bump pin and regenerate | |
| if: steps.latest.outputs.latest != steps.latest.outputs.current | |
| run: | | |
| sed -i -E "s/(readonly BUF_PY_VERSION=)\"[^\"]+\"/\1\"${{ steps.latest.outputs.latest }}\"/" \ | |
| scripts/regen.sh | |
| bash scripts/regen.sh | |
| - name: Open PR | |
| if: steps.latest.outputs.latest != steps.latest.outputs.current | |
| uses: peter-evans/create-pull-request@v6 | |
| with: | |
| branch: regen/${{ steps.latest.outputs.latest }} | |
| commit-message: "chore: bump buf schema to ${{ steps.latest.outputs.latest }}" | |
| title: "chore: bump buf schema to ${{ steps.latest.outputs.latest }}" | |
| body: | | |
| Automated bump of the pinned `protocolbuffers/python` archive | |
| version from `${{ steps.latest.outputs.current }}` to | |
| `${{ steps.latest.outputs.latest }}`. |