githubpr

package
v0.4.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 27, 2026 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Overview

Package githubpr implements the "github-pr" built-in hook. On ticket.completed it opens a pull request via the gh CLI, using the ticket name as the PR title, BASE_REF as the target branch, and a body constructed from PHASE_NAMES. When entry.Draft is true the PR is created as a draft.

A pre-flight check verifies that gh is on PATH; if it is absent the hook returns a descriptive error that Registry.Fire logs as a warning, and the lifecycle event continues unaffected.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildArgs

func BuildArgs(title, body, baseRef string, draft bool) []string

BuildArgs assembles the argument slice for `gh pr create`.

func BuildBody

func BuildBody(env map[string]string) string

BuildBody constructs the pull-request body from the event environment variables. PLAN_SLUG provides plan context and PHASE_NAMES (newline- separated) is rendered as a markdown bullet list.

func DefaultRunner

func DefaultRunner(ctx context.Context, workDir string, name string, args ...string) error

DefaultRunner is the production Runner that execs the command with cmd.Dir set to workDir so that gh can discover the repo's GitHub remote. On failure the combined stdout+stderr output is captured (truncated via hooksreg.TruncateOutput) and included in the returned error so the actual gh error message is visible instead of a bare "exit status 1".

func New

func New(runner Runner, entry settings.HookEntry) hooksreg.Hook

New returns a hooksreg.Hook that opens a GitHub pull request via the gh CLI when Run is called. runner is called to execute gh; entry provides the per-hook settings (draft flag, etc.).

Types

type Runner

type Runner func(ctx context.Context, workDir string, name string, args ...string) error

Runner executes a command in workDir. Injectable for testing.

Source Files

  • githubpr.go

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL