File tree Expand file tree Collapse file tree
routes/_app.orgs.$organizationSlug.projects.$projectParam.env.$envParam.deployments Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -59,6 +59,7 @@ export class DeploymentListPresenter {
5959 connectedGithubRepository : {
6060 select : {
6161 branchTracking : true ,
62+ previewDeploymentsEnabled : true ,
6263 repository : {
6364 select : {
6465 htmlUrl : true ,
Original file line number Diff line number Diff line change @@ -138,7 +138,14 @@ export default function Page() {
138138 BranchTrackingConfigSchema . safeParse ( connectedGithubRepository . branchTracking ) ;
139139 const environmentGitHubBranch =
140140 branchTrackingOrError && branchTrackingOrError . success
141- ? getTrackedBranchForEnvironment ( branchTrackingOrError . data , environment . type )
141+ ? getTrackedBranchForEnvironment (
142+ branchTrackingOrError . data ,
143+ connectedGithubRepository . previewDeploymentsEnabled ,
144+ {
145+ type : environment . type ,
146+ branchName : environment . branchName ?? undefined ,
147+ }
148+ )
142149 : undefined ;
143150 const hasDeployments = totalPages > 0 ;
144151
@@ -309,7 +316,7 @@ export default function Page() {
309316 ) }
310317 >
311318 { connectedGithubRepository && environmentGitHubBranch && (
312- < div className = "flex flex-nowrap items-center gap-2 whitespace-nowrap py-0.5 text-sm" >
319+ < div className = "flex flex-nowrap items-center gap-2 whitespace-nowrap text-sm" >
313320 < OctoKitty className = "size-4" />
314321 Automatically triggered by pushes to{ " " }
315322 < div className = "flex max-w-32 items-center gap-1 truncate rounded bg-grid-dimmed px-1 font-mono" >
Original file line number Diff line number Diff line change @@ -13,15 +13,23 @@ export type BranchTrackingConfig = z.infer<typeof BranchTrackingConfigSchema>;
1313
1414export function getTrackedBranchForEnvironment (
1515 branchTracking : BranchTrackingConfig | undefined ,
16- environmentType : "PRODUCTION" | "STAGING" | "DEVELOPMENT" | "PREVIEW"
16+ previewDeploymentsEnabled : boolean ,
17+ environment : {
18+ type : "PRODUCTION" | "STAGING" | "DEVELOPMENT" | "PREVIEW" ;
19+ branchName ?: string ;
20+ }
1721) : string | undefined {
1822 if ( ! branchTracking ) return undefined ;
19- switch ( environmentType ) {
23+ switch ( environment . type ) {
2024 case "PRODUCTION" :
2125 return branchTracking . prod ?. branch ;
2226 case "STAGING" :
2327 return branchTracking . staging ?. branch ;
24- default :
28+ case "PREVIEW" :
29+ return previewDeploymentsEnabled ? environment . branchName : undefined ;
30+ case "DEVELOPMENT" :
2531 return undefined ;
32+ default :
33+ return environment . type satisfies never ;
2634 }
2735}
You can’t perform that action at this time.
0 commit comments