Tutorial: Automate Pull Request Generation With Claude Code

Turn any backlog ticket into a merge-ready PR without a human touching the keyboard past the review step. This is the pattern Alher Tech uses to keep 30+ client repos current.

Updated: April 24, 2026

Pipeline overview

GitHub Action triggers on a label (`ai-fix-me`). Runs a headless Claude Code session with the ticket body as the prompt. Agent creates a branch, implements, tests, commits and opens a PR. Status check posts back to the ticket.

Guardrails

PreToolUse hook blocks writes outside the repo root. PostToolUse hook runs lint and tests; a red result aborts the session. Stop hook blocks the agent from claiming done if tests fail.

Scaling to multiple repos

Centralize the prompt and hooks in a shared repo. Each client repo includes a thin GitHub Action that calls the shared workflow. Update once, all 30 repos benefit.

Frequently asked questions

How much does this cost per PR?

Between $0.80 and $6 in API credits depending on complexity. Simple bug fixes are at the low end; feature spikes at the high end.