Skip to content

workflow: add mention + issue-to-pr handlers; harden review prompt#49

Merged
heskew merged 1 commit intomainfrom
workflow/evolution-mentions-and-issue-to-pr
Apr 21, 2026
Merged

workflow: add mention + issue-to-pr handlers; harden review prompt#49
heskew merged 1 commit intomainfrom
workflow/evolution-mentions-and-issue-to-pr

Conversation

@heskew
Copy link
Copy Markdown
Member

@heskew heskew commented Apr 21, 2026

Summary

Extends the AI automation surface on /oauth beyond baseline review.

1. claude-mention.yml (new)

Triggers on @claude in PR comments or inline review comments. Runs the action in agent mode — the user's comment is the prompt; Claude can edit, commit, and push. Gated to HarperFast org members/collaborators via author_association on the comment.

Sets up Node 22 + Bun latest so Claude can actually run npm test and bun test per the prompt instructions.

2. claude-issue-to-pr.yml (new)

Triggers on issues: [labeled] when the label name starts with claude-fix:. Four suffixes scope the latitude:

Label Scope
claude-fix:typo single-file typo / tiny doc fix
claude-fix:docs documentation update
claude-fix:deps dependency version bump
claude-fix:bug focused bug fix with a regression test

Prompt explicitly lists out-of-scope work (new API, architecture changes) and instructs Claude to comment on the issue instead of opening a speculative PR when the ask exceeds scope.

Gated on issue author_association — only issues opened by org members/collaborators will have label-adds trigger Claude. Keeps the trigger surface tight during calibration.

3. claude-review.yml (tightened)

Two changes in the existing review workflow:

  • Prompt: forbid filesystem writes. PR fix: withOAuthValidation reads request from getContext() (closes #33) #48's round-5 review burned ~2/25 turns on Write denial retries (Claude kept trying to save review drafts to .claude-pr/pr48_review.md). The Write/Edit tools are already excluded from the allowlist — the prompt now explicitly tells Claude not to try.
  • Repo-name interpolation. The log-title, body, and repo:<name> label now use ${{ github.event.repository.name }} instead of hardcoded oauth. Copying this workflow to /harper, /harper-pro, /nextjs now requires zero source edits in the log step.

Prereqs for issue-to-pr

  • Labels claude-fix:typo, claude-fix:docs, claude-fix:deps, claude-fix:bug must exist on the repo. Create with:
    gh label create "claude-fix:typo" --repo HarperFast/oauth --color "0E8A16" --description "Small typo / one-line doc fix"
    gh label create "claude-fix:docs" --repo HarperFast/oauth --color "0E8A16" --description "Documentation update"
    gh label create "claude-fix:deps" --repo HarperFast/oauth --color "0E8A16" --description "Dependency version bump"
    gh label create "claude-fix:bug"  --repo HarperFast/oauth --color "0E8A16" --description "Focused bug fix with regression test"
  • ANTHROPIC_API_KEY and AI_REVIEW_LOG_TOKEN secrets already on the repo (from prior workflow PRs).

Future

When we expand to a second repo, factor all three workflows into reusable workflows (central repo + tiny per-repo wrappers) for real DRY.

Test plan

  • Prettier clean on all three files
  • Merge
  • Follow-up smoke test: open a test issue labeled claude-fix:typo for a known trivial typo
  • Follow-up smoke test: @claude a PR with a small ask

Three related changes that extend the AI automation surface on
HarperFast/oauth beyond the baseline review.

1. .github/workflows/claude-mention.yml (new).

   Triggers on `issue_comment` and `pull_request_review_comment`
   containing `@claude`. Runs Claude in agent mode: read the
   comment, do the work, commit, push to the PR branch (or open a
   new branch for issue-originated asks). Gated to HarperFast org
   OWNER / MEMBER / COLLABORATOR via author_association on the
   comment. Concurrency queued (not cancelled) per PR/issue —
   explicit asks deserve to complete.

   Permissions: contents/pull-requests/issues write. Allowlist
   covers the five gh helpers, git, npm, bun, and the filesystem
   Read/Write/Edit/Grep/Glob tools.

   Node 22 + Bun latest set up before the action so Claude can
   actually run `npm test` / `bun test` as instructed in the
   prompt (no conditional "if Bun is installed" branch — it always
   is).

2. .github/workflows/claude-issue-to-pr.yml (new).

   Triggers on `issues: [labeled]` when the label name matches
   `claude-fix:*`. Narrow scope per suffix (typo / docs / deps /
   bug). Same env setup + gate as the mention workflow but trusts
   the label (not a comment body) for the ask.

   Prompt explicitly enumerates the label-scoped latitude and
   lists out-of-scope work that should be rejected with a comment
   on the issue rather than a speculative PR.

3. .github/workflows/claude-review.yml (update).

   - Tightened the review-prompt Tools section: do NOT write files
     (to `.claude-pr/`, `/tmp`, or anywhere). A run on PR #48
     burned ~2/25 turns on Write-denial retries because Claude
     tried to save review drafts to disk. Explicit prohibition in
     the prompt stops the retries.
   - Interpolated the short repo name via
     `${{ github.event.repository.name }}` into the log title,
     body, and `repo:<name>` label. Removes the three hardcoded
     `oauth` strings so the workflow can be copied to /harper,
     /harper-pro, /nextjs with zero source edits.

A future follow-up could factor all three into reusable workflows
(central repo → tiny wrappers) once we have 2+ consumer repos.

Prereq for issue-to-pr: create the `claude-fix:typo`, `:docs`,
`:deps`, `:bug` labels on the reviewed repo. Not automated here
(would require cross-repo label sync).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@heskew heskew requested a review from a team as a code owner April 21, 2026 17:33
@heskew heskew merged commit 69cc3a5 into main Apr 21, 2026
4 of 5 checks passed
@heskew heskew deleted the workflow/evolution-mentions-and-issue-to-pr branch April 21, 2026 19:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant