diff --git a/scripts/update-workflow-issue b/scripts/update-workflow-issue index 7b5b2983e5..77bbb786d5 100755 --- a/scripts/update-workflow-issue +++ b/scripts/update-workflow-issue @@ -18,6 +18,16 @@ 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)" } +list_prioritized_issues() { + gh issue list "$@" --json number,labels | jq '.[]' | 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 + )' | jq -r "$(map_to_markdown)" +} +g update() { if test -z "$NOOP"; then gh issue edit -F - 728 @@ -71,7 +81,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."