We only need to exclude the .git folder

This commit is contained in:
Joel Ambass
2024-09-03 15:37:40 +02:00
parent 49e905350a
commit 87530877ea
4 changed files with 20 additions and 11 deletions
+7 -3
View File
@@ -90,7 +90,7 @@ export function readFileContents(filePath: string): Buffer {
return fs.readFileSync(filePath)
}
// Copy actions files from sourceDir to targetDir, excluding files and folders not relevant to the action
// Copy actions files from sourceDir to targetDir, excluding the .git folder.
// Errors if the repo appears to not contain any action files, such as an action.yml file
export function stageActionFiles(actionDir: string, targetDir: string): void {
let actionYmlFound = false
@@ -103,8 +103,12 @@ export function stageActionFiles(actionDir: string, targetDir: string): void {
actionYmlFound = true
}
// Filter out hidden folers like .git and .github
return basename === '.' || !basename.startsWith('.')
// Filter out the .git folder.
if (basename === '.git') {
return false
}
return true
}
})