Skip to content

Commit 98d4605

Browse files
committed
chore: wip
1 parent 1bc31a3 commit 98d4605

File tree

1 file changed

+39
-13
lines changed

1 file changed

+39
-13
lines changed

.github/workflows/buddy-bot.yml

Lines changed: 39 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,6 @@ jobs:
127127

128128
- name: Setup Bun
129129
uses: oven-sh/setup-bun@v2
130-
with:
131-
bun-version: latest
132130

133131
- name: Setup PHP and Composer (if needed)
134132
if: ${{ hashFiles('composer.json') != '' }}
@@ -166,8 +164,6 @@ jobs:
166164

167165
- name: Setup Bun
168166
uses: oven-sh/setup-bun@v2
169-
with:
170-
bun-version: latest
171167

172168
- name: Install dependencies
173169
run: bun install
@@ -214,6 +210,19 @@ jobs:
214210
GITHUB_TOKEN: ${{ secrets.BUDDY_BOT_TOKEN || secrets.GITHUB_TOKEN }}
215211
BUDDY_BOT_TOKEN: ${{ secrets.BUDDY_BOT_TOKEN }}
216212

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+
217226
- name: Create check summary
218227
if: always()
219228
run: |
@@ -231,7 +240,7 @@ jobs:
231240
fi
232241
233242
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
235244
236245
# Dependency update job
237246
dependency-update:
@@ -249,8 +258,6 @@ jobs:
249258

250259
- name: Setup Bun
251260
uses: oven-sh/setup-bun@v2
252-
with:
253-
bun-version: latest
254261

255262
- name: Setup PHP and Composer (if needed)
256263
if: ${{ hashFiles('composer.json') != '' }}
@@ -358,8 +365,6 @@ jobs:
358365

359366
- name: Setup Bun
360367
uses: oven-sh/setup-bun@v2
361-
with:
362-
bun-version: latest
363368

364369
- name: Install dependencies
365370
run: bun install
@@ -376,6 +381,31 @@ jobs:
376381
echo "Repository: ${{ github.repository }}"
377382
echo "Branch: ${{ github.ref_name }}"
378383
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+
379409
- name: Update Dependency Dashboard
380410
run: |
381411
PIN="${{ github.event.inputs.pin || 'true' }}"
@@ -397,10 +427,6 @@ jobs:
397427
# Build the command
398428
COMMAND="bunx buddy-bot dashboard"
399429
400-
if [ "$PIN" = "true" ]; then
401-
COMMAND="$COMMAND --pin"
402-
fi
403-
404430
if [ "$TITLE" != "" ]; then
405431
COMMAND="$COMMAND --title \"$TITLE\""
406432
fi

0 commit comments

Comments
 (0)