Skip to content

Commit f0dd983

Browse files
committed
don't try interactive login in ci, link to docs
1 parent 1a64013 commit f0dd983

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

packages/cli-v3/src/commands/login.ts

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,13 @@ import { logger } from "../utilities/logger.js";
2222
import { spinner } from "../utilities/windows.js";
2323
import { isLinuxServer } from "../utilities/linux.js";
2424
import { VERSION } from "../version.js";
25-
import { env } from "std-env";
25+
import { env, isCI } from "std-env";
2626
import { CLOUD_API_URL } from "../consts.js";
2727
import {
2828
isPersonalAccessToken,
2929
NotPersonalAccessTokenError,
3030
} from "../utilities/isPersonalAccessToken.js";
31+
import { links } from "@trigger.dev/core/v3";
3132

3233
export const LoginCommandOptions = CommonCommandOptions.extend({
3334
apiUrl: z.string(),
@@ -210,6 +211,24 @@ export async function login(options?: LoginOptions): Promise<LoginResult> {
210211
}
211212
}
212213

214+
if (isCI) {
215+
const apiUrl =
216+
env.TRIGGER_API_URL ?? authConfig?.apiUrl ?? opts.defaultApiUrl ?? CLOUD_API_URL;
217+
218+
const isSelfHosted = apiUrl !== CLOUD_API_URL;
219+
220+
// This is fine, as the api URL will generally be the same as the dashboard URL for self-hosted instances
221+
const dashboardUrl = isSelfHosted ? apiUrl : "https://cloud.trigger.dev";
222+
223+
throw new Error(
224+
`Authentication required in CI environment. Please set the TRIGGER_ACCESS_TOKEN environment variable with a Personal Access Token.
225+
226+
- You can generate one here: ${dashboardUrl}/account/tokens
227+
228+
- For more information, see: ${links.docs.gitHubActions.personalAccessToken}`
229+
);
230+
}
231+
213232
if (opts.embedded) {
214233
log.step("You must login to continue.");
215234
}

packages/core/src/v3/links.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ export const links = {
2020
"https://trigger.dev/docs/queue-concurrency#waiting-for-a-subtask-on-the-same-queue",
2121
deadlock: "https://trigger.dev/docs/queue-concurrency#deadlock",
2222
},
23+
gitHubActions: {
24+
personalAccessToken:
25+
"https://trigger.dev/docs/github-actions#creating-a-personal-access-token",
26+
},
2327
},
2428
site: {
2529
home: "https://trigger.dev",

0 commit comments

Comments
 (0)