diff --git a/packages/core/src/codewhisperer/service/transformByQ/transformApiHandler.ts b/packages/core/src/codewhisperer/service/transformByQ/transformApiHandler.ts index 00dc16398da..45d95ec9a75 100644 --- a/packages/core/src/codewhisperer/service/transformByQ/transformApiHandler.ts +++ b/packages/core/src/codewhisperer/service/transformByQ/transformApiHandler.ts @@ -275,7 +275,8 @@ function isExcludedSourceFile(path: string): boolean { return sourceExcludedExtensions.some((extension) => path.endsWith(extension)) } -// zip all dependency files and all source files excluding "target" (contains large JARs) plus ".git" and ".idea" (may appear in diff.patch) +// zip all dependency files and all source files +// excludes "target" (contains large JARs) plus ".git", ".idea", and ".github" (may appear in diff.patch) export function getFilesRecursively(dir: string, isDependenciesFolder: boolean): string[] { const entries = nodefs.readdirSync(dir, { withFileTypes: true }) const files = entries.flatMap((entry) => { @@ -284,7 +285,12 @@ export function getFilesRecursively(dir: string, isDependenciesFolder: boolean): if (isDependenciesFolder) { // include all dependency files return getFilesRecursively(res, isDependenciesFolder) - } else if (entry.name !== 'target' && entry.name !== '.git' && entry.name !== '.idea') { + } else if ( + entry.name !== 'target' && + entry.name !== '.git' && + entry.name !== '.idea' && + entry.name !== '.github' + ) { // exclude the above directories when zipping source code return getFilesRecursively(res, isDependenciesFolder) } else { diff --git a/packages/core/src/test/codewhisperer/commands/transformByQ.test.ts b/packages/core/src/test/codewhisperer/commands/transformByQ.test.ts index 3b12fcefbc0..218fa384c1e 100644 --- a/packages/core/src/test/codewhisperer/commands/transformByQ.test.ts +++ b/packages/core/src/test/codewhisperer/commands/transformByQ.test.ts @@ -503,6 +503,10 @@ dependencyManagement: await fs.mkdir(gitFolder) await fs.writeFile(path.join(gitFolder, 'config'), 'sample content for the test file') + const githubFolder = path.join(tempDir, '.github') + await fs.mkdir(githubFolder) + await fs.writeFile(path.join(githubFolder, 'config'), 'more sample content for the test file') + const zippedFiles = getFilesRecursively(tempDir, false) assert.strictEqual(zippedFiles.length, 1) })