Skip to content

Commit

Permalink
feat: show issue and pr labels on gh dashboard (#1818)
Browse files Browse the repository at this point in the history
Also fix for users who run coreutils on mac 😬 

Fixes #1815
  • Loading branch information
gak authored Jun 18, 2024
1 parent a279746 commit 3b02b11
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions scripts/update-workflow-issue
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
#!/bin/bash

map_to_markdown() {
echo 'map("- #\(.number) \(.labels | map("https://github.com/TBD54566975/ftl/labels/\(.name | gsub(" ";"%20"))") | join(" "))")[]'
}

list_issues() {
gh issue list "$@" --json number --jq 'map("- #\(.number)")[]' | sort -n
gh issue list "$@" --json number,labels --jq "$(map_to_markdown)" | sort -n
}

list_prs() {
gh pr list "$@" --json number --jq 'map("- #\(.number)")[]' | sort -n
gh pr list "$@" --json number,labels --jq "$(map_to_markdown)" | sort -n
}

list_issues_and_prs() {
user="$1"
shift
(gh pr list -A "$user" "$@" --json number,mergedAt | jq '[.[] | .["closedAt"] = .mergedAt | del(.mergedAt)]'; gh issue list -a "$user" "$@" --json number,closedAt) | jq '.[]' | jq -rs 'sort_by(.closedAt) | reverse | map("- #\(.number)")[]'
(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)"
}

update() {
Expand Down Expand Up @@ -40,7 +44,7 @@ $(
$(
if [ "$(uname -o)" = "GNU/Linux" ]; then
if [ "$(uname -o)" = "GNU/Linux" ] || date --help | grep -q "GNU"; then
date="$(date -d "- 5 days" +%Y-%m-%d)"
else
date="$(date -v "-5d" +%Y-%m-%d)"
Expand Down

0 comments on commit 3b02b11

Please sign in to comment.