Skip to content

Commit cb1ff21

Browse files
committed
fix PR review issues
1 parent f25e90a commit cb1ff21

File tree

2 files changed

+8
-31
lines changed

2 files changed

+8
-31
lines changed

apps/webapp/app/routes/api.v1.projects.$projectRef.$env.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -129,13 +129,6 @@ export async function getEnvironmentFromEnv({
129129
}
130130

131131
if (slug === "preview") {
132-
if (!branch) {
133-
return {
134-
success: false,
135-
error: "Preview environment requires a branch. Please set the x-trigger-branch header.",
136-
};
137-
}
138-
139132
const previewEnvironment = await prisma.runtimeEnvironment.findFirst({
140133
where: {
141134
projectId,
@@ -150,6 +143,14 @@ export async function getEnvironmentFromEnv({
150143
};
151144
}
152145

146+
// If no branch is provided, just return the parent preview environment
147+
if (!branch) {
148+
return {
149+
success: true,
150+
environment: previewEnvironment,
151+
};
152+
}
153+
153154
const branchEnvironment = await prisma.runtimeEnvironment.findFirst({
154155
where: {
155156
parentEnvironmentId: previewEnvironment.id,

packages/core/src/v3/schemas/api.ts

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1225,30 +1225,6 @@ export const ApiBranchListResponseBody = z.object({
12251225

12261226
export type ApiBranchListResponseBody = z.infer<typeof ApiBranchListResponseBody>;
12271227

1228-
// export type SpanDetailedSummary = {
1229-
// id: string;
1230-
// parentId: string | undefined;
1231-
// message: string;
1232-
// data: {
1233-
// runId: string;
1234-
// taskSlug?: string;
1235-
// taskPath?: string;
1236-
// events: SpanEvents;
1237-
// startTime: Date;
1238-
// duration: number;
1239-
// isError: boolean;
1240-
// isPartial: boolean;
1241-
// isCancelled: boolean;
1242-
// level: NonNullable<CreatableEvent["level"]>;
1243-
// environmentType: CreatableEventEnvironmentType;
1244-
// workerVersion?: string;
1245-
// queueName?: string;
1246-
// machinePreset?: string;
1247-
// properties?: Attributes;
1248-
// output?: Attributes;
1249-
// };
1250-
// children: Array<SpanDetailedSummary>;
1251-
// };
12521228
export const RetrieveRunTraceSpanSchema = z.object({
12531229
id: z.string(),
12541230
parentId: z.string().optional(),

0 commit comments

Comments
 (0)