Skip to content

fix: require both vercel-org-id and vercel-project-id for deployment - #304

Merged
amondnet merged 3 commits into
masterfrom
amondnet/uneven-huckleberry
Mar 26, 2026
Merged

fix: require both vercel-org-id and vercel-project-id for deployment#304
amondnet merged 3 commits into
masterfrom
amondnet/uneven-huckleberry

Conversation

@amondnet

Copy link
Copy Markdown
Owner

Summary

  • Skip setting VERCEL_PROJECT_ID env var when vercel-org-id is not provided, with a warning message (Vercel CLI requires both to be set together)
  • Also remove VERCEL_PROJECT_ID alongside VERCEL_ORG_ID in the personal account retry path
  • Add missing vercel-org-id to example-static, example-angular, and deploy workflows

Test plan

  • Verify example-static workflow passes with both org-id and project-id set
  • Verify example-angular workflow passes with both org-id and project-id set
  • Verify deploy workflow passes
  • Verify warning is emitted when only vercel-project-id is provided without vercel-org-id

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
Copilot AI review requested due to automatic review settings March 26, 2026 04:02
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, 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 VERCEL_ORG_ID and VERCEL_PROJECT_ID are consistently handled together, preventing potential deployment failures when only one is provided, and improves the retry mechanism for personal account deployments.

Highlights

  • Environment Variable Handling: Modified the setEnv function to require both vercel-org-id and vercel-project-id to be present for VERCEL_ORG_ID and VERCEL_PROJECT_ID environment variables to be set. If only vercel-project-id is provided, it is now skipped with a warning.
  • Retry Path Logic: Enhanced the vercelDeploy function's retry mechanism for personal accounts to also remove VERCEL_PROJECT_ID from the environment when VERCEL_ORG_ID is removed.

🧠 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
  • Ignored by pattern: .github/workflows/** (3)
    • .github/workflows/deploy.yml
    • .github/workflows/example-angular.yml
    • .github/workflows/example-static.yml
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@github-actions

github-actions Bot commented Mar 26, 2026

Copy link
Copy Markdown
Contributor

Deploy preview for team-scope-test ready!

✅ Preview
https://team-scope-test-lz4mur28o-dietfriends.vercel.app

Built with commit cc88aaa.
This pull request is being automatically deployed with vercel-action

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread index.js
Comment thread index.js

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0 issues found across 2 files (changes from recent commits).

Requires human review: This PR modifies core deployment logic and environment variable handling, which falls under business logic changes in a critical path.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 export VERCEL_PROJECT_ID when vercel-org-id is also provided, otherwise emit a warning.
  • In the “personal account scope” retry path, also remove VERCEL_PROJECT_ID when removing VERCEL_ORG_ID.
  • Add vercel-org-id to the example-static, example-angular, and deploy workflows.

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.

Comment thread index.js Outdated
Comment thread index.js
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.',

Copilot AI Mar 26, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Suggested change
+ 'Retrying without VERCEL_ORG_ID and VERCEL_PROJECT_ID.',
+ 'Unsetting VERCEL_ORG_ID and VERCEL_PROJECT_ID and retrying the deployment.',

Copilot uses AI. Check for mistakes.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⏭️ 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!

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Loading

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

Comment thread index.js
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.
@sonarqubecloud

Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0 issues found across 2 files (changes from recent commits).

Requires human review: This PR modifies core deployment logic and environment variable handling, which impacts the deployment process and should be reviewed by a human.

@amondnet
amondnet merged commit c5205ad into master Mar 26, 2026
9 of 15 checks passed
@amondnet
amondnet deleted the amondnet/uneven-huckleberry branch March 26, 2026 04:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants