Repository navigation
feat(platform)!: getSession with the socket path from the session, and asyncapi.json from production #313
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
Merged
Merged
feat(platform)!: getSession with the socket path from the session, and asyncapi.json from production #313
Changes from 1 commit
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
2316986
chore(platform): sync asyncapi.json from production
amitbardos 686327c
feat(platform)!: take the socket session from one getSession pass-thr…
amitbardos 5bea8e5
ci(platform): sync asyncapi.json from production every hour
amitbardos 04e627a
feat(platform): forward events the SDK doesn't know to onEvent
amitbardos 1e32084
fix(platform): ignore an unknown event with no app room
amitbardos 48a883b
ci(platform): skip the sync push when the open PR already has the cha…
amitbardos File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
ci(platform): sync asyncapi.json from production every hour
An hourly workflow (and workflow_dispatch) compares https://app.base44.com/api/asyncapi.json with the committed copy first, so a run with nothing new stops before installing anything. When they differ it regenerates the event types, builds the docs, runs the Platform SDK tests and opens or updates one rolling PR on bot/platform-asyncapi-sync. It closes that PR when main already matches production. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Loading branch information
commit 5bea8e5891547d61475e1bbb3edb195169fe4e18
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,103 @@ | ||
| name: Sync Platform SDK AsyncAPI | ||
|
|
||
| # Refreshes packages/platform/asyncapi.json from production and regenerates the event | ||
| # types from it. Changes go to one rolling PR; closing it without merging only skips | ||
| # that run, since the next one proposes the same changes again. | ||
|
|
||
| on: | ||
| schedule: | ||
| - cron: "15 * * * *" # Every hour | ||
| workflow_dispatch: | ||
|
|
||
| permissions: | ||
| contents: write | ||
| pull-requests: write | ||
|
|
||
| concurrency: | ||
| group: sync-asyncapi | ||
| cancel-in-progress: false | ||
|
|
||
| env: | ||
| BRANCH: bot/platform-asyncapi-sync | ||
| ASYNCAPI_URL: https://app.base44.com/api/asyncapi.json | ||
|
|
||
| jobs: | ||
| sync: | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4 | ||
| with: | ||
| ref: main | ||
|
|
||
| - name: Wix gateway proxy (mandatory) | ||
| uses: ./.github/actions/wix-gateway-proxy | ||
|
|
||
| - name: Compare with production | ||
| id: production | ||
| run: | | ||
| curl -sf "$ASYNCAPI_URL" -o "$RUNNER_TEMP/asyncapi.json" | ||
| if python3 -c 'import json, sys; sys.exit(json.load(open(sys.argv[1])) != json.load(open(sys.argv[2])))' "$RUNNER_TEMP/asyncapi.json" packages/platform/asyncapi.json; then | ||
| echo "same=true" >> "$GITHUB_OUTPUT" | ||
| fi | ||
|
|
||
| - name: Use Node.js 20.x | ||
| if: steps.production.outputs.same != 'true' | ||
| uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4 | ||
| with: | ||
| node-version: "20.x" | ||
| cache: "npm" | ||
|
|
||
| - name: Install dependencies | ||
| if: steps.production.outputs.same != 'true' | ||
| run: npm ci | ||
|
|
||
| - name: Sync asyncapi.json and regenerate the event types | ||
| if: steps.production.outputs.same != 'true' | ||
| run: | | ||
| npm run sync:asyncapi -w @base44/platform -- "$ASYNCAPI_URL" | ||
| npm run gen:events -w @base44/platform | ||
|
|
||
| - name: Check for changes | ||
| id: changes | ||
| run: | | ||
| if git diff --quiet -- packages/platform/asyncapi.json packages/platform/src/modules/builder.events.generated.ts; then | ||
| echo "changed=false" >> "$GITHUB_OUTPUT" | ||
| echo "✅ asyncapi.json and the event types are up to date" | ||
| else | ||
| echo "changed=true" >> "$GITHUB_OUTPUT" | ||
| fi | ||
|
|
||
| - name: Close a stale sync PR | ||
| if: steps.changes.outputs.changed == 'false' | ||
| env: | ||
| GH_TOKEN: ${{ github.token }} | ||
| run: | | ||
| pr=$(gh pr list --head "$BRANCH" --state open --json number --jq '.[0].number') | ||
| if [ -n "$pr" ]; then gh pr close "$pr" --delete-branch --comment "main already matches production."; fi | ||
|
|
||
| - name: Build the docs and test the Platform SDK | ||
| if: steps.changes.outputs.changed == 'true' | ||
| run: | | ||
| npm run create-docs -w @base44/platform | ||
| npm test -w @base44/platform | ||
|
|
||
| - name: Update the sync PR | ||
| if: steps.changes.outputs.changed == 'true' | ||
| env: | ||
| GH_TOKEN: ${{ github.token }} | ||
| run: | | ||
| git config user.name "github-actions[bot]" | ||
| git config user.email "github-actions[bot]@users.noreply.github.com" | ||
| git checkout -B "$BRANCH" | ||
| git add packages/platform/asyncapi.json packages/platform/src/modules/builder.events.generated.ts | ||
| git commit -m "chore(platform): sync asyncapi.json and the event types from production" | ||
| # Rebuilt from main every run, so the branch never drifts or conflicts. | ||
| git push --force origin "$BRANCH" | ||
|
|
||
| pr=$(gh pr list --head "$BRANCH" --state open --json number --jq '.[0].number') | ||
| body="Refreshes \`packages/platform/asyncapi.json\` from $ASYNCAPI_URL and regenerates \`builder.events.generated.ts\`. The docs build and the Platform SDK tests passed on this change. Checked against production every hour." | ||
| if [ -z "$pr" ]; then | ||
| gh pr create --head "$BRANCH" --base main --title "Sync Platform SDK events from production" --body "$body" | ||
| fi | ||
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.