Skip to content

Switch org-wide workflow to Claude CLI and fix issue.opened trigger#10

Merged
ondrejmirtes merged 3 commits into
mainfrom
claude/issue-9-20260219-0720
Feb 19, 2026
Merged

Switch org-wide workflow to Claude CLI and fix issue.opened trigger#10
ondrejmirtes merged 3 commits into
mainfrom
claude/issue-9-20260219-0720

Conversation

@ondrejmirtes

Copy link
Copy Markdown
Member
  • Replace anthropics/claude-code-action with direct Claude CLI usage in the org-wide workflow
  • Fix issue.opened event handling by adding github.event.issue.body to the fallback chain

Closes #9

Generated with Claude Code

- Replace `anthropics/claude-code-action` with direct Claude CLI usage
  (`npm install -g @anthropic-ai/claude-code`) in the org-wide workflow.
  The CLI is invoked with `claude -p` passing a prompt that includes the
  repository name and the issue comment body.
- Add `github.event.issue.body` to the COMMENT_BODY fallback chain in the
  react-on-comment workflow so that `issues.opened` events are handled
  correctly (the issue body is in a different field than comment/review body).

Closes #9

Co-authored-by: Ondřej Mirtes <ondrejmirtes@users.noreply.github.com>
Comment thread .github/workflows/claude-org-wide.yml Outdated

@ondrejmirtes ondrejmirtes left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@phpstan-bot Extract a meaningful prompt from this file and apply it to our org-wide workflow: https://github.com/anthropics/claude-code-action/blob/0cf5eeec4f908121edd03a81411b55485994f8d3/src/create-prompt/index.ts#L111

We're making changes based on issue comment to another repository in PHPStan organization.

@phpstan-bot

phpstan-bot commented Feb 19, 2026

Copy link
Copy Markdown
Contributor

Claude finished @ondrejmirtes's task in 5m 18s —— View job


Extracted prompt from claude-code-action and applied to org-wide workflow

  • Fetch and analyze the referenced file from claude-code-action
  • Extract meaningful prompt and apply to org-wide workflow
  • Commit and push changes

Analyzed the prompt template from anthropics/claude-code-action/src/create-prompt/index.ts and extracted the key principles relevant to our CLI-based workflow. The original prompt is designed for the GitHub Action with MCP tools, so I adapted it for claude -p usage.

Changes made

Trigger phrase stripping — The @phpstan-bot prefix is now stripped from the comment body before passing it to Claude, so it only receives the actual request (mirrors extractUserRequestFromContext from claude-code-action).

Structured prompt with key principles from claude-code-action:

  1. CLAUDE.md awareness — Claude now checks for and follows repo-specific CLAUDE.md instructions before making changes
  2. Read-before-modify discipline — Explicit instruction to read relevant code before modifying it
  3. Minimal, focused changes — No over-engineering, no unnecessary features/refactoring/documentation beyond what was asked
  4. Security awareness — Don't introduce vulnerabilities, never commit secrets, never force push
  5. Proper PR workflow — Descriptive commit messages explaining "why", structured PR creation with clear title and body

Extract meaningful prompt structure from anthropics/claude-code-action's
prompt template and apply it to the org-wide workflow:

- Strip trigger phrase from comment body before passing to Claude
- Add CLAUDE.md awareness (check and follow repo-specific instructions)
- Add read-before-modify discipline
- Add minimal/focused change guidelines (no over-engineering)
- Add security awareness (no secrets, no force push)
- Add structured PR creation instructions with descriptive messages

Co-authored-by: Ondřej Mirtes <ondrejmirtes@users.noreply.github.com>
@ondrejmirtes ondrejmirtes merged commit cc9e53c into main Feb 19, 2026
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.

Switch to Claude CLI

2 participants