Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Folder which holds all js files added #3

Merged
merged 1 commit into from
Jun 11, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 12 additions & 8 deletions gitbot.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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
}
Expand Down Expand Up @@ -85,5 +90,4 @@ $msg = CreateMessage $branch $commitmsg
CreateContent $name
CommitAndPush $msg
MergeBranch $branch
DeleteBranch $branch
git push origin --delete $branch
DeleteBranch $branch