mirror of
https://github.com/tinyhumansai/openhuman.git
synced 2026-07-27 20:46:24 +00:00
fix(workflow): auto-assign issues and prs (#2271)
This commit is contained in:
@@ -11,6 +11,10 @@ Usage: pnpm deep-work <command> [args...]
|
|||||||
|
|
||||||
Full workflow automation for GitHub issues using worktrees and AI agents.
|
Full workflow automation for GitHub issues using worktrees and AI agents.
|
||||||
|
|
||||||
|
By default `start` auto-assigns the issue to `@me`, and PR creation steps
|
||||||
|
auto-assign the created PR to `@me`.
|
||||||
|
Set `DEEP_WORK_AUTO_ASSIGN=0` (or `WORK_AUTO_ASSIGN=0`) to opt out.
|
||||||
|
|
||||||
Commands:
|
Commands:
|
||||||
start <issue-number> Start full workflow for an issue
|
start <issue-number> Start full workflow for an issue
|
||||||
pick Smart issue selection + start workflow
|
pick Smart issue selection + start workflow
|
||||||
@@ -64,4 +68,4 @@ case "$cmd" in
|
|||||||
usage >&2
|
usage >&2
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ here="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|||||||
source "$here/lib.sh"
|
source "$here/lib.sh"
|
||||||
|
|
||||||
issue="${1:-}"
|
issue="${1:-}"
|
||||||
|
auto_assign="${DEEP_WORK_AUTO_ASSIGN:-${WORK_AUTO_ASSIGN:-1}}"
|
||||||
|
|
||||||
# If no issue provided, try to detect from current directory
|
# If no issue provided, try to detect from current directory
|
||||||
if [ -z "$issue" ]; then
|
if [ -z "$issue" ]; then
|
||||||
@@ -208,6 +209,11 @@ ${body}
|
|||||||
--base main \
|
--base main \
|
||||||
--repo "$repo")
|
--repo "$repo")
|
||||||
|
|
||||||
|
pr_number="${pr_url##*/}"
|
||||||
|
if [ "$auto_assign" = "1" ]; then
|
||||||
|
gh_assign_self_pr "$pr_number" "$repo"
|
||||||
|
fi
|
||||||
|
|
||||||
echo "[deep-work] 📝 PR created: $pr_url"
|
echo "[deep-work] 📝 PR created: $pr_url"
|
||||||
else
|
else
|
||||||
echo "[deep-work] ✅ PR already exists"
|
echo "[deep-work] ✅ PR already exists"
|
||||||
@@ -288,4 +294,8 @@ fi
|
|||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
echo "[deep-work] 🎯 Continue session complete!"
|
echo "[deep-work] 🎯 Continue session complete!"
|
||||||
echo "[deep-work] Use 'pnpm deep-work continue $issue' to resume anytime."
|
if worktree_exists "$issue"; then
|
||||||
|
echo "[deep-work] Use 'pnpm deep-work continue $issue' to resume anytime."
|
||||||
|
else
|
||||||
|
echo "[deep-work] Worktree was cleaned up. Use 'pnpm deep-work start $issue' to begin again."
|
||||||
|
fi
|
||||||
|
|||||||
@@ -6,8 +6,8 @@ set -euo pipefail
|
|||||||
# Source the existing review lib for repo resolution
|
# Source the existing review lib for repo resolution
|
||||||
here="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
here="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
repo_root="$(cd "$here/../.." && pwd)"
|
repo_root="$(cd "$here/../.." && pwd)"
|
||||||
# shellcheck source=../review/lib.sh
|
# shellcheck source=../shortcuts/review/lib.sh
|
||||||
source "$repo_root/scripts/review/lib.sh"
|
source "$repo_root/scripts/shortcuts/review/lib.sh"
|
||||||
|
|
||||||
# Worktree utilities
|
# Worktree utilities
|
||||||
worktree_dir_for_issue() {
|
worktree_dir_for_issue() {
|
||||||
@@ -205,4 +205,4 @@ run_quality_checks() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
echo "[deep-work] ✅ all quality checks passed"
|
echo "[deep-work] ✅ all quality checks passed"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ issue="$1"
|
|||||||
shift
|
shift
|
||||||
|
|
||||||
repo=$(resolve_deep_work_repo)
|
repo=$(resolve_deep_work_repo)
|
||||||
|
auto_assign="${DEEP_WORK_AUTO_ASSIGN:-${WORK_AUTO_ASSIGN:-1}}"
|
||||||
|
|
||||||
echo "[deep-work] 🚀 Starting full workflow for issue #$issue from $repo"
|
echo "[deep-work] 🚀 Starting full workflow for issue #$issue from $repo"
|
||||||
|
|
||||||
@@ -57,6 +58,10 @@ echo "[deep-work] fetching issue #$issue from $repo..."
|
|||||||
issue_json=$(gh issue view "$issue" -R "$repo" \
|
issue_json=$(gh issue view "$issue" -R "$repo" \
|
||||||
--json number,title,body,labels,state,url,assignees)
|
--json number,title,body,labels,state,url,assignees)
|
||||||
|
|
||||||
|
if [ "$auto_assign" = "1" ]; then
|
||||||
|
gh_assign_self_issue "$issue" "$repo"
|
||||||
|
fi
|
||||||
|
|
||||||
state=$(jq -r '.state' <<<"$issue_json")
|
state=$(jq -r '.state' <<<"$issue_json")
|
||||||
if [ "$state" != "OPEN" ]; then
|
if [ "$state" != "OPEN" ]; then
|
||||||
echo "[deep-work] ⚠️ issue #$issue is $state — continuing anyway" >&2
|
echo "[deep-work] ⚠️ issue #$issue is $state — continuing anyway" >&2
|
||||||
@@ -304,6 +309,11 @@ pr_url=$(gh pr create \
|
|||||||
--base main \
|
--base main \
|
||||||
--repo "$repo")
|
--repo "$repo")
|
||||||
|
|
||||||
|
pr_number="${pr_url##*/}"
|
||||||
|
if [ "$auto_assign" = "1" ]; then
|
||||||
|
gh_assign_self_pr "$pr_number" "$repo"
|
||||||
|
fi
|
||||||
|
|
||||||
echo "[deep-work] 📝 draft PR created: $pr_url"
|
echo "[deep-work] 📝 draft PR created: $pr_url"
|
||||||
|
|
||||||
# Step 10: Review cycle
|
# Step 10: Review cycle
|
||||||
@@ -376,4 +386,4 @@ echo ""
|
|||||||
echo "Next steps:"
|
echo "Next steps:"
|
||||||
echo "- Monitor PR for reviewer feedback"
|
echo "- Monitor PR for reviewer feedback"
|
||||||
echo "- Address any review comments"
|
echo "- Address any review comments"
|
||||||
echo "- Merge when approved"
|
echo "- Merge when approved"
|
||||||
|
|||||||
@@ -28,6 +28,26 @@ require() {
|
|||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gh_assign_self_issue() {
|
||||||
|
local issue="$1"
|
||||||
|
local repo="$2"
|
||||||
|
if gh issue edit "$issue" -R "$repo" --add-assignee "@me" >/dev/null 2>&1; then
|
||||||
|
info "assigned issue #$issue to @me"
|
||||||
|
else
|
||||||
|
warn "could not assign issue #$issue to @me; continuing"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
gh_assign_self_pr() {
|
||||||
|
local pr="$1"
|
||||||
|
local repo="$2"
|
||||||
|
if gh pr edit "$pr" -R "$repo" --add-assignee "@me" >/dev/null 2>&1; then
|
||||||
|
info "assigned PR #$pr to @me"
|
||||||
|
else
|
||||||
|
warn "could not assign PR #$pr to @me; continuing"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
# Summarize free-form text via a local LLM CLI (expects `-p <prompt>`).
|
# Summarize free-form text via a local LLM CLI (expects `-p <prompt>`).
|
||||||
# Usage: summarize_text <tool> <input>
|
# Usage: summarize_text <tool> <input>
|
||||||
# Tools used here: gemini (default for summaries), claude, or any CLI that
|
# Tools used here: gemini (default for summaries), claude, or any CLI that
|
||||||
|
|||||||
@@ -35,8 +35,13 @@ and `pnpm work start 1234 …` are equivalent.
|
|||||||
`--agent cursor` or `--agent cursor-agent`, it uses
|
`--agent cursor` or `--agent cursor-agent`, it uses
|
||||||
`cursor-agent --yolo`.
|
`cursor-agent --yolo`.
|
||||||
|
|
||||||
|
By default the script also tries to assign the issue to `@me` through GitHub
|
||||||
|
as soon as work starts.
|
||||||
|
|
||||||
## Config
|
## Config
|
||||||
|
|
||||||
- `WORK_REPO=owner/name` — override the target repo.
|
- `WORK_REPO=owner/name` — override the target repo.
|
||||||
- `WORK_BRANCH_PREFIX=issue` — branch is `<prefix>/<num>-<slug>`.
|
- `WORK_BRANCH_PREFIX=issue` — branch is `<prefix>/<num>-<slug>`.
|
||||||
|
- `WORK_AUTO_ASSIGN=1` — auto-assign the issue to `@me` when work starts. Set
|
||||||
|
to `0` to disable.
|
||||||
- Requires `git`, `gh`, `jq`, plus the agent CLI (default `claude`).
|
- Requires `git`, `gh`, `jq`, plus the agent CLI (default `claude`).
|
||||||
|
|||||||
@@ -37,6 +37,8 @@ Env:
|
|||||||
scripts/shortcuts/review.
|
scripts/shortcuts/review.
|
||||||
WORK_BRANCH_PREFIX=issue Branch name is <prefix>/<num>-<slug> (default:
|
WORK_BRANCH_PREFIX=issue Branch name is <prefix>/<num>-<slug> (default:
|
||||||
issue).
|
issue).
|
||||||
|
WORK_AUTO_ASSIGN=1 Auto-assign the issue to `@me` when work
|
||||||
|
starts. Set to `0` to disable.
|
||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -61,11 +61,16 @@ if [ -z "$repo" ]; then
|
|||||||
repo=$(REVIEW_REPO= resolve_repo)
|
repo=$(REVIEW_REPO= resolve_repo)
|
||||||
fi
|
fi
|
||||||
branch_prefix="${WORK_BRANCH_PREFIX:-issue}"
|
branch_prefix="${WORK_BRANCH_PREFIX:-issue}"
|
||||||
|
auto_assign="${WORK_AUTO_ASSIGN:-1}"
|
||||||
|
|
||||||
echo "[work] fetching issue #$issue from $repo..."
|
echo "[work] fetching issue #$issue from $repo..."
|
||||||
issue_json=$(gh issue view "$issue" -R "$repo" \
|
issue_json=$(gh issue view "$issue" -R "$repo" \
|
||||||
--json number,title,body,labels,state,url,assignees)
|
--json number,title,body,labels,state,url,assignees)
|
||||||
|
|
||||||
|
if [ "$auto_assign" = "1" ]; then
|
||||||
|
gh_assign_self_issue "$issue" "$repo"
|
||||||
|
fi
|
||||||
|
|
||||||
state=$(jq -r '.state' <<<"$issue_json")
|
state=$(jq -r '.state' <<<"$issue_json")
|
||||||
if [ "$state" != "OPEN" ]; then
|
if [ "$state" != "OPEN" ]; then
|
||||||
echo "[work] ! issue #$issue is $state — continuing anyway" >&2
|
echo "[work] ! issue #$issue is $state — continuing anyway" >&2
|
||||||
|
|||||||
Reference in New Issue
Block a user