diff options
| author | Zach DeCook <zach.decook@bettercarpeople.com> | 2026-05-12 11:13:44 -0400 |
|---|---|---|
| committer | Zach DeCook <zach.decook@bettercarpeople.com> | 2026-05-12 11:13:44 -0400 |
| commit | c154fdc703c381dd92123bdff9c8287620309792 (patch) | |
| tree | d3a653ee65d21e401e6ac4ceff49d8594822c1d0 | |
| parent | 0e22ef25094a057ea618bc9c40499c67f93e7dd9 (diff) | |
| download | dotfiles-c154fdc703c381dd92123bdff9c8287620309792.tar.gz | |
jira-CR.php: Minor refactors
| -rwxr-xr-x | .local/bin/jira-CR.php | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/.local/bin/jira-CR.php b/.local/bin/jira-CR.php index cb8d637..fc72906 100755 --- a/.local/bin/jira-CR.php +++ b/.local/bin/jira-CR.php @@ -15,19 +15,21 @@ if (!function_exists('array_any')) { $padlen = 50; print(str_pad("\rGetting tickets from jira...", $padlen)); -$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'`)); +$ticket_lines = explode("\n", rtrim(shell_exec("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) ); +$params = 'title,url,statusCheckRollup,reviews,author,reviewDecision,reviewRequests,headRefName,mergeable'; + 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,mergeable'`, true); +$prs_jsons[] = json_decode(shell_exec("gh pr list -L 50 -R BetterCarPeople/OnBDC2 --json '$params'"), 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,mergeable'`, true); +$prs_jsons[] = json_decode(shell_exec("gh pr list -R BetterCarPeople/maple-ai --json '$params'"), 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,mergeable'`, true); +$prs_jsons[] = json_decode(shell_exec("gh pr list -R BetterCarPeople/maple-web --json '$params'"), true); print(str_pad("\r", $padlen)); print("\r"); @@ -77,7 +79,6 @@ foreach ($prs_json as $pr) { } } $changeNames = array_unique($changeNames); - $changes = $changeNames ? (str_repeat("❌", count($changeNames)) . ": " . implode(", ", $changeNames) . '. ') : ''; $requestNames = []; foreach ($pr['reviewRequests'] as $rr) { @@ -88,7 +89,6 @@ foreach ($prs_json as $pr) { } } $requestNames = array_unique($requestNames); - $reviewRequests = $requestNames ? (str_repeat("🟡", count($requestNames)) . ": " . implode(", ", $requestNames) . '. ') : ''; $approvers = []; foreach ($pr['reviews'] as $r) { @@ -96,7 +96,6 @@ foreach ($prs_json as $pr) { $approvers[] = $r['author']['login']; } } - $approvals = $approvers ? (str_repeat("✅", count($approvers)) . ": " . implode(", ", $approvers) . '. ') : ''; $commentNames = []; foreach ($pr['reviews'] as $r) { @@ -106,11 +105,13 @@ foreach ($prs_json as $pr) { } } $commentNames = array_unique($commentNames); + + $changes = $changeNames ? (str_repeat("❌", count($changeNames)) . ": " . implode(", ", $changeNames) . '. ') : ''; + $reviewRequests = $requestNames ? (str_repeat("🟡", count($requestNames)) . ": " . implode(", ", $requestNames) . '. ') : ''; + $approvals = $approvers ? (str_repeat("✅", count($approvers)) . ": " . implode(", ", $approvers) . '. ') : ''; $comments = $commentNames ? (str_repeat("💬", count($commentNames)) . ": " . implode(", ", $commentNames) . '. ') : ''; $review_status = $changes . $reviewRequests . $approvals . $comments; - // Show review requested for - // show other review statuses echo "$pr[url]?T=$title($author)$labelsText$mergeable$pipeline_status$review_status\n"; } |
