Skip to content

Commit

Permalink
chore: make roadmap issues mini dashboards
Browse files Browse the repository at this point in the history
  • Loading branch information
worstell committed Aug 28, 2024
1 parent 2094725 commit 08572a8
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 35 deletions.
25 changes: 23 additions & 2 deletions .github/workflows/workflow-roadmap.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Update roadmap issue #728
name: Update roadmap issues
on:
issues:
types:
Expand Down Expand Up @@ -27,14 +27,35 @@ concurrency:
jobs:
update-workflow-issue:
runs-on: ubuntu-latest
strategy:
matrix:
label: ["jvm"] # add if desired: "codebase-health", "core", "infrastructure", "go", "security", "dx"
permissions:
issues: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 1
- uses: cashapp/activate-hermit@v1
- run: update-workflow-issue
- run: |
declare -A label_to_issue_map=(
["all"]=728
["codebase-health"]=2443
["core"]=2442
["infrastructure"]=2441
["go"]=2440
["jvm"]=2439
["security"]=2438
["dx"]=2436
)
issue_number=${label_to_issue_map["${{ matrix.label }}"]}
if [ -n "$issue_number" ]; then
update-workflow-issue "${{ matrix.label }}" "$issue_number"
else
echo "No associated issue found for label '${{ matrix.label }}'."
fi
env:
GH_TOKEN: ${{ secrets.FTL_WORKFLOW_TOKEN }}
GH_REPO: ${{ github.repository }}
66 changes: 33 additions & 33 deletions scripts/update-workflow-issue
Original file line number Diff line number Diff line change
@@ -1,25 +1,29 @@
#!/bin/bash

label="$1"
issue_number="$2"

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

list_issues() {
gh issue list "$@" --json number,labels --jq "$(map_to_markdown)" | sort -n
gh issue list "$@" --label "$label" --json number,labels | jq "$(map_to_markdown)" | sort -n
}

list_prs() {
gh pr list "$@" --json number,labels --jq "$(map_to_markdown)" | sort -n
}
list_issues_excluding() {
local exclude_labels=("$@")
local jq_filter=''

for label in "${exclude_labels[@]}"; do
jq_filter+=" | select(all(.labels[].name != \"$label\"))"
done

list_issues_and_prs() {
user="$1"
shift
(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)"
gh issue list --label "$label" --json number,labels | jq -r ".[]$jq_filter | $(map_to_markdown)" | sort -n
}

list_prioritized_issues() {
gh issue list "$@" --json number,labels | jq '.[]' | jq -s '
gh issue list "$@" --label "$label" --json number,labels | jq '.[]' | jq -s '
map(
. as $issue |
($issue.labels | map(select(.name == "P0")) | length > 0) as $p0 |
Expand All @@ -33,15 +37,8 @@ list_prioritized_issues() {
' | jq -r "$(map_to_markdown)"
}

update() {
if test -z "$NOOP"; then
gh issue edit -F - 728
else
cat
fi
}

update <<EOF
update_issue_template() {
update_issue <<EOF
<!-- This file is generated by scripts/update-workflow-issue. Do not edit manually. -->
$(
Expand All @@ -55,25 +52,17 @@ $(
echo "$issues"
)
### Active and recent issues
### All issues
$(
issues="$(list_issues_excluding next triage roadmap)"
test -z "$issues" && exit 0
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)"
fi
gh api -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" /orgs/TBD54566975/teams/ftl-team/members | jq -r '.[].login' | grep -v dhanji | sort | while read -r member; do
echo "@$member [🔎](https://github.com/TBD54566975/ftl/issues/assigned/$member)"
echo
list_issues_and_prs "$member"
list_issues_and_prs "$member" -s closed -S "closed:>$date"
echo
done
echo "$issues"
)
### https://github.com/TBD54566975/ftl/labels/triage
$(
issues="$(list_issues --label triage)"
test -z "$issues" && exit 0
Expand Down Expand Up @@ -103,4 +92,15 @@ $(
echo "$issues"
)
EOF
EOF
}

update_issue() {
if test -z "$NOOP"; then
gh issue edit -F - "$issue_number"
else
cat
fi
}

update_issue_template "$issue_number" "$label"

0 comments on commit 08572a8

Please sign in to comment.