Skip to content

Commit

Permalink
Add script to calculate issue votes over time
Browse files Browse the repository at this point in the history
  • Loading branch information
josh-berry committed Jul 14, 2024
1 parent 5796b05 commit ebf6855
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions issues-top-10.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/bash

gen() {
echo '<!DOCTYPE html><html><body><table>'

gh issue list -R josh-berry/tab-stash -L 1000 \
--json url,title,reactionGroups,createdAt \
|jq -r '
map(
.reactionGroups |= map(select(.content=="THUMBS_UP"))[0]
|{
url: .url,
title: .title,
age: ((now - (.createdAt|fromdate)) / (24*60*60)),
votes: ((.reactionGroups?.users?.totalCount // 0) + 1)
}
|select(.votes >= 3)
|(.voteVelocity = .votes / .age)
)
|sort_by(-.voteVelocity)
|.[]
|"<tr><td>\(.votes)v/\(.age|floor)d</td><td><a href=\"\(.url)\">\(.title)</a></td></tr>"
' |head -n 10
echo '</table></body></html>'
}

open -a firefox "data:text/html;base64,$(gen|base64)"

0 comments on commit ebf6855

Please sign in to comment.