Skip to content

Commit

Permalink
Merge pull request #3 from Nirmal-Data-Scientist/js-folder
Browse files Browse the repository at this point in the history
Folder which holds all js files added
  • Loading branch information
perjo927 authored Jun 11, 2023
2 parents fc57bc5 + d3b6c1b commit cadfa2f
Showing 1 changed file with 12 additions and 8 deletions.
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

0 comments on commit cadfa2f

Please sign in to comment.