Skip to content

Commit

Permalink
chore: some ticket workflow automation (#921)
Browse files Browse the repository at this point in the history
The main change is that #728 is now automatically kept up to date with
assignments and labels.
  • Loading branch information
alecthomas authored Feb 11, 2024
1 parent f9fa7cb commit b4c4ce4
Show file tree
Hide file tree
Showing 6 changed files with 89 additions and 4 deletions.
15 changes: 15 additions & 0 deletions .github/workflows/workflow-assigned.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Remove workflow labels once an issue is assigned
on:
issues:
types:
- assigned
jobs:
label_issues:
runs-on: ubuntu-latest
permissions:
issues: write
steps:
- run: gh issue edit "$NUMBER" --remove-label triage --remove-label next
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NUMBER: ${{ github.event.issue.number }}
16 changes: 16 additions & 0 deletions .github/workflows/workflow-roadmap.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Update roadmap issue #728
on:
issues:
types:
- assigned
- labeled
workflow_dispatch:
jobs:
label_issues:
runs-on: ubuntu-latest
permissions:
issues: write
steps:
- run: update-workflow-issue
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,14 @@ on:
types:
- reopened
- opened
- unassigned
jobs:
label_issues:
runs-on: ubuntu-latest
permissions:
issues: write
steps:
- run: gh issue edit "$NUMBER" --add-label "$LABELS"
- run: gh issue edit "$NUMBER" --add-label triage
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_REPO: ${{ github.repository }}
NUMBER: ${{ github.event.issue.number }}
LABELS: triage
2 changes: 2 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ linters-settings:
desc: "use fmt.Errorf or errors.New"
- pkg: braces.dev/errtrace
desc: "use fmt.Errorf or errors.New"
- pkg: os/exec
desc: "use github.com/TBD54566975/ftl/backend/common/exec"
# wrapcheck:
# ignorePackageGlobs:
# - github.com/TBD54566975/ftl/*
Expand Down
2 changes: 1 addition & 1 deletion backend/common/exec/exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"context"
"fmt"
"os"
"os/exec"
"os/exec" //nolint:depguard
"syscall"

"github.com/kballard/go-shellquote"
Expand Down
53 changes: 53 additions & 0 deletions scripts/update-workflow-issue
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#!/bin/bash

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

gh issue edit -F - 728 <<EOF
<!-- This file is generated by scripts/update-workflow-issue. Do not edit manually. -->
$(
issues="$(list_issues --label urgent)"
test -z "$issues" && exit 0
echo "### Urgent [👀](https://github.com/TBD54566975/ftl/issues?q=is%3Aissue+is%3Aopen+label%3Aurgent)"
echo
echo "> [!WARNING]"
echo "> These issues are urgent and need immediate attention."
echo "$issues"
)
### Current assigned issues
$(
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 -a "$member"
echo
done
)
$(
issues="$(list_issues --label triage)"
test -z "$issues" && exit 0
echo "### Needs triage [👀](https://github.com/TBD54566975/ftl/issues?q=is%3Aissue+is%3Aopen+label%3Atriage)"
echo
echo "$issues"
)
### Next [👀](https://github.com/TBD54566975/ftl/issues?q=is%3Aissue+is%3Aopen+label%3Anext)
$(
issues="$(list_issues --label next)"
if test -z "$issues"; then
echo "> [!WARNING]"
echo "> There are no issues labelled for upcoming work."
exit 0
fi
echo "$issues"
)
EOF

0 comments on commit b4c4ce4

Please sign in to comment.