@@ -2,10 +2,10 @@ import { type PrismaClient, type PrismaClientOrTransaction } from "@trigger.dev/
22import slug from "slug" ;
33import { prisma } from "~/db.server" ;
44import { createApiKeyForEnv , createPkApiKeyForEnv } from "~/models/api-key.server" ;
5+ import { type CreateBranchOptions } from "~/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.branches/route" ;
6+ import { isValidGitBranchName , sanitizeBranchName } from "~/v3/gitBranch" ;
57import { logger } from "./logger.server" ;
68import { getLimit } from "./platform.v3.server" ;
7- import { type CreateBranchOptions } from "~/routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.branches/route" ;
8- import { isValidGitBranchName } from "~/v3/validGitBranch" ;
99
1010export class UpsertBranchService {
1111 #prismaClient: PrismaClient ;
@@ -167,17 +167,3 @@ export async function checkBranchLimit(
167167 isAtLimit : used >= limit ,
168168 } ;
169169}
170-
171- export function sanitizeBranchName ( ref : string ) : string | null {
172- if ( ! ref ) return null ;
173- if ( ref . startsWith ( "refs/heads/" ) ) return ref . substring ( "refs/heads/" . length ) ;
174- if ( ref . startsWith ( "refs/remotes/" ) ) return ref . substring ( "refs/remotes/" . length ) ;
175- if ( ref . startsWith ( "refs/tags/" ) ) return ref . substring ( "refs/tags/" . length ) ;
176- if ( ref . startsWith ( "refs/pull/" ) ) return ref . substring ( "refs/pull/" . length ) ;
177- if ( ref . startsWith ( "refs/merge/" ) ) return ref . substring ( "refs/merge/" . length ) ;
178- if ( ref . startsWith ( "refs/release/" ) ) return ref . substring ( "refs/release/" . length ) ;
179- //unknown ref format, so reject
180- if ( ref . startsWith ( "refs/" ) ) return null ;
181-
182- return ref ;
183- }
0 commit comments