Skip to content

Commit

Permalink
chore: show next in order of priority in Dashboard
Browse files Browse the repository at this point in the history
fixes #1922
  • Loading branch information
worstell committed Jul 31, 2024
1 parent afed75b commit 7551855
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion scripts/update-workflow-issue
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,29 @@ list_issues_and_prs() {
(gh pr list -A "$user" "$@" --json number,labels,mergedAt | jq '[.[] | .["closedAt"] = .mergedAt | del(.mergedAt)]'; gh issue list -a "$user" "$@" --json number,labels,closedAt) | jq '.[]' | jq -rs 'sort_by(.closedAt) | reverse' | jq -r "$(map_to_markdown)"
}

##debugging##
list_prioritized_issues() {
issues_json=$(gh issue list "$@" --json number,labels)

echo "Raw issues JSON:"
echo "$issues_json"

sorted_issues=$(echo "$issues_json" | jq -s '
sort_by(
(.labels | map(select(.name == "P0")) | length) as $p0 |
(.labels | map(select(.name == "P1")) | length) as $p1 |
(.labels | map(select(.name == "P2")) | length) as $p2 |
(.labels | map(select(.name == "P3")) | length) as $p3 |
($p0, $p1, $p2, $p3) | map(select(. == 1)) | length
)')

echo "Sorted issues JSON:"
echo "$sorted_issues"

echo "Sorted issues mapped:"
echo "$sorted_issues" | jq -r "$(map_to_markdown)"
}

update() {
if test -z "$NOOP"; then
gh issue edit -F - 728
Expand Down Expand Up @@ -71,7 +94,7 @@ $(
### https://github.com/TBD54566975/ftl/labels/next
$(
issues="$(list_issues --label next)"
issues="$(list_prioritized_issues --label next)"
if test -z "$issues"; then
echo "> [!WARNING]"
echo "> There are no issues labelled for upcoming work."
Expand Down

0 comments on commit 7551855

Please sign in to comment.