@@ -127,8 +127,6 @@ jobs:
127
127
128
128
- name : Setup Bun
129
129
uses : oven-sh/setup-bun@v2
130
- with :
131
- bun-version : latest
132
130
133
131
- name : Setup PHP and Composer (if needed)
134
132
if : ${{ hashFiles('composer.json') != '' }}
@@ -166,8 +164,6 @@ jobs:
166
164
167
165
- name : Setup Bun
168
166
uses : oven-sh/setup-bun@v2
169
- with :
170
- bun-version : latest
171
167
172
168
- name : Install dependencies
173
169
run : bun install
@@ -214,6 +210,19 @@ jobs:
214
210
GITHUB_TOKEN : ${{ secrets.BUDDY_BOT_TOKEN || secrets.GITHUB_TOKEN }}
215
211
BUDDY_BOT_TOKEN : ${{ secrets.BUDDY_BOT_TOKEN }}
216
212
213
+ - name : Clean up stale branches
214
+ if : ${{ github.event.inputs.dry_run != 'true' }}
215
+ run : |
216
+ echo "🧹 Cleaning up stale buddy-bot branches..."
217
+ echo "This will remove branches older than 2 days that don't have associated open PRs"
218
+
219
+ # Run cleanup automatically (with confirmation disabled in CI)
220
+ bunx buddy-bot cleanup --days 2 --force --verbose
221
+
222
+ env :
223
+ GITHUB_TOKEN : ${{ secrets.BUDDY_BOT_TOKEN || secrets.GITHUB_TOKEN }}
224
+ BUDDY_BOT_TOKEN : ${{ secrets.BUDDY_BOT_TOKEN }}
225
+
217
226
- name : Create check summary
218
227
if : always()
219
228
run : |
@@ -231,7 +240,7 @@ jobs:
231
240
fi
232
241
233
242
echo "" >> $GITHUB_STEP_SUMMARY
234
- echo "📋 View detailed logs above for check results (rebase requests and auto-closing)." >> $GITHUB_STEP_SUMMARY
243
+ echo "📋 View detailed logs above for check results (rebase requests, auto-closing, and branch cleanup )." >> $GITHUB_STEP_SUMMARY
235
244
236
245
# Dependency update job
237
246
dependency-update :
@@ -249,8 +258,6 @@ jobs:
249
258
250
259
- name : Setup Bun
251
260
uses : oven-sh/setup-bun@v2
252
- with :
253
- bun-version : latest
254
261
255
262
- name : Setup PHP and Composer (if needed)
256
263
if : ${{ hashFiles('composer.json') != '' }}
@@ -358,8 +365,6 @@ jobs:
358
365
359
366
- name : Setup Bun
360
367
uses : oven-sh/setup-bun@v2
361
- with :
362
- bun-version : latest
363
368
364
369
- name : Install dependencies
365
370
run : bun install
@@ -376,6 +381,31 @@ jobs:
376
381
echo "Repository: ${{ github.repository }}"
377
382
echo "Branch: ${{ github.ref_name }}"
378
383
384
+ - name : Pre-flight dashboard check
385
+ if : ${{ github.event.inputs.dry_run != 'true' }}
386
+ run : |
387
+ echo "🔍 Pre-flight check: Looking for existing dashboard issues..."
388
+
389
+ # Check for existing dashboard issues to prevent duplicates
390
+ if command -v gh &> /dev/null; then
391
+ EXISTING_DASHBOARDS=$(gh issue list --label "dashboard,dependencies" --state open --json number,title,url --jq length 2>/dev/null || echo "0")
392
+ echo "Found $EXISTING_DASHBOARDS existing dashboard issue(s)"
393
+
394
+ if [ "$EXISTING_DASHBOARDS" -gt 1 ]; then
395
+ echo "⚠️ WARNING: Multiple dashboard issues detected!"
396
+ gh issue list --label "dashboard,dependencies" --state open --json number,title,url --jq '.[] | " - #\(.number): \(.title) - \(.url)"' 2>/dev/null || true
397
+ echo ""
398
+ echo "🔧 Buddy Bot will attempt to update the most recent one and may close duplicates"
399
+ elif [ "$EXISTING_DASHBOARDS" -eq 1 ]; then
400
+ DASHBOARD_INFO=$(gh issue list --label "dashboard,dependencies" --state open --json number,title,url --jq '.[0] | "#\(.number): \(.title) - \(.url)"' 2>/dev/null || echo "Found 1 dashboard")
401
+ echo "✅ Found existing dashboard: $DASHBOARD_INFO"
402
+ else
403
+ echo "ℹ️ No existing dashboard found - a new one will be created"
404
+ fi
405
+ else
406
+ echo "⚠️ GitHub CLI not available - cannot perform pre-flight check"
407
+ fi
408
+
379
409
- name : Update Dependency Dashboard
380
410
run : |
381
411
PIN="${{ github.event.inputs.pin || 'true' }}"
@@ -397,10 +427,6 @@ jobs:
397
427
# Build the command
398
428
COMMAND="bunx buddy-bot dashboard"
399
429
400
- if [ "$PIN" = "true" ]; then
401
- COMMAND="$COMMAND --pin"
402
- fi
403
-
404
430
if [ "$TITLE" != "" ]; then
405
431
COMMAND="$COMMAND --title \"$TITLE\""
406
432
fi
0 commit comments