fix: require both vercel-org-id and vercel-project-id for deployment - #304
Conversation
Vercel CLI requires both VERCEL_ORG_ID and VERCEL_PROJECT_ID to be set together. Previously, setting only vercel-project-id without vercel-org-id caused a CLI error. - skip setting VERCEL_PROJECT_ID when vercel-org-id is missing and warn - also remove VERCEL_PROJECT_ID in the personal account retry path - add missing vercel-org-id to example-static, example-angular, and deploy workflows
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request refines the Vercel GitHub Action's logic for setting deployment environment variables to align with recent Vercel CLI requirements. It ensures that Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Ignored Files
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
|
Deploy preview for team-scope-test ready! ✅ Preview Built with commit cc88aaa. |
There was a problem hiding this comment.
Code Review
This pull request updates the Vercel GitHub Action to align with Vercel CLI v41+ requirements, specifically by modifying the setEnv function to correctly handle cases where vercelProjectId is provided without vercelOrgId, logging a warning and skipping the project ID. Additionally, the retry mechanism in vercelDeploy has been updated to remove both VERCEL_ORG_ID and VERCEL_PROJECT_ID during a retry attempt. Feedback includes updating an inaccurate warning message in the retry logic and simplifying the environment variable setting logic for improved readability and reduced duplication.
There was a problem hiding this comment.
Pull request overview
Updates the GitHub Action’s Vercel environment-variable handling to avoid Vercel CLI failures when only one of org/project IDs is provided, and aligns example workflows to pass both IDs consistently.
Changes:
- Update
setEnv()to only exportVERCEL_PROJECT_IDwhenvercel-org-idis also provided, otherwise emit a warning. - In the “personal account scope” retry path, also remove
VERCEL_PROJECT_IDwhen removingVERCEL_ORG_ID. - Add
vercel-org-idto theexample-static,example-angular, anddeployworkflows.
Reviewed changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| index.js | Adjusts env var export logic and retry cleanup behavior for Vercel CLI compatibility. |
| dist/index.js | Built output reflecting the action runtime changes. |
| .github/workflows/example-static.yml | Supplies vercel-org-id alongside vercel-project-id in the static example. |
| .github/workflows/example-angular.yml | Supplies vercel-org-id alongside vercel-project-id in the Angular example. |
| .github/workflows/deploy.yml | Supplies vercel-org-id alongside vercel-project-id in the deploy workflow. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| core.warning( | ||
| 'Vercel CLI rejected the org ID as a personal account scope. ' | ||
| + 'Retrying without VERCEL_ORG_ID (VERCEL_PROJECT_ID is still set).', | ||
| + 'Retrying without VERCEL_ORG_ID and VERCEL_PROJECT_ID.', |
There was a problem hiding this comment.
This retry warning message says VERCEL_PROJECT_ID is still set, but the code now deletes process.env.VERCEL_PROJECT_ID just below. Update the warning text so logs reflect the actual retry behavior (and ensure dist/ is rebuilt after changing the source).
| + 'Retrying without VERCEL_ORG_ID and VERCEL_PROJECT_ID.', | |
| + 'Unsetting VERCEL_ORG_ID and VERCEL_PROJECT_ID and retrying the deployment.', |
There was a problem hiding this comment.
⏭️ Not applied — the warning message was already updated in a prior commit to say 'Retrying without VERCEL_ORG_ID and VERCEL_PROJECT_ID.' Your suggestion matches the current state. No change needed.
Thank you for the review, @copilot-pull-request-reviewer!
There was a problem hiding this comment.
1 issue found across 5 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="index.js">
<violation number="1" location="index.js:228">
P2: The warning message claims `VERCEL_PROJECT_ID is still set`, but the new `delete process.env.VERCEL_PROJECT_ID` immediately below removes it. Update the warning to reflect that both env vars are being cleared.</violation>
</file>
Architecture diagram
sequenceDiagram
participant W as GitHub Workflow
participant A as Action (index.js)
participant E as Process Env
participant V as Vercel CLI
Note over W,A: Environment Setup (setEnv)
W->>A: Provide vercel-org-id & vercel-project-id
alt Both IDs provided
A->>E: NEW: Export VERCEL_ORG_ID
A->>E: NEW: Export VERCEL_PROJECT_ID
else Only vercel-org-id provided
A->>E: Export VERCEL_ORG_ID
else Only vercel-project-id provided
A->>A: NEW: Emit warning (Vercel CLI v41+ requirements)
Note right of A: Skips exporting VERCEL_PROJECT_ID
end
Note over A,V: Execution (vercelDeploy)
A->>V: Spawn Vercel process
V->>E: Access VERCEL_ORG_ID / VERCEL_PROJECT_ID
alt Deployment Success
V-->>A: Return exit code 0
else Deployment Failure (e.g. Personal Account mismatch)
V-->>A: Return error code
Note over A,E: CHANGED: Personal Account Retry Path
A->>E: CHANGED: delete VERCEL_ORG_ID
A->>E: NEW: delete VERCEL_PROJECT_ID
A->>V: Retry spawn Vercel process (clean env)
V-->>A: Return result
end
A-->>W: Completion status
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
Align the behavior for missing vercel-project-id with the existing behavior for missing vercel-org-id: warn and skip the env var instead of exporting a partial configuration that can cause Vercel CLI v41+ scope errors.
|



Summary
VERCEL_PROJECT_IDenv var whenvercel-org-idis not provided, with a warning message (Vercel CLI requires both to be set together)VERCEL_PROJECT_IDalongsideVERCEL_ORG_IDin the personal account retry pathvercel-org-idtoexample-static,example-angular, anddeployworkflowsTest plan
example-staticworkflow passes with both org-id and project-id setexample-angularworkflow passes with both org-id and project-id setvercel-project-idis provided withoutvercel-org-id