diff --git a/.github/workflows/workflow-dashboard.yml b/.github/workflows/workflow-dashboard.yml new file mode 100644 index 0000000000..b943507e89 --- /dev/null +++ b/.github/workflows/workflow-dashboard.yml @@ -0,0 +1,40 @@ +name: Update Dashboard issue #728 +on: + issues: + types: + - assigned + - labeled + - closed + - deleted + pull_request: + types: + - opened + - closed + - reopened + workflow_dispatch: + # We need to separately trigger when one of the other workflows completes + # because GHA won't trigger another workflow based only on changes from + # another workflow, such as updating labels. + workflow_run: + workflows: + - Add triage label to new issues + - Clear workflow labels once an issue is assigned + - Clear triage label when moved to next + types: [completed] +concurrency: + group: ${{ github.ref }}-workflow-roadmap + cancel-in-progress: true +jobs: + update-workflow-issue: + runs-on: ubuntu-latest + permissions: + issues: write + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 1 + - uses: cashapp/activate-hermit@v1 + - run: update-dashboard-issue + env: + GH_TOKEN: ${{ secrets.FTL_WORKFLOW_TOKEN }} + GH_REPO: ${{ github.repository }} diff --git a/.github/workflows/workflow-roadmap.yml b/.github/workflows/workflow-roadmap.yml index f72106e425..c5862ad6df 100644 --- a/.github/workflows/workflow-roadmap.yml +++ b/.github/workflows/workflow-roadmap.yml @@ -1,4 +1,4 @@ -name: Update roadmap issue #728 +name: Update roadmap issues on: issues: types: @@ -27,6 +27,9 @@ 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: @@ -34,7 +37,24 @@ jobs: with: fetch-depth: 1 - uses: cashapp/activate-hermit@v1 - - run: update-workflow-issue + - run: | + declare -A label_to_issue_map=( + ["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-roadmap-issues "${{ 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 }} + GH_REPO: ${{ github.repository }} \ No newline at end of file diff --git a/scripts/update-workflow-issue b/scripts/update-dashboard-issue similarity index 100% rename from scripts/update-workflow-issue rename to scripts/update-dashboard-issue diff --git a/scripts/update-roadmap-issues b/scripts/update-roadmap-issues new file mode 100755 index 0000000000..ff1d6481eb --- /dev/null +++ b/scripts/update-roadmap-issues @@ -0,0 +1,102 @@ +#!/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 "$@" --label "$label" --json number,labels | jq -r "$(map_to_markdown)" | sort -n +} + +search_issues() { + gh search issues --label "$label" --state open --repo TBD54566975/ftl --json number,labels "$@" | jq -r "$(map_to_markdown)" | sort -n +} + +list_prioritized_issues() { + gh issue list "$@" --label "$label" --json number,labels | jq '.[]' | jq -s ' + map( + . as $issue | + ($issue.labels | map(select(.name == "P0")) | length > 0) as $p0 | + ($issue.labels | map(select(.name == "P1")) | length > 0) as $p1 | + ($issue.labels | map(select(.name == "P2")) | length > 0) as $p2 | + ($issue.labels | map(select(.name == "P3")) | length > 0) as $p3 | + $issue + {priority: (if $p0 then 0 elif $p1 then 1 elif $p2 then 2 elif $p3 then 3 else 4 end)} + ) | + sort_by(.priority) | + map(del(.priority)) + ' | jq -r "$(map_to_markdown)" +} + +update_issue_template() { + update_issue < + +$( + issues="$(list_issues --label P0)" + test -z "$issues" && exit 0 + + echo "### https://github.com/TBD54566975/ftl/labels/P0" + echo + echo "> [!WARNING]" + echo "> These issues are P0 and need immediate attention." + echo "$issues" +) + +$( + echo "### All Issues" + echo + issues="$(search_issues -- -label:next -label:triage -label:roadmap)" + if [ -n "$issues" ]; then + echo "$issues" + else + echo "> [!NOTE]" + echo "> There are no issues." + fi +) + +### https://github.com/TBD54566975/ftl/labels/triage + +$( + issues="$(list_issues --label triage)" + test -z "$issues" && exit 0 + + echo "### https://github.com/TBD54566975/ftl/labels/triage" + echo + echo "$issues" +) + +### https://github.com/TBD54566975/ftl/labels/next + +$( + issues="$(list_prioritized_issues --label next)" + if test -z "$issues"; then + echo "> [!WARNING]" + echo "> There are no issues labelled for upcoming work." + exit 0 + fi + echo "$issues" +) + +$( + issues="$(list_issues --label epic)" + test -z "$issues" && exit 0 + + echo "### https://github.com/TBD54566975/ftl/labels/epic" + echo "$issues" +) + +EOF +} + +update_issue() { + if test -z "$NOOP"; then + gh issue edit -F - "$issue_number" + else + cat + fi +} + +update_issue_template "$issue_number" "$label"