-
Notifications
You must be signed in to change notification settings - Fork 0
Chore/vercel env sync #1
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
base: main
Are you sure you want to change the base?
Conversation
- Add @playwright/test, config, and baseline specs\n- Add production smoke-checks job to deploy-services workflow\n- Add typecheck scripts and turbo task; minimal Medusa unit test for gates\n- Update story-1.7 log and tracking
chore: update CORS templates and storefront env examples for prd/staging domains
|
Someone is attempting to deploy this pull request to the coderisedev-3303's projects Team on Vercel. To accomplish this, the commit author's email address needs to be associated with a GitHub account. Learn more about how to change the commit author information. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR establishes a Vercel environment synchronization workflow and extends the CI/CD pipeline with automated E2E testing capabilities using Playwright. It also updates CORS configuration to support both production and staging storefronts for OAuth callbacks.
Key Changes:
- Added GitHub Actions workflow for syncing environment variables to Vercel projects (production and staging)
- Implemented Playwright E2E test harness with smoke tests for storefront, admin apps, and health endpoints
- Updated AUTH_CORS configuration to include both production and staging domains for OAuth callback support
Reviewed Changes
Copilot reviewed 19 out of 20 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
.github/workflows/sync-vercel-env.yml |
New workflow for syncing environment variables to Vercel projects via API |
scripts/vercel/upsert-env.sh |
Bash script to upsert individual environment variables in Vercel projects |
scripts/gce/configure-secrets.sh |
Updated AUTH_CORS to allow both production and staging domains |
infra/gcp/env/medusa.env.example |
Updated example environment file with corrected domains and new Sentry configuration |
apps/storefront/.env.local.example |
Comprehensive environment variable documentation for storefront |
.github/workflows/deploy-services.yml |
Added post-deploy smoke checks job and first-init workflow support |
playwright.config.ts |
Playwright configuration for E2E tests |
tests/e2e/*.spec.ts |
E2E test specs for smoke tests, health checks, and admin apps |
package.json |
Added Playwright dependency and test scripts |
turbo.json |
Added typecheck task |
apps/*/package.json |
Added typecheck scripts to medusa, strapi, and storefront |
apps/medusa/jest.config.js |
Updated Jest config with ES2022 target |
docs/stories/story-1.7.md |
Story documentation for E2E test harness |
docs/sprint-status.yaml |
Updated story statuses |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| # List existing envs and find by key | ||
| LIST_URL="$BASE_URL/v10/projects/$PROJECT_ID/env${TEAM_QS}" | ||
| EXISTING=$(curl -fsSL -H "Authorization: Bearer $VERCEL_TOKEN" "$LIST_URL" | jq -r --arg KEY "$KEY" '.envs[]? | select(.key==$KEY) | .id' || true) |
Copilot
AI
Oct 27, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The error handling with || true silently suppresses all curl/jq failures. If the API call fails for reasons other than the variable not existing (e.g., invalid token, network issues), the script will proceed to create a new variable without awareness of the failure. Consider checking the HTTP response code explicitly or logging a warning when the API call fails.
| EXISTING=$(curl -fsSL -H "Authorization: Bearer $VERCEL_TOKEN" "$LIST_URL" | jq -r --arg KEY "$KEY" '.envs[]? | select(.key==$KEY) | .id' || true) | |
| RESPONSE=$(mktemp) | |
| HTTP_STATUS=$(curl -sSL -w "%{http_code}" -o "$RESPONSE" -H "Authorization: Bearer $VERCEL_TOKEN" "$LIST_URL") | |
| if [[ "$HTTP_STATUS" -ne 200 ]]; then | |
| echo "Error: Failed to fetch environment variables from Vercel API (HTTP $HTTP_STATUS)" >&2 | |
| cat "$RESPONSE" >&2 | |
| rm -f "$RESPONSE" | |
| exit 1 | |
| fi | |
| EXISTING=$(jq -r --arg KEY "$KEY" '.envs[]? | select(.key==$KEY) | .id' < "$RESPONSE") | |
| rm -f "$RESPONSE" |
| if [[ -n "$EXISTING" ]]; then | ||
| # Delete existing to avoid conflicts | ||
| DEL_URL="$BASE_URL/v10/projects/$PROJECT_ID/env/$EXISTING${TEAM_QS}" | ||
| curl -fsSL -X DELETE -H "Authorization: Bearer $VERCEL_TOKEN" "$DEL_URL" >/dev/null || true |
Copilot
AI
Oct 27, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The deletion failure is silently ignored with || true. If deletion fails (e.g., due to permissions or API errors), the subsequent creation may fail with a conflict error. Consider logging deletion failures or checking the response to provide clearer error messages.
| curl -fsSL -X DELETE -H "Authorization: Bearer $VERCEL_TOKEN" "$DEL_URL" >/dev/null || true | |
| if ! curl -fsSL -X DELETE -H "Authorization: Bearer $VERCEL_TOKEN" "$DEL_URL" >/dev/null; then | |
| echo "Failed to delete existing environment variable with id $EXISTING (key: $KEY) from project $PROJECT_ID" >&2 | |
| exit 2 | |
| fi |
| if: ${{ (github.event_name == 'workflow_dispatch' && inputs.first_init == true) || env.RUN_FIRST_INIT == 'true' }} | ||
| uses: appleboy/ssh-action@v1.0.3 | ||
| env: | ||
| DB_PW: ${{ github.event_name == 'workflow_dispatch' && inputs.db_password != '' && inputs.first_init && inputs.db_password || secrets.GCE_DB_PASSWORD || '' }} |
Copilot
AI
Oct 27, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The expression inputs.db_password != '' && inputs.first_init && inputs.db_password is redundant since inputs.db_password appears twice. The middle check inputs.first_init should be sufficient along with the first non-empty check. Simplify to: github.event_name == 'workflow_dispatch' && inputs.first_init && inputs.db_password || secrets.GCE_DB_PASSWORD || ''
| DB_PW: ${{ github.event_name == 'workflow_dispatch' && inputs.db_password != '' && inputs.first_init && inputs.db_password || secrets.GCE_DB_PASSWORD || '' }} | |
| DB_PW: ${{ github.event_name == 'workflow_dispatch' && inputs.first_init && inputs.db_password || secrets.GCE_DB_PASSWORD || '' }} |
chore(storefront): fix lint errors (Link usage, typing) chore(medusa): exclude tests from typecheck to avoid CI fail
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
…and path aliases in CI
…; rely on package-provided types via imports
…to TS module; use relative imports to avoid path alias issues in CI
chore(ci): add PR template referencing runbook
…mport path; type session for status page
Branch: chore/vercel-env-sync
Compare/PR: https://github.com/coderisedev/cs/compare/chore/vercel-env-sync?expand=1
Included files:
总结说明
- Developer Performance: Added quick-check gate and low‑resource build. See docs/runbooks/developer-performance.md for pnpm quick-check, pnpm
build:quick, and resource limit tips.