Skip to content

Commit d6f7246

Browse files
committed
chore: wip
1 parent 0c41eb3 commit d6f7246

File tree

2 files changed

+72
-2
lines changed

2 files changed

+72
-2
lines changed

.github/workflows/buddy-update.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,39 @@ jobs:
5656
with:
5757
bun-version: latest
5858

59+
- name: Setup PHP and Composer
60+
uses: shivammathur/setup-php@v2
61+
with:
62+
php-version: '8.4'
63+
tools: composer
64+
coverage: none
65+
5966
- name: Install dependencies
6067
run: bun install
6168

69+
- name: Install Composer dependencies
70+
run: composer install --no-dev --prefer-dist --optimize-autoloader
71+
6272
- name: Build buddy-bot
6373
run: bun run build
6474

75+
- name: Verify Composer setup
76+
run: |
77+
echo "🔍 Verifying Composer and PHP setup..."
78+
php --version
79+
composer --version
80+
echo ""
81+
echo "📦 Checking composer.json..."
82+
if [ -f "composer.json" ]; then
83+
echo "✅ composer.json found"
84+
composer validate --no-check-all --strict
85+
echo ""
86+
echo "📋 Composer packages in composer.json:"
87+
cat composer.json | jq -r '.require, ."require-dev" | to_entries[] | "\(.key): \(.value)"' 2>/dev/null || echo "Unable to parse with jq, showing raw content:"
88+
else
89+
echo "❌ composer.json not found"
90+
fi
91+
6592
- name: Display test configuration
6693
run: |
6794
echo "🧪 **Buddy Bot Testing Mode**"

src/pr/pr-generator.ts

Lines changed: 45 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,10 @@ export class PullRequestGenerator {
7171

7272
// Separate updates by type
7373
const packageJsonUpdates = group.updates.filter(update =>
74-
update.file === 'package.json' || (!update.file.includes('.yaml') && !update.file.includes('.yml') && !update.file.includes('.github/workflows/')),
74+
update.file === 'package.json',
75+
)
76+
const composerUpdates = group.updates.filter(update =>
77+
update.file.endsWith('composer.json') || update.file.endsWith('composer.lock'),
7578
)
7679
const dependencyFileUpdates = group.updates.filter(update =>
7780
update.file.includes('.yaml') || update.file.includes('.yml'),
@@ -165,6 +168,32 @@ export class PullRequestGenerator {
165168
body += `\n`
166169
}
167170

171+
// Composer packages table (simplified, without badges)
172+
if (composerUpdates.length > 0) {
173+
body += `### PHP/Composer Dependencies\n\n`
174+
body += `| Package | Change | File | Status |\n`
175+
body += `|---|---|---|---|\n`
176+
177+
for (const update of composerUpdates) {
178+
// Generate package link to Packagist
179+
const packageUrl = `https://packagist.org/packages/${encodeURIComponent(update.name)}`
180+
const packageCell = `[${update.name}](${packageUrl})`
181+
182+
// Simple version change display
183+
const change = `\`${update.currentVersion}\` -> \`${update.newVersion}\``
184+
185+
// File reference
186+
const fileName = update.file.split('/').pop() || update.file
187+
188+
// Status (simple)
189+
const status = '✅ Available'
190+
191+
body += `| ${packageCell} | ${change} | ${fileName} | ${status} |\n`
192+
}
193+
194+
body += `\n`
195+
}
196+
168197
// Dependency files table (simplified, without badges)
169198
if (dependencyFileUpdates.length > 0) {
170199
body += `### Launchpad/pkgx Dependencies\n\n`
@@ -329,6 +358,15 @@ export class PullRequestGenerator {
329358
body += `</details>\n\n`
330359
}
331360

361+
// Process Composer updates with simple release notes
362+
for (const update of composerUpdates) {
363+
body += `<details>\n`
364+
body += `<summary>${update.name}</summary>\n\n`
365+
body += `**${update.currentVersion} -> ${update.newVersion}**\n\n`
366+
body += `Visit [${update.name}](https://packagist.org/packages/${encodeURIComponent(update.name)}) on Packagist for more information.\n\n`
367+
body += `</details>\n\n`
368+
}
369+
332370
// Process GitHub Actions updates with simple release notes (no duplicates)
333371
for (const update of uniqueGithubActionsUpdates) {
334372
body += `<details>\n`
@@ -341,7 +379,7 @@ export class PullRequestGenerator {
341379
body += `---\n\n`
342380

343381
// Package statistics section (deduplicated)
344-
if (packageInfos.size > 0 || dependencyOnlyUpdates.length > 0 || uniqueGithubActionsUpdates.length > 0) {
382+
if (packageInfos.size > 0 || composerUpdates.length > 0 || dependencyOnlyUpdates.length > 0 || uniqueGithubActionsUpdates.length > 0) {
345383
body += `### 📊 Package Statistics\n\n`
346384

347385
// Stats for package.json updates
@@ -353,6 +391,11 @@ export class PullRequestGenerator {
353391
}
354392
}
355393

394+
// Stats for Composer updates (simplified)
395+
for (const update of composerUpdates) {
396+
body += `- **${update.name}**: PHP package available on Packagist\n`
397+
}
398+
356399
// Stats for dependency file updates (simplified, only for those not in package.json)
357400
for (const update of dependencyOnlyUpdates) {
358401
const displayName = update.name === 'bun.sh' ? 'bun.com' : update.name

0 commit comments

Comments
 (0)