Skip to content

Cross-repo write credentials for the central planner (GitHub App) #818

Closed as not planned

Description

@don-petry

Story

As a org owner,
I want authenticate the central planner as a GitHub App (or org-scoped token) with issues/discussions/contents write across fleet repos,
so that the central planner can create epics, link sub-issues, and post the plan reply in the TARGET repo, which the default GITHUB_TOKEN (scoped only to .github-private) cannot do.

Acceptance Criteria

  1. A GitHub App (preferred) or org-scoped PAT is provisioned with issues + discussions + contents (+ pull-requests) write on enrolled fleet repos, and the installation/secret is documented.
  2. A token-minting step in the planner's plan job exposes a target-repo-scoped token (e.g. actions/create-github-app-token) that is DISTINCT from GH_PAT_WORKFLOWS (which keeps its workflow_dispatch role).
  3. Secret names and least-privilege scopes are documented (docs/initiatives/fleet-credentials.md or an extension of docs/pr-review-agent/machine-user-setup.md).
  4. The self path (.github-private planning its own discussions) still works with the new token.

Tasks / Subtasks

Dev Notes

  • Mirrors the existing machine-user pattern documented under docs/pr-review-agent/ (bot-setup.md, machine-user-setup.md).
  • GITHUB_TOKEN in a workflow is scoped to the workflow's own repo (.github-private); cross-repo issue/discussion writes therefore REQUIRE an App token or org PAT — this is the single hard prerequisite for the fleet path.
  • Keep GH_PAT_WORKFLOWS for the workflow_dispatch re-invoke (loop-prevention requires a PAT, not GITHUB_TOKEN — see scripts/initiative-planner/redispatch.sh:17-22); the new token is only for content/issue/discussion writes.
  • hands_off: provisioning an App and managing org secrets is an org-admin action, not auto-implementable.

Project Structure Notes

Primarily an infra + docs story; the only code change is the token-minting step in initiative-planner.yml. Sequenced as an independent prerequisite for the live pilot (S8).

References

  • docs/pr-review-agent/machine-user-setup.md
  • scripts/initiative-planner/redispatch.sh#L17-L22
  • .github/workflows/initiative-planner.yml#L97-L117

Likely target surface

  • .github/workflows/initiative-planner.yml
  • docs/initiatives/fleet-credentials.md (new file)

Story prepared by the BMAD Scrum Master (Bob) for epic #817. Status: ready-for-dev.

Activity

  1. added
    initiativeEpic / initiative tracking issue
    initiative:holdInitiative driver must not release this issue (human hold)
    dev-lead:hands-offExclude from dev-lead agent automation
    on Jun 20, 2026
  2. don-petry commented on Jun 20, 2026

    @don-petry
    CollaboratorAuthor

    Decision: use the existing GH_PAT_WORKFLOWS PAT for cross-repo writes — a dedicated least-privilege GitHub App is deferred (not needed now).

    Rationale:

    • The merged token seam (feat: implement issue #819 — Parameterize the central initiative-planner on a target repo #827, feat: implement issue #821 — Fleet stubs for idea-triage and idea-enhancer #829) already routes non-self target_repo writes through GH_PAT_WORKFLOWS:
      TARGET_GH_TOKEN: ${{ (target_repo == '' || target_repo == github.repository) && secrets.GITHUB_TOKEN || secrets.GH_PAT_WORKFLOWS }}
      so the fleet path is functional today with no further code change.
    • GH_PAT_WORKFLOWS is a classic PAT with repo scope, which grants cross-repo issues + Discussions (GraphQL) + contents write — sufficient for the planner/triage/enhancer to materialize epics and post replies in a target repo, provided its owner has write access to each enrolled repo (the one thing to confirm at enrollment).
    • The least-privilege App remains a future hardening if/when broader fleet rollout warrants it; this issue can be reopened then.

    End-to-end cross-repo write will be exercised by the S8 (#825) one-repo pilot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    dev-lead:hands-offExclude from dev-lead agent automationinitiativeEpic / initiative tracking issueinitiative:holdInitiative driver must not release this issue (human hold)

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions