diff options
| -rwxr-xr-x | .local/bin/jira-CR.php | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/.local/bin/jira-CR.php b/.local/bin/jira-CR.php index a8955f7..cb8d637 100755 --- a/.local/bin/jira-CR.php +++ b/.local/bin/jira-CR.php @@ -15,14 +15,19 @@ if (!function_exists('array_any')) { $padlen = 50; print(str_pad("\rGetting tickets from jira...", $padlen)); -$tickets = explode("\n", rtrim(`jira-cli issues list -q"project IS NOT EMPTY and project != AUTO and project != NET and project != MSP and project != SYST and project != LOYAL" --order-by="Sprint" -s"Code Review" --columns=KEY --plain | grep -v '^KEY$'`)); +$ticket_lines = explode("\n", rtrim(`jira-cli issues list -q"project IS NOT EMPTY and project != AUTO and project != NET and project != MSP and project != SYST and project != LOYAL" --order-by="Sprint" -s"Code Review" --columns=KEY,LABELS --plain | grep -v '^KEY\b'`)); +$tickets = array_map(fn($x) => explode("\t", $x)[0], $ticket_lines); +$ticketLabels = array_combine( + $tickets, + array_map(fn($x) => explode(',', explode("\t", $x)[1] ?? ''), $ticket_lines) +); print(str_pad("\rGetting OnBDC2 PR's from github...", $padlen)); -$prs_jsons[] = json_decode(`gh pr list -L 50 -R BetterCarPeople/OnBDC2 --json 'title,url,statusCheckRollup,reviews,author,reviewDecision,reviewRequests,headRefName'`, true); +$prs_jsons[] = json_decode(`gh pr list -L 50 -R BetterCarPeople/OnBDC2 --json 'title,url,statusCheckRollup,reviews,author,reviewDecision,reviewRequests,headRefName,mergeable'`, true); print(str_pad("\rGetting maple-ai PR's from github...", $padlen)); -$prs_jsons[] = json_decode(`gh pr list -R BetterCarPeople/maple-ai --json 'title,url,statusCheckRollup,reviews,author,reviewDecision,reviewRequests,headRefName'`, true); +$prs_jsons[] = json_decode(`gh pr list -R BetterCarPeople/maple-ai --json 'title,url,statusCheckRollup,reviews,author,reviewDecision,reviewRequests,headRefName,mergeable'`, true); print(str_pad("\rGetting maple-web PR's from github...", $padlen)); -$prs_jsons[] = json_decode(`gh pr list -R BetterCarPeople/maple-web --json 'title,url,statusCheckRollup,reviews,author,reviewDecision,reviewRequests,headRefName'`, true); +$prs_jsons[] = json_decode(`gh pr list -R BetterCarPeople/maple-web --json 'title,url,statusCheckRollup,reviews,author,reviewDecision,reviewRequests,headRefName,mergeable'`, true); print(str_pad("\r", $padlen)); print("\r"); @@ -43,6 +48,14 @@ foreach ($prs_json as $pr) { } $author = $pr['author']['login']; + $labels = $ticketLabels[$pr_ticket] ?? []; + $labelsText = trim( + (in_array("Successful_Demonstration", $labels) ? "📺 Demo'd " : '') + . (in_array("Hot", $labels) ? "🔥 Hot " : '') + ); + + $mergeable = $pr['mergeable'] == 'CONFLICTING' ? '🚧: Merge conflicts. ' : ''; + // Show pipeline status if failed $failedPipes = []; foreach ($pr['statusCheckRollup'] as $scr) { @@ -99,7 +112,7 @@ foreach ($prs_json as $pr) { // Show review requested for // show other review statuses - echo "$pr[url]?T=$title($author)$pipeline_status$review_status\n"; + echo "$pr[url]?T=$title($author)$labelsText$mergeable$pipeline_status$review_status\n"; } } $has_no_pr = array_diff($tickets, array_keys($has_pr)); |
