@@ -129,7 +129,7 @@ private static TRepository RepositoryDefaults<TRepository>(TRepository r, string
129129 /// <paramref name="repository"/>.
130130 public ContentSourceMatch Match ( string repository , string branchOrTag )
131131 {
132- var match = new ContentSourceMatch ( null , null , false ) ;
132+ var match = new ContentSourceMatch ( null , null , null , false ) ;
133133 var tokens = repository . Split ( '/' ) ;
134134 var repositoryName = tokens . Last ( ) ;
135135 var owner = tokens . First ( ) ;
@@ -141,34 +141,29 @@ public ContentSourceMatch Match(string repository, string branchOrTag)
141141 {
142142 var current = r . GetBranch ( ContentSource . Current ) ;
143143 var next = r . GetBranch ( ContentSource . Next ) ;
144+ var edge = r . GetBranch ( ContentSource . Edge ) ;
144145 var isVersionBranch = ContentSourceRegex . MatchVersionBranch ( ) . IsMatch ( branchOrTag ) ;
145146 if ( current == branchOrTag )
146147 match = match with { Current = ContentSource . Current } ;
147148
148149 if ( next == branchOrTag )
149- match = match with
150- {
151- Next = ContentSource . Next
152- } ;
150+ match = match with { Next = ContentSource . Next } ;
151+
152+ if ( edge == branchOrTag )
153+ match = match with { Edge = ContentSource . Edge } ;
154+
153155 if ( isVersionBranch && SemVersion . TryParse ( branchOrTag + ".0" , out var v ) )
154156 {
155157 // if the current branch is a version, only speculatively match if branch is actually a new version
156158 if ( SemVersion . TryParse ( current + ".0" , out var currentVersion ) )
157159 {
158160 if ( v >= currentVersion )
159- match = match with
160- {
161- Speculative = true
162- } ;
161+ match = match with { Speculative = true } ;
163162 }
164163 // assume we are newly onboarding the repository to current/next
165164 else
166- match = match with
167- {
168- Speculative = true
169- } ;
165+ match = match with { Speculative = true } ;
170166 }
171-
172167 return match ;
173168 }
174169
@@ -177,27 +172,27 @@ public ContentSourceMatch Match(string repository, string branchOrTag)
177172 // this is an unknown new elastic repository
178173 var isVersionBranch = ContentSourceRegex . MatchVersionBranch ( ) . IsMatch ( branchOrTag ) ;
179174 if ( isVersionBranch || branchOrTag == "main" || branchOrTag == "master" )
180- return match with
181- {
182- Speculative = true
183- } ;
175+ return match with { Speculative = true } ;
184176 }
185177
186178 if ( Narrative . GetBranch ( ContentSource . Current ) == branchOrTag )
187- match = match with
188- {
189- Current = ContentSource . Current
190- } ;
179+ match = match with { Current = ContentSource . Current } ;
180+
191181 if ( Narrative . GetBranch ( ContentSource . Next ) == branchOrTag )
192- match = match with
193- {
194- Next = ContentSource . Next
195- } ;
182+ match = match with { Next = ContentSource . Next } ;
183+
184+ if ( Narrative . GetBranch ( ContentSource . Edge ) == branchOrTag )
185+ match = match with { Edge = ContentSource . Edge } ;
186+
187+ // if we haven't matched anything yet, and the branch is 'main' or 'master' always build
188+ if ( match is { Current : null , Next : null , Edge : null , Speculative : false }
189+ && branchOrTag is "main" or "master" )
190+ return match with { Speculative = true } ;
196191
197192 return match ;
198193 }
199194
200- public record ContentSourceMatch ( ContentSource ? Current , ContentSource ? Next , bool Speculative ) ;
195+ public record ContentSourceMatch ( ContentSource ? Current , ContentSource ? Next , ContentSource ? Edge , bool Speculative ) ;
201196}
202197
203198internal static partial class ContentSourceRegex
0 commit comments