diff --git a/gitbot.ps1 b/gitbot.ps1 index 7f2c88e..6b598d1 100644 --- a/gitbot.ps1 +++ b/gitbot.ps1 @@ -37,13 +37,18 @@ function CreateContent { $text2 = "console.log(str);" $text = "$text1 $text2" - # Create - $text | Set-Content "$word.js" - - # Append - #text | Add-Content 'file.js' + # Create the folder if it doesn't exist + $folderPath = "js-files" + if (-not (Test-Path $folderPath -PathType Container)) { + New-Item -Path $folderPath -ItemType Directory | Out-Null + } + + # Create the JavaScript file inside the folder + $filePath = Join-Path $folderPath "$word.js" + $text | Set-Content $filePath } + function CreateMessage { param([string]$name, $msg) @@ -55,7 +60,7 @@ function CreateMessage { function CommitAndPush { param([string]$msg) - git add . + git add -A "js-files" # Add all files in the "js-files" folder git commit -m $msg git push } @@ -85,5 +90,4 @@ $msg = CreateMessage $branch $commitmsg CreateContent $name CommitAndPush $msg MergeBranch $branch -DeleteBranch $branch -git push origin --delete $branch \ No newline at end of file +DeleteBranch $branch \ No newline at end of file