Skip to content

Commit e8fa170

Browse files
committed
chore: wip
1 parent 65240d5 commit e8fa170

File tree

2 files changed

+44
-24
lines changed

2 files changed

+44
-24
lines changed

.github/workflows/buddy-update.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ permissions:
4040
actions: read
4141
checks: read
4242
statuses: read
43+
workflows: write
4344

4445
jobs:
4546
test-dependency-updates:

src/buddy.ts

Lines changed: 43 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -444,36 +444,55 @@ export class Buddy {
444444
}
445445

446446
// Handle dependency file updates (deps.yaml, dependencies.yaml, etc.)
447-
try {
448-
const { generateDependencyFileUpdates } = await import('./utils/dependency-file-parser')
449-
const dependencyFileUpdates = await generateDependencyFileUpdates(updates)
450-
fileUpdates.push(...dependencyFileUpdates)
451-
}
452-
catch (error) {
453-
this.logger.error('Failed to generate dependency file updates:', error)
454-
// Continue with package.json updates even if dependency file updates fail
447+
// Only process if we have dependency file updates to avoid unnecessary processing
448+
const dependencyFileUpdates = updates.filter(update =>
449+
(update.file.includes('.yaml') || update.file.includes('.yml')) &&
450+
!update.file.includes('.github/workflows/')
451+
)
452+
if (dependencyFileUpdates.length > 0) {
453+
try {
454+
const { generateDependencyFileUpdates } = await import('./utils/dependency-file-parser')
455+
const depFileUpdates = await generateDependencyFileUpdates(dependencyFileUpdates)
456+
fileUpdates.push(...depFileUpdates)
457+
}
458+
catch (error) {
459+
this.logger.error('Failed to generate dependency file updates:', error)
460+
// Continue with other updates even if dependency file updates fail
461+
}
455462
}
456463

457464
// Handle Composer updates
458-
try {
459-
const { generateComposerUpdates } = await import('./utils/composer-parser')
460-
const composerUpdates = await generateComposerUpdates(updates)
461-
fileUpdates.push(...composerUpdates)
462-
}
463-
catch (error) {
464-
this.logger.error('Failed to generate Composer updates:', error)
465-
// Continue with other updates even if Composer updates fail
465+
// Only process if we have composer updates to avoid unnecessary processing
466+
const composerUpdates = updates.filter(update =>
467+
update.file.endsWith('composer.json') || update.file.endsWith('composer.lock')
468+
)
469+
if (composerUpdates.length > 0) {
470+
try {
471+
const { generateComposerUpdates } = await import('./utils/composer-parser')
472+
const compUpdates = await generateComposerUpdates(composerUpdates)
473+
fileUpdates.push(...compUpdates)
474+
}
475+
catch (error) {
476+
this.logger.error('Failed to generate Composer updates:', error)
477+
// Continue with other updates even if Composer updates fail
478+
}
466479
}
467480

468481
// Handle GitHub Actions updates
469-
try {
470-
const { generateGitHubActionsUpdates } = await import('./utils/github-actions-parser')
471-
const githubActionsUpdates = await generateGitHubActionsUpdates(updates)
472-
fileUpdates.push(...githubActionsUpdates)
473-
}
474-
catch (error) {
475-
this.logger.error('Failed to generate GitHub Actions updates:', error)
476-
// Continue with other updates even if GitHub Actions updates fail
482+
// Only process if we have GitHub Actions updates to avoid unnecessary processing
483+
const githubActionsUpdates = updates.filter(update =>
484+
update.file.includes('.github/workflows/')
485+
)
486+
if (githubActionsUpdates.length > 0) {
487+
try {
488+
const { generateGitHubActionsUpdates } = await import('./utils/github-actions-parser')
489+
const ghActionsUpdates = await generateGitHubActionsUpdates(githubActionsUpdates)
490+
fileUpdates.push(...ghActionsUpdates)
491+
}
492+
catch (error) {
493+
this.logger.error('Failed to generate GitHub Actions updates:', error)
494+
// Continue with other updates even if GitHub Actions updates fail
495+
}
477496
}
478497

479498
return fileUpdates

0 commit comments

Comments
 (0)