File tree Expand file tree Collapse file tree 4 files changed +27
-5
lines changed Expand file tree Collapse file tree 4 files changed +27
-5
lines changed Original file line number Diff line number Diff line change @@ -207,6 +207,15 @@ jobs:
207
207
bunx buddy-bot update-check --verbose
208
208
fi
209
209
210
+ - name : Clean up stale branches
211
+ if : ${{ github.event.inputs.dry_run != 'true' }}
212
+ run : |
213
+ echo "🧹 Cleaning up stale buddy-bot branches..."
214
+ echo "This will remove branches older than 7 days that don't have associated open PRs"
215
+
216
+ # Run cleanup automatically (with confirmation disabled in CI)
217
+ bunx buddy-bot cleanup --days 7 --force --verbose
218
+
210
219
env :
211
220
GITHUB_TOKEN : ${{ secrets.BUDDY_BOT_TOKEN || secrets.GITHUB_TOKEN }}
212
221
BUDDY_BOT_TOKEN : ${{ secrets.BUDDY_BOT_TOKEN }}
@@ -228,7 +237,7 @@ jobs:
228
237
fi
229
238
230
239
echo "" >> $GITHUB_STEP_SUMMARY
231
- echo "📋 View detailed logs above for check results (rebase requests and auto-closing)." >> $GITHUB_STEP_SUMMARY
240
+ echo "📋 View detailed logs above for check results (rebase requests, auto-closing, and branch cleanup )." >> $GITHUB_STEP_SUMMARY
232
241
233
242
# Dependency update job
234
243
dependency-update :
Original file line number Diff line number Diff line change @@ -1848,7 +1848,7 @@ cli
1848
1848
}
1849
1849
1850
1850
logger . info ( `📊 Found ${ staleBranches . length } stale branches to clean up:` )
1851
- staleBranches . forEach ( branch => {
1851
+ staleBranches . forEach ( ( branch ) => {
1852
1852
const daysOld = Math . floor ( ( Date . now ( ) - branch . lastCommitDate . getTime ( ) ) / ( 1000 * 60 * 60 * 24 ) )
1853
1853
logger . info ( ` - ${ branch . name } (${ daysOld } days old)` )
1854
1854
} )
@@ -1977,7 +1977,7 @@ cli
1977
1977
// Sort by last commit date (newest first)
1978
1978
branches . sort ( ( a , b ) => b . lastCommitDate . getTime ( ) - a . lastCommitDate . getTime ( ) )
1979
1979
1980
- branches . forEach ( branch => {
1980
+ branches . forEach ( ( branch ) => {
1981
1981
const hasOpenPR = prBranches . has ( branch . name )
1982
1982
const daysOld = Math . floor ( ( Date . now ( ) - branch . lastCommitDate . getTime ( ) ) / ( 1000 * 60 * 60 * 24 ) )
1983
1983
const isStale = branch . lastCommitDate < cutoffDate
Original file line number Diff line number Diff line change @@ -806,7 +806,7 @@ export class GitHubProvider implements GitProvider {
806
806
807
807
if ( dryRun ) {
808
808
console . log ( '🔍 [DRY RUN] Would delete the following branches:' )
809
- staleBranches . forEach ( branch => {
809
+ staleBranches . forEach ( ( branch ) => {
810
810
console . log ( ` - ${ branch . name } (last commit: ${ branch . lastCommitDate . toISOString ( ) } )` )
811
811
} )
812
812
return { deleted : staleBranches . map ( b => b . name ) , failed : [ ] }
Original file line number Diff line number Diff line change @@ -1307,6 +1307,19 @@ ${generateComposerSetupSteps()}
1307
1307
GITHUB_TOKEN: ${ tokenEnv }
1308
1308
BUDDY_BOT_TOKEN: \${{ secrets.BUDDY_BOT_TOKEN }}
1309
1309
1310
+ - name: Clean up stale branches
1311
+ if: \${{ github.event.inputs.dry_run != 'true' }}
1312
+ run: |
1313
+ echo "🧹 Cleaning up stale buddy-bot branches..."
1314
+ echo "This will remove branches older than 7 days that don't have associated open PRs"
1315
+
1316
+ # Run cleanup automatically (with confirmation disabled in CI)
1317
+ bunx buddy-bot cleanup --days 7 --force --verbose
1318
+
1319
+ env:
1320
+ GITHUB_TOKEN: ${ tokenEnv }
1321
+ BUDDY_BOT_TOKEN: \${{ secrets.BUDDY_BOT_TOKEN }}
1322
+
1310
1323
- name: Create check summary
1311
1324
if: always()
1312
1325
run: |
@@ -1324,7 +1337,7 @@ ${generateComposerSetupSteps()}
1324
1337
fi
1325
1338
1326
1339
echo "" >> \$GITHUB_STEP_SUMMARY
1327
- echo "📋 View detailed logs above for check results (rebase requests and auto-closing)." >> \$GITHUB_STEP_SUMMARY
1340
+ echo "📋 View detailed logs above for check results (rebase requests, auto-closing, and branch cleanup )." >> \$GITHUB_STEP_SUMMARY
1328
1341
1329
1342
# Dependency update job
1330
1343
dependency-update:
You can’t perform that action at this time.
0 commit comments