Skip to content

Add SHOPIFY_CLI_TOKEN env var#7057

Open
gonzaloriestra wants to merge 2 commits intomainfrom
add-shopify-cli-token-env-var
Open

Add SHOPIFY_CLI_TOKEN env var#7057
gonzaloriestra wants to merge 2 commits intomainfrom
add-shopify-cli-token-env-var

Conversation

@gonzaloriestra
Copy link
Contributor

@gonzaloriestra gonzaloriestra commented Mar 20, 2026

WHY are these changes introduced?

Fixes https://github.com/shop/issues-develop/issues/22293

WHAT is this pull request doing?

  • Adds support for SHOPIFY_CLI_TOKEN environment variable with the same behavior as SHOPIFY_CLI_PARTNERS_TOKEN

How to test your changes?

  • npm i -g --@shopify:registry=https://registry.npmjs.org @shopify/cli@0.0.0-snapshot-20260320135524
  • SHOPIFY_CLI_TOKEN=xxx shopify app deploy
  • SHOPIFY_CLI_PARTNERS_TOKEN=xxx shopify app deploy

Measuring impact

How do we know this change was effective? Please choose one:

  • n/a - this doesn't need measurement, e.g. a linting rule or a bug-fix
  • Existing analytics will cater for this addition
  • PR includes analytics changes to measure impact

Checklist

  • I've considered possible cross-platform impacts (Mac, Linux, Windows)
  • I've considered possible documentation changes

@gonzaloriestra gonzaloriestra changed the title Add shopify cli token env var Add SHOPIFY_CLI_TOKEN env var Mar 20, 2026
@gonzaloriestra
Copy link
Contributor Author

/snapit

@github-actions
Copy link
Contributor

github-actions bot commented Mar 20, 2026

Coverage report

St.
Category Percentage Covered / Total
🟢 Statements 82.22% 14976/18214
🟡 Branches 74.7% 7418/9930
🟢 Functions 81.24% 3771/4642
🟢 Lines 82.63% 14163/17140

Test suite run success

3924 tests passing in 1508 suites.

Report generated by 🧪jest coverage report action from 0d99111

@github-actions

This comment was marked as outdated.

@gonzaloriestra gonzaloriestra force-pushed the add-shopify-cli-token-env-var branch from c40b471 to 2b77fb7 Compare March 20, 2026 10:46
@gonzaloriestra gonzaloriestra force-pushed the add-shopify-cli-token-env-var branch from 2b77fb7 to a52b36d Compare March 20, 2026 10:48
@gonzaloriestra
Copy link
Contributor Author

/snapit

@github-actions

This comment was marked as outdated.

@gonzaloriestra gonzaloriestra marked this pull request as ready for review March 20, 2026 11:09
@gonzaloriestra gonzaloriestra requested review from a team as code owners March 20, 2026 11:09
@gonzaloriestra gonzaloriestra force-pushed the add-shopify-cli-token-env-var branch from dbbac0b to 0d99111 Compare March 20, 2026 13:54
@gonzaloriestra
Copy link
Contributor Author

/snapit

@github-actions
Copy link
Contributor

Differences in type declarations

We detected differences in the type declarations generated by Typescript for this branch compared to the baseline ('main' branch). Please, review them to ensure they are backward-compatible. Here are some important things to keep in mind:

  • Some seemingly private modules might be re-exported through public modules.
  • If the branch is behind main you might see odd diffs, rebase main into this branch.

New type declarations

We found no new type declarations in this PR

Existing type declarations

packages/cli-kit/dist/private/node/constants.d.ts
@@ -8,6 +8,7 @@ export declare const environmentVariables: {
     env: string;
     firstPartyDev: string;
     noAnalytics: string;
+    cliToken: string;
     partnersToken: string;
     runAsUser: string;
     serviceEnv: string;
packages/cli-kit/dist/public/node/environment.d.ts
@@ -10,17 +10,12 @@
  */
 export declare function getEnvironmentVariables(): NodeJS.ProcessEnv;
 /**
- * Returns the value of the SHOPIFY_CLI_PARTNERS_TOKEN environment variable.
+ * Returns the value of the SHOPIFY_CLI_TOKEN environment variable,
+ * falling back to the deprecated SHOPIFY_CLI_PARTNERS_TOKEN.
  *
- * @returns Current process environment variables.
- */
-export declare function getPartnersToken(): string | undefined;
-/**
- * Check if the current proccess is running using the partners token.
- *
- * @returns True if the current proccess is running using the partners token.
+ * @returns The CLI token value, or undefined if neither env var is set.
  */
-export declare function usePartnersToken(): boolean;
+export declare function getCliToken(): string | undefined;
 /**
  * Returns the value of the organization id from the environment variables.
  *
packages/cli-kit/dist/private/node/session/exchange.d.ts
@@ -25,7 +25,7 @@ export declare function exchangeAccessForApplicationTokens(identityToken: Identi
  */
 export declare function refreshAccessToken(currentToken: IdentityToken): Promise<IdentityToken>;
 /**
- * Given a custom CLI token passed as ENV variable, request a valid Partners API token
+ * Given a custom CLI token passed as ENV variable, request a valid Partners API token.
  * This token does not accept extra scopes, just the cli one.
  * @param token - The CLI token passed as ENV variable 
  * @returns An instance with the application access tokens.
@@ -35,7 +35,7 @@ export declare function exchangeCustomPartnerToken(token: string): Promise<{
     userId: string;
 }>;
 /**
- * Given a custom CLI token passed as ENV variable, request a valid App Management API token
+ * Given a custom CLI token passed as ENV variable, request a valid App Management API token.
  * @param token - The CLI token passed as ENV variable 
  * @returns An instance with the application access tokens.
  */
@@ -44,7 +44,7 @@ export declare function exchangeCliTokenForAppManagementAccessToken(token: strin
     userId: string;
 }>;
 /**
- * Given a custom CLI token passed as ENV variable, request a valid Business Platform API token
+ * Given a custom CLI token passed as ENV variable, request a valid Business Platform API token.
  * @param token - The CLI token passed as ENV variable 
  * @returns An instance with the application access tokens.
  */

@github-actions
Copy link
Contributor

🫰✨ Thanks @gonzaloriestra! Your snapshot has been published to npm.

Test the snapshot by installing your package globally:

npm i -g --@shopify:registry=https://registry.npmjs.org @shopify/cli@0.0.0-snapshot-20260320135524

Caution

After installing, validate the version by running shopify version in your terminal.
If the versions don't match, you might have multiple global instances installed.
Use which shopify to find out which one you are running and uninstall it.

@gonzaloriestra gonzaloriestra added this pull request to the merge queue Mar 20, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Mar 20, 2026
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.

3 participants