Skip to content

Commit 2a62d2d

Browse files
committed
chore: update agent-process-issue.yml
1 parent 7b11dd5 commit 2a62d2d

1 file changed

Lines changed: 57 additions & 21 deletions

File tree

.github/workflows/agent-process-issue.yml

Lines changed: 57 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,31 @@ jobs:
6868
with:
6969
fetch-depth: 0
7070

71+
- name: Derive branch name from issue
72+
id: branch
73+
env:
74+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
75+
ISSUE: ${{ needs.validate.outputs.issue }}
76+
REPO: ${{ github.repository }}
77+
run: |
78+
set -euo pipefail
79+
title=$(gh issue view "$ISSUE" --repo "$REPO" --json title --jq '.title')
80+
slug=$(echo "$title" \
81+
| sed -E 's/^(feat|fix|chore|docs|test|refactor|ci|style|perf|build|revert): *//' \
82+
| tr '[:upper:]' '[:lower:]' \
83+
| tr -cs 'a-z0-9' '-' \
84+
| sed 's/^-//;s/-$//' \
85+
| cut -c1-50)
86+
branch="agent/${ISSUE}-${slug}"
87+
echo "branch=$branch" >> "$GITHUB_OUTPUT"
88+
echo "title=$title" >> "$GITHUB_OUTPUT"
89+
90+
if echo "$title" | grep -qE '^(feat|fix|chore|docs|test|refactor|ci|style|perf|build|revert):'; then
91+
echo "pr_title=$title" >> "$GITHUB_OUTPUT"
92+
else
93+
echo "pr_title=feat: $title" >> "$GITHUB_OUTPUT"
94+
fi
95+
7196
- name: Process issue with OpenCode
7297
uses: anomalyco/opencode/github@latest
7398
env:
@@ -80,29 +105,40 @@ jobs:
80105
prompt: |
81106
You are an autonomous agent processing issue #${{ needs.validate.outputs.issue }} on ${{ github.repository }}.
82107
83-
Step 1 — Read the issue:
108+
BRANCH NAME (use exactly): ${{ steps.branch.outputs.branch }}
109+
PR TITLE (use exactly): ${{ steps.branch.outputs.pr_title }}
110+
111+
Step 1 — Read the issue (body AND all comments):
84112
gh issue view ${{ needs.validate.outputs.issue }} -R ${{ github.repository }} --json title,body,comments
85113
86-
Step 2 — Implement the task following the issue's instructions exactly.
87-
88-
Step 3 — Verify your work passes all checks listed in the issue.
89-
90-
Step 4 — YOU MUST create the PR yourself. This is non-negotiable.
91-
Run this command:
92-
gh pr create \
93-
--title "<type>: <description>" \
94-
--body "Closes #${{ needs.validate.outputs.issue }}" \
95-
--label "agent-work,risk:low,ready-to-merge" \
96-
--head "<your-branch-name>"
97-
98-
Rules:
99-
- Follow "## Task" and "## Acceptance criteria" sections exactly.
100-
- Do not expand scope beyond what the issue asks.
101-
- PR title must use conventional format (feat/fix/chore/docs/test/refactor: description).
102-
- PR body MUST contain "Closes #${{ needs.validate.outputs.issue }}".
103-
- Do NOT self-merge. Do NOT assume infrastructure creates the PR for you.
104-
- If you need human input, comment on the issue with a
105-
"## Needs Human Input" section, add the needs-human label, and stop.
114+
If a "## Human Response" comment exists, continue from where
115+
the previous agent left off using that response.
116+
117+
Step 2 — Create your branch:
118+
git checkout -b ${{ steps.branch.outputs.branch }}
119+
120+
Step 3 — Implement the task. Follow "## Task" and "## Acceptance
121+
criteria" sections exactly. Do NOT expand scope.
122+
123+
Step 4 — Commit and push:
124+
git add -A
125+
git commit -m "${{ steps.branch.outputs.pr_title }} (#${{ needs.validate.outputs.issue }})"
126+
git push -u origin ${{ steps.branch.outputs.branch }}
127+
128+
Step 5 — Create the PR. This is non-negotiable. Run exactly:
129+
gh pr create \
130+
--title "${{ steps.branch.outputs.pr_title }}" \
131+
--body "Closes #${{ needs.validate.outputs.issue }}" \
132+
--label "agent-work,risk:low,ready-to-merge" \
133+
--head "${{ steps.branch.outputs.branch }}"
134+
135+
Constraints:
136+
- Do NOT change the branch name, PR title, or labels above.
137+
- Do NOT self-merge.
138+
- Do NOT assume infrastructure creates the PR for you.
139+
- Do NOT modify .github/workflows/ or settings.json.
140+
- If stuck, comment "## Needs Human Input" on the issue,
141+
add the needs-human label, and stop.
106142
107143
- name: Verify PR was created
108144
id: verify-pr

0 commit comments

Comments
 (0)