Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 516
chore: production deploy#5657
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
chore: production deploy #5657
Changes from all commits
b1864cb41159af7c35fd63d3ca0253ea9e5ca86ec757111ae21b0c12cbbcd06c6127daaa764ec049e95b79fdcbd32ef81c17546b3df41fbca60a5321d113d74f94f6de09cf293016806557e3eb7264b7c0d631643eb35e582e5fe262f7b8388c94c9e404074979afe523a5db68e119e18de126cf3b6c389612825893960a39d6bdafbbc60917a84e650fcceddfceef8db5c4a3d775bb3ba7ef2864260c1afcaa27b4dec6274c88c839c21c090222aa69205ff2ce303a41d9f2b64cdb69df3c74062966101bf36110df4840d314f76b672b156fa5fd53f583a0242812b04f390704b9db47a6d45671338e6fefe607346fec889e3ccd88062fce26ac145a7d2e56ff1a86dcb9e53148d4b44bb25741712f9dba23ded0958f76140ced5c2ac262ba49133c108d24e26d9c8File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Diff view
Diff view
Uh oh!
There was an error while loading. Please reload this page.
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| #!/usr/bin/env bash | ||
| # Delete every staging project whose name starts with the given prefix (the live | ||
| # e2e job's per-run prefix). Shared by the in-run retry sweep (called best-effort | ||
| # with `|| true`) and the always() cleanup step (which propagates the exit code). | ||
| # | ||
| # Reads SUPABASE_ACCESS_TOKEN + CLI_E2E_API_URL from the environment. Exits | ||
| # non-zero if any DELETE failed; a failed *listing* also exits non-zero (pipefail). | ||
| set -o pipefail | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When the initial Useful? React with 👍 / 👎. | ||
| PREFIX="${1:?usage: sweep-live-projects.sh PREFIX}" | ||
| : "${SUPABASE_ACCESS_TOKEN:?SUPABASE_ACCESS_TOKEN required}" | ||
| : "${CLI_E2E_API_URL:?CLI_E2E_API_URL required}" | ||
| # Capture the list in a var (not a pipe-to-while subshell) so a failed delete is | ||
| # recorded in $failed; a failed listing aborts here via pipefail. | ||
| refs=$(curl -fsS -H "Authorization: Bearer ${SUPABASE_ACCESS_TOKEN}" \ | ||
| "${CLI_E2E_API_URL}/v1/projects" \ | ||
| | jq -r --arg p "$PREFIX" '.[] | select(.name|startswith($p)) | .ref // .id') | ||
| failed=0 | ||
| for ref in $refs; do | ||
| [ -n "$ref" ] || continue | ||
| echo "deleting leftover project $ref" | ||
| if ! curl -fsS -X DELETE -H "Authorization: Bearer ${SUPABASE_ACCESS_TOKEN}" \ | ||
| "${CLI_E2E_API_URL}/v1/projects/${ref}" >/dev/null; then | ||
| echo "::error::failed to delete leftover project $ref" | ||
| failed=1 | ||
| fi | ||
| done | ||
| exit "$failed" | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -9,71 +9,18 @@ permissions: | ||
| contents: read | ||
| jobs: | ||
| detect: | ||
| name: Detect OpenAPI changes | ||
| runs-on: blacksmith-8vcpu-ubuntu-2404 | ||
| outputs: | ||
| has_changes: ${{ steps.compare.outputs.has_changes }} | ||
| steps: | ||
| - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 | ||
| with: | ||
| persist-credentials: false | ||
| - name: Compare upstream OpenAPI spec | ||
| id: compare | ||
| shell: bash | ||
| run: | | ||
| set -euo pipefail | ||
| remote_spec="$RUNNER_TEMP/openapi.remote.json" | ||
| remote_normalized="$RUNNER_TEMP/openapi.remote.normalized.json" | ||
| tracked_normalized="$RUNNER_TEMP/openapi.tracked.normalized.json" | ||
| normalize_filter="$RUNNER_TEMP/normalize-openapi.jq" | ||
| curl -fsS https://api.supabase.com/api/v1-json -o "$remote_spec" | ||
| cat > "$normalize_filter" <<'JQ' | ||
| def pointer_path($p): $p | split("/")[1:] | map(gsub("~1"; "/") | gsub("~0"; "~")); | ||
| reduce ($overrides[0] // [])[] as $op (.; | ||
| if $op.op == "test" then | ||
| if getpath(pointer_path($op.path)) == $op.value then | ||
| . | ||
| else | ||
| error("OpenAPI override test failed at \($op.path)") | ||
| end | ||
| elif $op.op == "replace" then | ||
| setpath(pointer_path($op.path); $op.value) | ||
| else | ||
| error("Unsupported OpenAPI override op \($op.op)") | ||
| end | ||
| ) | ||
| JQ | ||
| jq -S --slurpfile overrides packages/api/scripts/openapi-overrides.json \ | ||
| -f "$normalize_filter" "$remote_spec" > "$remote_normalized" | ||
| jq -S . packages/api/src/generated/openapi.json > "$tracked_normalized" | ||
| if cmp -s "$remote_normalized" "$tracked_normalized"; then | ||
| echo "No upstream OpenAPI changes detected." | ||
| echo "has_changes=false" >> "$GITHUB_OUTPUT" | ||
| else | ||
| echo "Upstream OpenAPI changes detected." | ||
| echo "has_changes=true" >> "$GITHUB_OUTPUT" | ||
| diff -u "$tracked_normalized" "$remote_normalized" | sed -n '1,160p' || true | ||
| fi | ||
| sync: | ||
| name: Sync API package | ||
| needs: detect | ||
| if: needs.detect.outputs.has_changes == 'true' | ||
| runs-on: blacksmith-8vcpu-ubuntu-2404 | ||
| steps: | ||
| - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 | ||
| - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | ||
| with: | ||
| persist-credentials: false | ||
| - name: Setup | ||
| uses: ./.github/actions/setup | ||
| with: | ||
| dependency-firewall-token: ${{ secrets.DF_FIREWALL_TOKEN }} | ||
| - name: Regenerate API package | ||
| run: pnpm generate | ||
| @@ -105,6 +52,7 @@ jobs: | ||
| - name: Create Pull Request | ||
| if: steps.check.outputs.has_changes == 'true' | ||
| id: cpr | ||
| uses: peter-evans/create-pull-request@5f6978faf089d4d20b00c7766989d076bb2fc7f1 # v8.1.1 | ||
| with: | ||
| token: ${{ steps.app-token.outputs.token }} | ||
| @@ -116,3 +64,18 @@ jobs: | ||
| Changes were detected in the upstream OpenAPI document exposed by `https://api.supabase.com/api/v1-json`. | ||
| branch: sync/api-package | ||
| base: develop | ||
| - name: Approve a PR | ||
| if: steps.check.outputs.has_changes == 'true' && steps.cpr.outputs.pull-request-operation == 'created' | ||
| continue-on-error: true | ||
| run: gh pr review --approve --repo "${{ github.repository }}" "${STEPS_CPR_OUTPUTS_PULL_REQUEST_NUMBER}" | ||
| env: | ||
| GH_TOKEN: ${{ steps.app-token.outputs.token }} | ||
| STEPS_CPR_OUTPUTS_PULL_REQUEST_NUMBER: ${{ steps.cpr.outputs.pull-request-number }} | ||
| - name: Enable Pull Request Automerge | ||
| if: steps.check.outputs.has_changes == 'true' | ||
| run: gh pr merge --auto --squash --repo "${{ github.repository }}" "${STEPS_CPR_OUTPUTS_PULL_REQUEST_NUMBER}" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 Severity: MEDIUM This new auto-approve + auto-merge pipeline, combined with the CODEOWNERS change making 💡 Fix SuggestionSuggestion: This supply-chain risk requires a coordinated set of changes across multiple files to ensure generated code cannot be merged without human review:
Implementing steps 1–3 together ensures that auto-created sync PRs require a genuine human review and approval from a codeowner before they can be merged into the | ||
| env: | ||
| GH_TOKEN: ${{ steps.app-token.outputs.token }} | ||
| STEPS_CPR_OUTPUTS_PULL_REQUEST_NUMBER: ${{ steps.cpr.outputs.pull-request-number }} | ||
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.