Skip to content

Commit 302fb91

Browse files
committed
chore: minor updates
chore: wip fix: restore Configure Git step and BUDDY_BOT_TOKEN support for rebase workflow - Add missing git config step to prevent 'Author identity unknown' error - Update workflow to use BUDDY_BOT_TOKEN for workflow file update permissions - Add token permission check step for better debugging chore: wip chore: wip chore: wip chore: wip chore: wip chore: wip chore: wip chore: wip chore: wip chore: wip chore: wip chore: wip chore: wip chore: adjust tests chore: wip
1 parent 7194ba3 commit 302fb91

23 files changed

+1614
-644
lines changed

.github/workflows/buddy-bot-rebase.yml

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Buddy Rebase Check
1+
name: Buddy Update Check
22

33
on:
44
schedule:
@@ -12,12 +12,17 @@ on:
1212
type: boolean
1313

1414
env:
15-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
15+
# For workflow file updates, you need a Personal Access Token with 'repo' and 'workflow' scopes
16+
# Create a PAT at: https://github.com/settings/tokens
17+
# Add it as a repository secret named 'BUDDY_BOT_TOKEN'
18+
# If BUDDY_BOT_TOKEN is not available, falls back to GITHUB_TOKEN (limited permissions)
19+
GITHUB_TOKEN: ${{ secrets.BUDDY_BOT_TOKEN || secrets.GITHUB_TOKEN }}
1620

1721
permissions:
1822
contents: write
1923
pull-requests: write
2024
issues: write
25+
actions: write
2126

2227
jobs:
2328
check-rebase:
@@ -27,7 +32,9 @@ jobs:
2732
- name: Checkout repository
2833
uses: actions/checkout@v4
2934
with:
30-
token: ${{ secrets.GITHUB_TOKEN }}
35+
token: ${{ secrets.BUDDY_BOT_TOKEN || secrets.GITHUB_TOKEN }}
36+
fetch-depth: 0 # Fetch full history for rebasing
37+
persist-credentials: true
3138

3239
- name: Setup Bun
3340
uses: oven-sh/setup-bun@v2
@@ -40,6 +47,23 @@ jobs:
4047
- name: Build buddy-bot
4148
run: bun run build
4249

50+
- name: Configure Git
51+
run: |
52+
git config --global user.name "buddy-bot[bot]"
53+
git config --global user.email "buddy-bot[bot]@users.noreply.github.com"
54+
55+
- name: Check token permissions
56+
run: |
57+
if [ -z "${{ secrets.BUDDY_BOT_TOKEN }}" ]; then
58+
echo "⚠️ Using GITHUB_TOKEN (limited permissions)"
59+
echo "💡 For full workflow file update support:"
60+
echo " 1. Create a Personal Access Token with 'repo' and 'workflow' scopes"
61+
echo " 2. Add it as repository secret 'BUDDY_BOT_TOKEN'"
62+
echo " 3. Re-run this workflow"
63+
else
64+
echo "✅ Using BUDDY_BOT_TOKEN (full permissions)"
65+
fi
66+
4367
- name: Check for rebase requests
4468
run: |
4569
echo "🔍 Checking for PRs with rebase checkbox enabled..."
@@ -62,7 +86,7 @@ jobs:
6286
fi
6387
6488
env:
65-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
89+
GITHUB_TOKEN: ${{ secrets.BUDDY_BOT_TOKEN || secrets.GITHUB_TOKEN }}
6690

6791
- name: Create summary
6892
if: always()

README.md

Lines changed: 75 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ A modern, fast alternative to Dependabot and Renovate built for the JavaScript a
2121
- 📦 **Multi-Package Manager**: Supports Bun, npm, yarn, pnpm, pkgx, and Launchpad dependency files
2222
-**GitHub Actions**: Automatically updates workflow dependencies (`actions/checkout@v4`, etc.)
2323
- 📊 **Dependency Dashboard**: Single GitHub issue with overview of all dependencies and open PRs
24+
- 🔄 **Rebase Functionality**: Interactive checkbox to update PRs with latest dependency versions
2425
- 🔍 **Intelligent Scanning**: Uses `bun outdated` and GitHub releases for accurate dependency detection
2526
- 📋 **Flexible Grouping**: Group related packages for cleaner PRs
2627
- 🎨 **Rich PR Format**: Three separate tables (npm, Launchpad/pkgx, GitHub Actions) with detailed metadata
@@ -87,6 +88,11 @@ buddy scan --strategy patch
8788
buddy update --dry-run
8889
buddy update
8990

91+
# Check for rebase requests and update PRs
92+
buddy check-rebase
93+
buddy check-rebase --dry-run
94+
buddy check-rebase --verbose
95+
9096
# Get help
9197
buddy help
9298
```
@@ -200,6 +206,74 @@ The dependency dashboard provides a centralized view of all your repository's de
200206
- **🏷️ Smart Categorization**: Organized by npm, GitHub Actions, and dependency files
201207
- **⚡ Auto-Updates**: Refreshes when dependencies change
202208

209+
## Rebase Functionality
210+
211+
Buddy Bot includes powerful rebase functionality that allows you to update existing pull requests with the latest dependency versions, similar to Renovate's rebase feature.
212+
213+
### How It Works
214+
215+
All Buddy Bot pull requests include a rebase checkbox at the bottom:
216+
217+
```markdown
218+
---
219+
- [ ] <!-- rebase-check -->If you want to update/retry this PR, check this box
220+
---
221+
```
222+
223+
### Using the Rebase Feature
224+
225+
1. **Check the box**: In any Buddy Bot PR, check the rebase checkbox
226+
2. **Automatic detection**: The rebase workflow runs every minute to detect checked boxes
227+
3. **Updates applied**: The PR is automatically updated with the latest dependency versions
228+
4. **Checkbox unchecked**: After successful rebase, the checkbox is automatically unchecked
229+
230+
### Rebase Command
231+
232+
You can also trigger rebase manually using the CLI:
233+
234+
```bash
235+
# Check for PRs with rebase checkbox enabled and update them
236+
buddy-bot check-rebase
237+
238+
# Dry run to see what would be rebased
239+
buddy-bot check-rebase --dry-run
240+
241+
# With verbose output
242+
buddy-bot check-rebase --verbose
243+
```
244+
245+
### Automated Rebase Workflow
246+
247+
Buddy Bot includes a pre-built GitHub Actions workflow (`.github/workflows/buddy-bot-rebase.yml`) that:
248+
249+
- **🕐 Runs every minute**: Automatically checks for rebase requests
250+
- **🔍 Scans all PRs**: Finds Buddy Bot PRs with checked rebase boxes
251+
- **📦 Updates dependencies**: Re-scans for latest versions and updates files
252+
- **📝 Updates PR content**: Refreshes PR title, body, and file changes
253+
- **✅ Maintains workflow files**: Updates GitHub Actions workflows (requires proper permissions)
254+
255+
### Workflow File Permissions
256+
257+
For the rebase functionality to update GitHub Actions workflow files, you need proper permissions:
258+
259+
#### Option 1: Personal Access Token (Recommended)
260+
1. Create a [Personal Access Token](https://github.com/settings/tokens) with `repo` and `workflow` scopes
261+
2. Add it as a repository secret named `BUDDY_BOT_TOKEN`
262+
3. The workflow automatically uses it when available
263+
264+
#### Option 2: Default GitHub Token (Limited)
265+
- Uses `GITHUB_TOKEN` with limited permissions
266+
- Cannot update workflow files (`.github/workflows/*.yml`)
267+
- Still updates package.json, lock files, and dependency files
268+
269+
### What Gets Updated During Rebase
270+
271+
-**package.json** - npm/yarn/pnpm dependencies
272+
-**Lock files** - package-lock.json, yarn.lock, pnpm-lock.yaml, bun.lockb
273+
-**Dependency files** - deps.yaml, dependencies.yaml, pkgx.yaml
274+
-**GitHub Actions** - workflow files (with proper permissions)
275+
-**PR content** - Updated title, body, and metadata
276+
203277
### Quick Start
204278

205279
```bash
@@ -452,7 +526,7 @@ This PR contains the following updates:
452526
453527
---
454528
455-
- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box
529+
- [ ] <!-- rebase-check -->If you want to update/retry this PR, check this box
456530
457531
---
458532

bin/cli.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -524,8 +524,8 @@ cli
524524
return
525525
}
526526

527-
// Generate new package.json changes
528-
const packageJsonUpdates = await buddy.generatePackageJsonUpdates(group.updates)
527+
// Generate new file changes (package.json, dependency files, GitHub Actions)
528+
const packageJsonUpdates = await buddy.generateAllFileUpdates(group.updates)
529529

530530
// Update the branch with new commits
531531
await gitProvider.commitChanges(pr.head, group.title, packageJsonUpdates)
@@ -673,8 +673,8 @@ cli
673673
continue
674674
}
675675

676-
// Generate new package.json changes
677-
const packageJsonUpdates = await buddy.generatePackageJsonUpdates(group.updates)
676+
// Generate new file changes (package.json, dependency files, GitHub Actions)
677+
const packageJsonUpdates = await buddy.generateAllFileUpdates(group.updates)
678678

679679
// Update the branch with new commits
680680
await gitProvider.commitChanges(pr.head, group.title, packageJsonUpdates)

docs/api/buddy.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -157,9 +157,9 @@ updates.forEach((update) => {
157157

158158
## Utility Methods
159159

160-
### generatePackageJsonUpdates()
160+
### generateAllFileUpdates()
161161

162-
Generates package.json file changes for updates.
162+
Generates file changes for all update types (package.json, dependency files, GitHub Actions).
163163

164164
```typescript
165165
interface FileChange {
@@ -169,7 +169,7 @@ interface FileChange {
169169
}
170170

171171
interface BuddyUtilityMethods {
172-
generatePackageJsonUpdates: (updates: PackageUpdate[]) => Promise<FileChange[]>
172+
generateAllFileUpdates: (updates: PackageUpdate[]) => Promise<FileChange[]>
173173
}
174174
```
175175

@@ -185,7 +185,7 @@ Array of file change objects
185185

186186
```typescript
187187
const updates = await buddy.scanForUpdates()
188-
const fileChanges = await buddy.generatePackageJsonUpdates(updates.updates)
188+
const fileChanges = await buddy.generateAllFileUpdates(updates.updates)
189189

190190
fileChanges.forEach((change) => {
191191
console.log(`Updated ${change.path}`)

docs/cli/update.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,14 +198,14 @@ PRs include this checkbox for manual rebase triggers:
198198
199199
```markdown
200200
---
201-
- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box
201+
- [ ] <!-- rebase-check -->If you want to update/retry this PR, check this box
202202
---
203203
```
204204
205205
When checked (marked with `x`):
206206
207207
```markdown
208-
- [x] <!-- rebase-check -->If you want to rebase/retry this PR, check this box
208+
- [x] <!-- rebase-check -->If you want to update/retry this PR, check this box
209209
```
210210
211211
### Process

docs/features/pull-requests.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ PRs include a rebase checkbox for manual triggers:
187187

188188
```markdown
189189
---
190-
- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box
190+
- [ ] <!-- rebase-check -->If you want to update/retry this PR, check this box
191191
---
192192
```
193193

0 commit comments

Comments
 (0)