Skip to content

[plan] Add fork detection and warning to gh aw init #18518

@github-actions

Description

@github-actions

Context

Closes part of #18481 — gh-aw in forks.

When users run gh aw init inside a forked repository, they receive the same instructions as a fresh install. There is no indication that they need to configure their own copies of all secrets (API keys, tokens), and no warning about features that are restricted in fork contexts.

Objective

Detect when gh aw init (and optionally gh aw compile) is run inside a forked repository and emit a clear warning listing which secrets need to be configured and which features have restrictions.

Approach

  1. In pkg/cli/init_command.go (or equivalent), after determining the current repo context, add a call like gh repo view --json isFork to detect fork status.
  2. If the repo is a fork, print a console.FormatWarningMessage(...) block that:
    • States the repo is a fork
    • Lists secrets that must be configured: ANTHROPIC_API_KEY / OPENAI_API_KEY, GH_AW_GITHUB_TOKEN, GH_AW_COPILOT_TOKEN, GH_AW_GITHUB_MCP_SERVER_TOKEN
    • Notes which features are limited (e.g., workflow_run cross-fork triggers are blocked by design)
  3. Optionally apply the same detection in pkg/cli/compile_command.go with a lighter warning.
  4. Add unit tests for the fork-detection helper.

Files to Modify

  • pkg/cli/init_command.go — add fork detection + warning
  • pkg/cli/compile_command.go — optional lighter warning
  • pkg/cli/init_command_test.go — test fork detection path

Acceptance Criteria

  • gh aw init detects fork status via gh repo view --json isFork
  • A clear, actionable warning is printed listing required secrets and feature restrictions
  • Warning is formatted using console.FormatWarningMessage
  • Non-fork repos are unaffected
  • Tests cover fork and non-fork paths
    Related to Using gh-aw in forks of repositories #18481

Generated by Plan Command for issue #18481

  • expires on Feb 28, 2026, 4:18 PM UTC

Metadata

Metadata

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions