Skip to content

[infra] Migrate smartwatermelon/ repos to a new GitHub org for org-level secret management #54

Description

@twistedmelonman

Summary

Create a new GitHub organization for repos currently under smartwatermelon/ (personal account). This eliminates per-repo OAuth token management by enabling org-level secrets, reducing annual claude setup-token minting from ~30 invocations to 2 (one per org).

Background

Claude Code Action CI across ~30 repos requires CLAUDE_CODE_OAUTH_TOKEN secrets minted via claude setup-token. Personal GitHub accounts cannot set organization-level secrets — each repo needs its own copy. GitHub orgs (even free-tier) support org-level secrets shared across all repos.

Investigated alternatives that turned out to be dead ends:

  • grll/claude-code-login (automated PKCE OAuth flow): Anthropic's token endpoint returns 429 for third-party callers. Confirmed locally and in GHA. Fork at smartwatermelon/claude-code-login can be deleted.
  • Workload Identity Federation: eliminates token minting entirely but switches CI billing from Max subscription (flat rate) to per-token API rates. Non-starter.
  • Anthropic token list/revoke API: undocumented endpoint is broken (capped at 1000, ignores pagination). Feature requests (#22995, #48373, #59378) all closed or unresolved.

Plan

Phase 1: Create the new org

  1. Create a new free-tier GitHub organization (name TBD)
  2. Verify free-tier features are sufficient: all repos are public, so protected branches, code owners, environment secrets, etc. are all available on Free

Phase 2: Transfer repos

  1. Inventory all repos under smartwatermelon/ that use Claude Code Action CI
  2. Transfer repos to the new org via GitHub UI (Settings → Transfer)
    • GitHub maintains redirects from old URLs
    • Note: Transferring repos changes the remote URL. Each local clone needs git remote set-url origin updated
  3. Script the remote URL update across all local clones:
    # For each repo in ~/Developer/
    cd ~/Developer/<repo>
    git remote set-url origin git@github.com:<new-org>/<repo>.git

Phase 3: Update cross-references

  1. Update CLAUDE.md files that reference smartwatermelon/ repo paths
  2. Update claude-wrapper if it has org-specific routing logic
  3. Update any hardcoded repo references in CI workflows (e.g., actions/checkout with explicit repo paths)
  4. Update blog posts at projectinsomnia.com that reference smartwatermelon/ GitHub URLs (GitHub redirects will work but canonical URLs are better)
  5. Update the dotfiles repo if it contains org-specific configuration

Phase 4: Set up org-level secrets

  1. Mint one token via claude setup-token
  2. Set as org-level secret:
    gh secret set CLAUDE_CODE_OAUTH_TOKEN --org <new-org> --visibility all
  3. Remove per-repo CLAUDE_CODE_OAUTH_TOKEN secrets from transferred repos (they'd shadow the org secret)
  4. Verify CI passes on a representative repo

Phase 5: Do the same for nightowlstudiollc (if not already done)

  1. NOS already has org-level secrets capability (Team plan, staying at $4/month)
  2. Mint one token, set as org-level secret
  3. Remove per-repo secrets
  4. Verify CI

Phase 6: Cleanup

  1. Delete the smartwatermelon/claude-code-login fork (dead end, confirmed blocked by Anthropic 429)
  2. Create a token tracking doc (CSV or markdown table in dev-env) recording:
    • Org name
    • Token minted date
    • Token expiry date
    • Which setup-token invocation produced it
  3. Set a calendar reminder for annual rotation (~2 weeks before expiry)

Outcome

Before After
~30 setup-token mints/year 2 mints/year
Per-repo gh secret set loop 2 org-level gh secret set calls
No audit trail Token tracking doc
Personal account (no org secrets) Free org (org-level secrets)
nightowlstudiollc: $4/month (Team) nightowlstudiollc: $4/month (unchanged)

Open questions

  • Org name for the new smartwatermelon org
  • Whether any smartwatermelon/ repos have repo-level secrets beyond CLAUDE_CODE_OAUTH_TOKEN that would need migration
  • Whether any CI workflows reference smartwatermelon/ in hardcoded paths (beyond what GitHub redirects cover)
  • Confirm nightowlstudiollc is already using org-level secrets or needs the same Phase 4 treatment

Activity

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions