@@ -1005,33 +1005,35 @@ export class GitHubProvider implements GitProvider {
1005
1005
1006
1006
console . log ( `✅ Checked ${ checkedCount } PRs via HTTP: ${ openCount } open, ${ checkedCount - openCount } closed` )
1007
1007
console . log ( `🛡️ Protected ${ protectedBranches . size } branches with confirmed open PRs` )
1008
+
1009
+ // Since HTTP detection was successful and is 100% accurate, we don't need fallback protection
1010
+ console . log ( `🎯 HTTP detection successful` )
1008
1011
}
1009
1012
catch ( error ) {
1010
- console . warn ( '⚠️ Could not check PR status via HTTP:' , error )
1011
- }
1013
+ console . warn ( '⚠️ Could not check PR status via HTTP, applying conservative fallback:' , error )
1012
1014
1013
- // Method 2: Fallback protection for very recent branches (last 7 days)
1014
- // in case we missed any PRs or HTTP checks failed
1015
- try {
1016
- const allBuddyBranches = await this . getBuddyBotBranches ( )
1017
- const sevenDaysAgo = new Date ( )
1018
- sevenDaysAgo . setDate ( sevenDaysAgo . getDate ( ) - 7 )
1015
+ // Only apply fallback protection if HTTP detection failed
1016
+ try {
1017
+ const allBuddyBranches = await this . getBuddyBotBranches ( )
1018
+ const threeDaysAgo = new Date ( )
1019
+ threeDaysAgo . setDate ( threeDaysAgo . getDate ( ) - 3 )
1020
+
1021
+ let fallbackCount = 0
1022
+ for ( const branch of allBuddyBranches ) {
1023
+ if ( branch . lastCommitDate > threeDaysAgo && ! protectedBranches . has ( branch . name ) ) {
1024
+ protectedBranches . add ( branch . name )
1025
+ fallbackCount ++
1026
+ }
1027
+ }
1019
1028
1020
- let fallbackCount = 0
1021
- for ( const branch of allBuddyBranches ) {
1022
- if ( branch . lastCommitDate > sevenDaysAgo && ! protectedBranches . has ( branch . name ) ) {
1023
- protectedBranches . add ( branch . name )
1024
- fallbackCount ++
1029
+ if ( fallbackCount > 0 ) {
1030
+ console . log ( `🛡️ Fallback protection: ${ fallbackCount } recent branches (< 3 days) protected due to HTTP failure` )
1025
1031
}
1026
1032
}
1027
-
1028
- if ( fallbackCount > 0 ) {
1029
- console . log ( `🛡️ Fallback protection: ${ fallbackCount } recent branches (< 7 days) also protected` )
1033
+ catch {
1034
+ console . log ( '⚠️ Could not apply fallback protection' )
1030
1035
}
1031
1036
}
1032
- catch {
1033
- console . log ( '⚠️ Could not apply fallback protection' )
1034
- }
1035
1037
1036
1038
console . log ( `🎯 HTTP-based analysis complete: protecting ${ protectedBranches . size } branches total` )
1037
1039
0 commit comments