Skip to content
Draft
Show file tree
Hide file tree
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
36 changes: 28 additions & 8 deletions scripts/_create_issue_branch.ps1
Original file line number Diff line number Diff line change
@@ -1,28 +1,48 @@
param (
[int]$IssueId ,
[bool]$doNotCheckOldColumnName = 0
[string]$Assignee,
[int]$IssueId,
[bool]$doNotCheckOldColumnName = 0,
[switch]$All
)

# Determine effective assignee
if ($All) {
$list_all = $true
} elseif ($Assignee) {
$effectiveAssignee = $Assignee
} else {
$effectiveAssignee = "@me"
}

# Get the current script directory
$scriptDir = Split-Path -Path $MyInvocation.MyCommand.Definition -Parent
# Construct the full path to _is_on_dev_nothing_to_commit.ps1
$_is_on_dev_nothing_to_commit = Join-Path -Path $scriptDir -ChildPath "_is_on_dev_nothing_to_commit.ps1"

# Call _is_on_dev_nothing_to_commit.ps1
$is_on_dev_nothing_to_commit = & $_is_on_dev_nothing_to_commit
if(-not $is_on_dev_nothing_to_commit)

if($is_on_dev_nothing_to_commit -ne 1)
{
Write-Host "You are not currently on the 'dev' branch, or you have some uncommited changes " -ForegroundColor Red
Write-Host "Commit your local changes, sync your local 'dev' branch with the remote and start this script again." -ForegroundColor Red
exit 1
}

# ----------------------
# LIST ISSUES
# ----------------------

# gh issue list --assignee "@me" --state "open"
# $issues = gh issue list --state "open" --assignee "@me" --json number,title | ConvertFrom-Json

gh issue list --state "open"
$issues = gh issue list --state "open" --json number,title | ConvertFrom-Json
if ($list_all) {
Write-Host "Listing ALL open issues..."
gh issue list --state open
$issues = gh issue list --state "open" --json number,title,labels | ConvertFrom-Json
}
else {
Write-Host "Listing open issues assigned to: $effectiveAssignee"
gh issue list --state open --assignee $effectiveAssignee
$issues = gh issue list --state "open" --assignee $effectiveAssignee --json number,title,labels | ConvertFrom-Json
}

$issueIDs = $issues | ForEach-Object { $_.number }

Expand Down
8 changes: 4 additions & 4 deletions scripts/_is_on_dev_nothing_to_commit.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,24 @@ if($currentBranch -ne "dev")
{
Write-Output "You are not currently on the 'dev' branch."
Write-Host "You are not currently on the 'dev' branch, but $currentBranch " -ForegroundColor Red
return $false
return -1
}
else
{
Write-Host "You are currently on the 'dev' branch" -ForegroundColor Green
}
$isClean =$false
$isClean = -1
$status = git status
foreach ($statusLine in $status )
{
if ($statusLine -eq "nothing to commit, working tree clean")
{
$isClean = $true
$isClean = 1
Write-Host "Nothing to commit, working tree clean" -ForegroundColor Green
break
}
}
if(-not $isClean)
if($isClean -ne 1)
{
Write-Host "You have some uncommited changes on the 'dev' branch" -ForegroundColor Red
}
Expand Down