WIP: Add Pyrefly support #988
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: Schema Breaking Changes Check | |
| on: | |
| pull_request: | |
| paths: | |
| - "marimo/_schemas/**/*.yaml" | |
| - "packages/openapi/api.yaml" | |
| permissions: | |
| contents: read | |
| pull-requests: write | |
| jobs: | |
| changes: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| openapi: ${{ steps.filter.outputs.openapi }} | |
| session: ${{ steps.filter.outputs.session }} | |
| notebook: ${{ steps.filter.outputs.notebook }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dorny/paths-filter@v3 | |
| id: filter | |
| with: | |
| filters: | | |
| openapi: | |
| - 'packages/openapi/api.yaml' | |
| session: | |
| - 'marimo/_schemas/generated/session.yaml' | |
| notebook: | |
| - 'marimo/_schemas/generated/notebook.yaml' | |
| check-schemas: | |
| needs: changes | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| schema: | |
| - name: openapi | |
| path: packages/openapi/api.yaml | |
| display_name: OpenAPI specification | |
| condition: ${{ needs.changes.outputs.openapi == 'true' }} | |
| - name: session | |
| path: marimo/_schemas/generated/session.yaml | |
| display_name: Session Schema | |
| condition: ${{ needs.changes.outputs.session == 'true' }} | |
| - name: notebook | |
| path: marimo/_schemas/generated/notebook.yaml | |
| display_name: Notebook Schema | |
| condition: ${{ needs.changes.outputs.notebook == 'true' }} | |
| steps: | |
| - name: Checkout current branch | |
| if: ${{ matrix.schema.condition }} | |
| uses: actions/checkout@v4 | |
| with: | |
| path: current | |
| - name: Checkout main branch | |
| if: ${{ matrix.schema.condition }} | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: main | |
| path: main | |
| - name: Install oasdiff | |
| if: ${{ matrix.schema.condition }} | |
| run: | | |
| curl -sSL https://raw.githubusercontent.com/tufin/oasdiff/master/install.sh | sh | |
| - name: Compare ${{ matrix.schema.display_name }} | |
| if: ${{ matrix.schema.condition }} | |
| id: compare | |
| run: | | |
| BREAKING_CHANGES=$(oasdiff breaking main/${{ matrix.schema.path }} current/${{ matrix.schema.path }}) | |
| if [ -n "$BREAKING_CHANGES" ]; then | |
| echo "breaking_changes<<EOF" >> $GITHUB_OUTPUT | |
| echo "$BREAKING_CHANGES" >> $GITHUB_OUTPUT | |
| echo "EOF" >> $GITHUB_OUTPUT | |
| echo "Breaking changes detected:" | |
| echo "$BREAKING_CHANGES" | |
| exit 1 | |
| else | |
| echo "No breaking changes detected" | |
| fi | |
| - name: Comment on PR | |
| if: ${{ failure() && matrix.schema.condition }} | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| const output = `Breaking changes detected in the ${{ matrix.schema.display_name }}! | |
| ${{ steps.compare.outputs.breaking_changes }}` | |
| github.rest.issues.createComment({ | |
| issue_number: context.issue.number, | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| body: output | |
| }) |