Skip to content

Commit fe0c2ba

Browse files
committed
handle dependabot like commits
1 parent 9448fbb commit fe0c2ba

File tree

1 file changed

+29
-15
lines changed

1 file changed

+29
-15
lines changed

Modules/Scripts/Get-Merges.ps1

+29-15
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,8 @@ Begin
104104
}
105105
}
106106

107-
Write-Verbose 'defaulting to main branch'
108-
return 'main'
107+
Write-Verbose 'defaulting to master branch'
108+
return 'master'
109109
}
110110

111111
function ReadRemote
@@ -155,16 +155,28 @@ Begin
155155

156156
if (-not $a.Matches.Success)
157157
{
158-
# should execute on first $line
159-
# repo is non-conformant so fallback entire report and exit quickly
160-
Write-Verbose "fallback: $line"
161-
ReportRaw
162-
break
158+
# probably from dependabot
159+
$a = $parts[3] | Select-String -Pattern "Merge pull request (#[0-9]+) from (.+)"
160+
if ($a.Matches.Success)
161+
{
162+
$groups = $a.Matches.Groups
163+
ReportPrettyLine $parts[1] $parts[2] $groups[1] '-' $groups[2]
164+
}
165+
else
166+
{
167+
# should execute on first $line
168+
# repo is non-conformant so fallback entire report and exit quickly
169+
Write-Verbose "fallback: $line"
170+
ReportRaw
171+
break
172+
}
163173
}
174+
else
175+
{
176+
$groups = $a.Matches.Groups
164177

165-
$groups = $a.Matches.Groups
166-
167-
ReportPrettyLine $parts[1] $parts[2] $groups[1] $groups[2] $groups[3]
178+
ReportPrettyLine $parts[1] $parts[2] $groups[1] $groups[2] $groups[3]
179+
}
168180
}
169181
}
170182

@@ -204,24 +216,26 @@ Begin
204216
}
205217

206218
$status = $response.fields.status.name
207-
$pstatus = $status.PadRight(11)
208219

209220
if ($response.fields.issueType.name -eq "Story")
210221
{
211222
Write-Host "$author $ago $pkey " -NoNewline
212223

224+
$storyStatus = $status.PadRight(11)
225+
213226
switch ($status)
214227
{
215-
"Verified" { Write-Host $pstatus -NoNewline -ForegroundColor Green }
216-
"Passed" { Write-Host $pstatus -NoNewline -ForegroundColor Yellow }
217-
default { Write-Host $pstatus -NoNewline -ForegroundColor Cyan }
228+
"Verified" { Write-Host $storyStatus -NoNewline -ForegroundColor Green }
229+
"Passed" { Write-Host $storyStatus -NoNewline -ForegroundColor Yellow }
230+
default { Write-Host $storyStatus -NoNewline -ForegroundColor Cyan }
218231
}
219232

220233
Write-Host " PR $pr $desc"
221234
}
222235
else
223236
{
224-
Write-Host "$author $ago $pkey $pstatus PR $pr $desc (task)" -ForegroundColor DarkGray
237+
$taskStatus = "Task:$status".PadRight(11)
238+
Write-Host "$author $ago $pkey $taskStatus PR $pr $desc" -ForegroundColor DarkGray
225239
}
226240
}
227241
}

0 commit comments

Comments
 (0)