Skip to content

Commit 0a321b3

Browse files
author
David Hasani
committed
fix(amazonq): exclude .github dir from upload ZIP
1 parent 6d13999 commit 0a321b3

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

plugins/amazonq/codetransform/jetbrains-community/src/software/aws/toolkits/jetbrains/services/codemodernizer/model/CodeModernizerSessionContext.kt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ const val MAVEN_BUILD_SKIP_UNIT_TESTS = "clean test-compile"
5858
const val MAVEN_DEFAULT_BUILD_DIRECTORY_NAME = "target"
5959
const val IDEA_DIRECTORY_NAME = ".idea"
6060
const val GIT_DIRECTORY_NAME = ".git"
61+
const val GITHUB_DIRECTORY_NAME = ".github"
6162
const val DS_STORE_FILE_NAME = ".DS_Store"
6263
const val INVALID_SUFFIX_SHA = "sha1"
6364
const val INVALID_SUFFIX_REPOSITORIES = "repositories"
@@ -96,10 +97,12 @@ data class CodeModernizerSessionContext(
9697

9798
private fun File.isGitFolder(): Boolean = this.isDirectory && this.name == GIT_DIRECTORY_NAME
9899

100+
private fun File.isGithubFolder(): Boolean = this.isDirectory && this.name == GITHUB_DIRECTORY_NAME
101+
99102
private fun findDirectoriesToExclude(sourceFolder: File): List<File> {
100103
val excluded = mutableListOf<File>()
101104
sourceFolder.walkTopDown().onEnter {
102-
if (it.isMavenTargetFolder() || it.isIdeaFolder() || it.isGitFolder()) {
105+
if (it.isMavenTargetFolder() || it.isIdeaFolder() || it.isGitFolder() || it.isGithubFolder()) {
103106
excluded.add(it)
104107
return@onEnter false
105108
}

plugins/amazonq/codetransform/jetbrains-community/tst/software/aws/toolkits/jetbrains/services/codemodernizer/CodeWhispererCodeModernizerSessionTest.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -335,13 +335,14 @@ class CodeWhispererCodeModernizerSessionTest : CodeWhispererCodeModernizerTestBa
335335
}
336336

337337
@Test
338-
fun `CodeModernizerSession can create zip and excludes idea folder`() {
338+
fun `CodeModernizerSession can create zip and excludes idea folder and github folder`() {
339339
addFilesToProjectModule(
340340
"pom.xml",
341341
"src/tmp.java",
342342
".idea/smth.iml",
343343
"someModule/pom.xml",
344-
"someModule/.idea/smthelse.iml"
344+
"someModule/.idea/smthelse.iml",
345+
"someModule/.github/test.txt"
345346
)
346347
// get project.projectFile because project.projectFile can not be null
347348
val rootManager = ModuleRootManager.getInstance(module)

0 commit comments

Comments
 (0)