Skip to content

Commit d09a8c3

Browse files
authored
Stacky comment now includes PR status as of last push (#23)
Updated emoji logic match stacky inbox categorization: - 🚧 Construction for draft PRs (work in progress) - βœ… Check-mark for approved PRs - πŸ”„ Loading for PRs waiting on review (has pending review requests) - ❌ X for PRs waiting on author action (no pending reviews, likely needs changes)
1 parent 3340152 commit d09a8c3

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

β€Žsrc/stacky/stacky.pyβ€Ž

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,9 @@ def get_pr_info(branch: BranchName, *, full: bool = False) -> PRInfos:
331331
"title",
332332
"baseRefName",
333333
"headRefName",
334+
"reviewDecision",
335+
"reviewRequests",
336+
"isDraft",
334337
]
335338
if full:
336339
fields += ["commits"]
@@ -985,7 +988,27 @@ def add_branch_to_stack(b: StackBranch, depth: int):
985988
indent = " " * depth
986989
pr_info = ""
987990
if b.open_pr_info:
988-
pr_info = f" (#{b.open_pr_info['number']})"
991+
pr_number = b.open_pr_info['number']
992+
993+
# Add approval status emoji using same logic as stacky inbox
994+
review_decision = b.open_pr_info.get('reviewDecision')
995+
review_requests = b.open_pr_info.get('reviewRequests', [])
996+
is_draft = b.open_pr_info.get('isDraft', False)
997+
998+
status_emoji = ""
999+
if is_draft:
1000+
# Draft PRs are waiting on author
1001+
status_emoji = " 🚧"
1002+
elif review_decision == "APPROVED":
1003+
status_emoji = " βœ…"
1004+
elif review_requests and len(review_requests) > 0:
1005+
# Has pending review requests - waiting on review
1006+
status_emoji = " πŸ”„"
1007+
else:
1008+
# No pending review requests, likely needs changes or author action
1009+
status_emoji = " ❌"
1010+
1011+
pr_info = f" (#{pr_number}{status_emoji})"
9891012

9901013
# Add arrow indicator for current branch (the one this PR represents)
9911014
current_indicator = " ← (CURRENT PR)" if b.name == current_branch.name else ""

0 commit comments

Comments
Β (0)