Skip to content

Commit 6c95cc5

Browse files
committed
chore: respect ignored paths
1 parent e7f6fbd commit 6c95cc5

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
"lint:fix": "bunx --bun eslint . --fix",
5252
"changelog": "bunx logsmith --verbose",
5353
"changelog:generate": "bunx logsmith --output CHANGELOG.md",
54-
"release": "bun run changelog:generate && bunx bumpx prompt --recursive",
54+
"release": "bun run changelog:generate && bunx bumpx -r --push",
5555
"postinstall": "bunx git-hooks",
5656
"typecheck": "bunx tsc --noEmit",
5757
"dev:docs": "bun --bun vitepress dev docs",

src/buddy.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1289,6 +1289,30 @@ export class Buddy {
12891289
if (removedFiles.length > 0) {
12901290
this.logger.info(`PR #${existingPR.number} references removed files: ${removedFiles.join(', ')}`)
12911291

1292+
// Check if the removed files are outside ignored paths - if so, don't auto-close
1293+
if (this.config.packages?.ignorePaths && this.config.packages.ignorePaths.length > 0) {
1294+
const { Glob } = require('bun')
1295+
1296+
const filesOutsideIgnoredPaths = removedFiles.filter((filePath) => {
1297+
return !this.config.packages!.ignorePaths!.some((pattern) => {
1298+
try {
1299+
const glob = new Glob(pattern)
1300+
return glob.match(filePath)
1301+
}
1302+
catch (error) {
1303+
this.logger.warn(`Invalid glob pattern '${pattern}':`, error)
1304+
return false
1305+
}
1306+
})
1307+
})
1308+
1309+
// If any removed files are outside ignored paths, don't auto-close
1310+
if (filesOutsideIgnoredPaths.length > 0) {
1311+
this.logger.info(`Some removed files are outside ignored paths - not auto-closing PR #${existingPR.number}`)
1312+
return false
1313+
}
1314+
}
1315+
12921316
// Special handling for composer files - if composer.json is removed, close all composer-related PRs
12931317
const hasRemovedComposerJson = removedFiles.some(file => file.endsWith('composer.json'))
12941318
if (hasRemovedComposerJson) {

0 commit comments

Comments
 (0)