name: regen on: schedule: - cron: '0 9 * * 1' workflow_dispatch: inputs: commit: description: 'BSR commit id to record and regen against (e.g. 65e5c3248a1e)' required: false jobs: bump: name: Bump pinned schema runs-on: ubuntu-latest permissions: contents: write pull-requests: write steps: - uses: actions/checkout@v4 - uses: bufbuild/buf-action@v1 with: setup_only: true - name: Set up PHP uses: shivammathur/setup-php@v2 with: php-version: '8.4' extensions: json coverage: none - name: Resolve schema commit id: schema env: OVERRIDE: ${{ github.event.inputs.commit }} run: | resolved="$(buf registry module commit resolve \ buf.build/openstatus/api:main --format json)" commit="$(printf '%s' "$resolved" | jq -r '.commit')" source_url="$(printf '%s' "$resolved" | jq -r '.source_control_url')" if [ -n "$OVERRIDE" ]; then commit="$OVERRIDE" fi if [ -z "$commit" ] || [ "$commit" = "null" ]; then echo "::error::schema commit discovery returned empty" exit 1 fi echo "commit=$commit" >> "$GITHUB_OUTPUT" echo "source_control_url=$source_url" >> "$GITHUB_OUTPUT" - name: Run regen env: RESOLVED: ${{ steps.schema.outputs.commit }} run: bash scripts/regen.sh "$RESOLVED" - name: Install dependencies run: composer install --prefer-dist --no-progress --no-interaction - name: Static analysis run: composer analyse - name: Unit tests run: composer test -- --testsuite unit - name: Open PR if anything changed uses: peter-evans/create-pull-request@v6 with: token: ${{ secrets.SDK_BOT_TOKEN || github.token }} commit-message: 'chore: regen src/Gen from schema commit ${{ steps.schema.outputs.commit }}' title: 'chore: regen src/Gen from schema commit ${{ steps.schema.outputs.commit }}' body: | Automated regen of the Buf-generated PHP archive. Schema commit `${{ steps.schema.outputs.commit }}` resolved from `buf.build/openstatus/api:main`. Source: ${{ steps.schema.outputs.source_control_url }} `scripts/regen.sh` fetches the archive from the `main` label and writes the resolved commit to `src/Gen/VERSION`. Trigger this workflow manually with a `commit` input to override the resolved value. branch: regen/auto-bump delete-branch: true