Skip to content

Commit b4c4ce4

Browse files
authored
chore: some ticket workflow automation (#921)
The main change is that #728 is now automatically kept up to date with assignments and labels.
1 parent f9fa7cb commit b4c4ce4

File tree

6 files changed

+89
-4
lines changed

6 files changed

+89
-4
lines changed
+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: Remove workflow labels once an issue is assigned
2+
on:
3+
issues:
4+
types:
5+
- assigned
6+
jobs:
7+
label_issues:
8+
runs-on: ubuntu-latest
9+
permissions:
10+
issues: write
11+
steps:
12+
- run: gh issue edit "$NUMBER" --remove-label triage --remove-label next
13+
env:
14+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
15+
NUMBER: ${{ github.event.issue.number }}
+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: Update roadmap issue #728
2+
on:
3+
issues:
4+
types:
5+
- assigned
6+
- labeled
7+
workflow_dispatch:
8+
jobs:
9+
label_issues:
10+
runs-on: ubuntu-latest
11+
permissions:
12+
issues: write
13+
steps:
14+
- run: update-workflow-issue
15+
env:
16+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/triage.yml .github/workflows/workflow-triage.yml

+2-3
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,14 @@ on:
44
types:
55
- reopened
66
- opened
7+
- unassigned
78
jobs:
89
label_issues:
910
runs-on: ubuntu-latest
1011
permissions:
1112
issues: write
1213
steps:
13-
- run: gh issue edit "$NUMBER" --add-label "$LABELS"
14+
- run: gh issue edit "$NUMBER" --add-label triage
1415
env:
1516
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
16-
GH_REPO: ${{ github.repository }}
1717
NUMBER: ${{ github.event.issue.number }}
18-
LABELS: triage

.golangci.yml

+2
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,8 @@ linters-settings:
101101
desc: "use fmt.Errorf or errors.New"
102102
- pkg: braces.dev/errtrace
103103
desc: "use fmt.Errorf or errors.New"
104+
- pkg: os/exec
105+
desc: "use github.com/TBD54566975/ftl/backend/common/exec"
104106
# wrapcheck:
105107
# ignorePackageGlobs:
106108
# - github.com/TBD54566975/ftl/*

backend/common/exec/exec.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"context"
55
"fmt"
66
"os"
7-
"os/exec"
7+
"os/exec" //nolint:depguard
88
"syscall"
99

1010
"github.com/kballard/go-shellquote"

scripts/update-workflow-issue

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
#!/bin/bash
2+
3+
list_issues() {
4+
gh issue list "$@" --json number --jq 'map("- #\(.number)")[]' | sort -n
5+
}
6+
7+
gh issue edit -F - 728 <<EOF
8+
<!-- This file is generated by scripts/update-workflow-issue. Do not edit manually. -->
9+
10+
$(
11+
issues="$(list_issues --label urgent)"
12+
test -z "$issues" && exit 0
13+
14+
15+
echo "### Urgent [👀](https://github.com/TBD54566975/ftl/issues?q=is%3Aissue+is%3Aopen+label%3Aurgent)"
16+
echo
17+
echo "> [!WARNING]"
18+
echo "> These issues are urgent and need immediate attention."
19+
echo "$issues"
20+
)
21+
22+
### Current assigned issues
23+
24+
$(
25+
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
26+
echo "@$member [👀](https://github.com/TBD54566975/ftl/issues/assigned/$member)"
27+
echo
28+
list_issues -a "$member"
29+
echo
30+
done
31+
)
32+
33+
$(
34+
issues="$(list_issues --label triage)"
35+
test -z "$issues" && exit 0
36+
37+
echo "### Needs triage [👀](https://github.com/TBD54566975/ftl/issues?q=is%3Aissue+is%3Aopen+label%3Atriage)"
38+
echo
39+
echo "$issues"
40+
)
41+
42+
### Next [👀](https://github.com/TBD54566975/ftl/issues?q=is%3Aissue+is%3Aopen+label%3Anext)
43+
44+
$(
45+
issues="$(list_issues --label next)"
46+
if test -z "$issues"; then
47+
echo "> [!WARNING]"
48+
echo "> There are no issues labelled for upcoming work."
49+
exit 0
50+
fi
51+
echo "$issues"
52+
)
53+
EOF

0 commit comments

Comments
 (0)