Skip to content

Commit

Permalink
[Fix] Team Linter - Bug in Label assignment (#384)
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisSidebotham authored Dec 7, 2023
1 parent 5fcbc82 commit 61aef2b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ function New-AVMGitHubTeamsIssue {
[Parameter(Mandatory)]
[string]$assignee,
[Parameter(Mandatory)]
[string]$body,
[Parameter(Mandatory=$false)]
[array]$labels
[string]$body
)
# Validate Auth Status
gh auth status
Expand All @@ -17,11 +15,10 @@ function New-AVMGitHubTeamsIssue {
exit 1
}
try {
# Build the labels part of the command
$joinedLabels = $labels | ForEach-Object { "--label $_" } -join ' '

# Construct the full command
gh issue create --title $title --body $body --assignee $assignee $joinedLabels
if ($PSCmdlet.ShouldProcess($title, "Create New GitHub Issue")) {
gh issue create --title $title --body $body --assignee $assignee --label "Type: AVM :a: :v: :m:" --label "Needs: Triage :mag:"
}
}
catch {
Write-Error "Unable to create issue. Check network connection."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,14 @@ function Set-AvmGitHubTeamsIssue {
$teamTable = "| Team Name | Owner | Issue |`n| --- | --- | --- |`n| $TeamName | $Owner | $validationError |"
$resolutionSegment = "# Resolution `n$ResolutionInfo"
$body = "$teamError`n`n$teamTable`n`n$resolutionSegment`n`n$bodyAutoDisclaimer"
$labels = @("Needs: Triage :mag:", "Type: AVM :a: :v: :m:")

$issues = Find-GithubIssue -title $title

if (($issues -like "No match found*") -And $CreateIssues) {
Write-Output "No issue found for: $($title), Creating new issue."
try {
if ($PSCmdlet.ShouldProcess($TeamName, "Create GitHub Issue")) {
New-AvmGitHubTeamsIssue -title $title -assignee $Owner -body $body -labels $labels
New-AvmGitHubTeamsIssue -title $title -assignee $Owner -body $body
}
}
catch {
Expand Down

0 comments on commit 61aef2b

Please sign in to comment.