@@ -23,35 +23,35 @@ function run() {
23
23
const issues = JSON . parse ( app . doShellScript ( `curl -sL "${ apiURL } "` ) ) . items . map (
24
24
( /** @type {GithubIssue } */ item ) => {
25
25
const issueAuthor = item . user . login ;
26
- const isPR = Boolean ( item . pull_request ) ;
27
- const merged = Boolean ( item . pull_request ?. merged_at ) ;
28
- const title = item . title ;
29
26
const repo = ( item . repository_url . match ( / [ ^ / ] + $ / ) || "" ) [ 0 ] ;
30
27
const comments = item . comments > 0 ? "💬 " + item . comments . toString ( ) : "" ;
31
- const open = item . state === "open" ;
32
- const closed = item . state === "closed" ;
33
- const reason = item . state_reason ;
34
28
const labels = item . labels . map ( ( label ) => `[${ label . name } ]` ) . join ( " " ) ;
35
29
36
30
const subtitle = [ `#${ item . number } ` , repo , comments . toString ( ) , labels ]
37
31
. filter ( Boolean )
38
32
. join ( " " ) ;
39
33
40
- // icon
34
+ // ICON
41
35
let icon = issueAuthor === username ? "✏️ " : "" ;
42
- if ( open && isPR ) icon += "🟩 " ;
43
- else if ( closed && isPR && merged ) icon += "🟪 " ;
44
- else if ( closed && isPR && ! merged ) icon += "🟥 " ;
45
- else if ( open && ! isPR ) icon += "🟢 " ;
46
- else if ( closed && reason === "not_planned" ) icon += "⚪ " ;
47
- else if ( closed && reason === "completed" ) icon += "🟣 " ;
36
+ if ( item . pull_request ) {
37
+ if ( item . draft ) icon += "⬜ " ;
38
+ else if ( item . state === "open" ) icon += "🟩 " ;
39
+ else if ( item . pull_request . merged_at ) icon += "🟪 " ;
40
+ else icon += "🟥 " ;
41
+ } else {
42
+ // biome-ignore lint/style/useCollapsedElseIf: here it's more readable this way
43
+ if ( item . state === "open" ) icon += "🟢 " ;
44
+ else if ( item . state_reason === "not_planned" ) icon += "⚪ " ;
45
+ else if ( item . state_reason === "completed" ) icon += "🟣 " ;
46
+ }
48
47
49
48
let matcher = alfredMatcher ( item . title ) + " " + alfredMatcher ( repo ) + " " + item . state ;
50
- if ( isPR ) matcher += " pr" ;
49
+ if ( item . pull_request ) matcher += " pr" ;
51
50
else matcher += " issue" ;
51
+ if ( item . draft ) matcher += " draft" ;
52
52
53
53
return {
54
- title : icon + title ,
54
+ title : icon + item . title ,
55
55
subtitle : subtitle ,
56
56
match : matcher ,
57
57
arg : item . html_url ,
0 commit comments