Skip to content

GitHub Credentials Guide

Bootstrap guide for giving the platform automation scripts full access to all 13 managed GitHub orgs. Follows a god-mode-then-scope-down pattern: create one all-powerful PAT, use it to seed org secrets, then replace it with narrow per-org PATs and revoke the god-mode token.

Script that uses this: scripts/identity/Invoke-GitHubSecretsDistribution.ps1
Script that follows this: scripts/onboarding/Invoke-RepoClaudeSetup.ps1 (needs ORG_PAT seeded first)
See also: GitLab Credentials Guide — same pattern for GitLab


Prerequisites

  • Azure CLI logged in as kris@hybridsolutions.cloud with access to kv-hcs-vault-01
  • gh CLI installed (winget install GitHub.cli)
  • Environment loaded: . D:\git\platform\scripts\Load-HCSEnvironment.ps1

Phase 1 — God-mode bootstrap

Step 1 — Create the god-mode Classic PAT

Where: github.com → Settings → Developer settings → Personal access tokens → Tokens (classic)

Account: kristopherjturner — the account that is an owner or admin of all 13 managed orgs

Token name: hcs-platform-godmode-<YYYY-MM-DD> (include the expiry date in the name as a reminder)

Expiration: 90 days — set an explicit date, never use no-expiration

Scopes — select ALL of the following:

ScopeWhy
repo (full)Read/write all repos, commit statuses, deployments
workflowCreate and update GitHub Actions workflows
write:packages + read:packages + delete:packagesGitHub Packages
admin:org (all sub-scopes)Manage org settings, members, webhooks, org-level secrets
admin:public_key (all sub-scopes)Manage SSH keys
admin:repo_hook (all sub-scopes)Manage repo webhooks
admin:org_hookManage org-level webhooks
notificationsRead notifications
user (full)Read/write profile
delete_repoDelete repositories (needed for idempotent repo setup)
write:discussion + read:discussionGitHub Discussions
admin:gpg_key (all sub-scopes)GPG key management
admin:ssh_signing_key (all sub-scopes)SSH signing keys

Do not use fine-grained PATs for the god-mode token. Fine-grained PATs cannot manage org-level secrets or org webhooks across multiple orgs with a single token.


Step 2 — Store in Key Vault immediately

The token value is only shown once. Paste it before navigating away.

powershell
az keyvault secret set `
  --vault-name kv-hcs-vault-01 `
  --name hcs-platform-github-kjt-godmode-pat `
  --value '<paste-token-here>'

Add a row to docs/identity/secret-inventory.md:

Secret nameVaultPurposeRotationNotes
hcs-platform-github-kjt-godmode-patkv-hcs-vault-01God-mode Classic PAT — all scopes — bootstrap onlyRevoke after Phase 2Temporary

Step 3 — Load into your session

powershell
# Load standard environment first (az, ADO PAT, etc.)
. D:\git\platform\scripts\Load-HCSEnvironment.ps1

# Override GITHUB_TOKEN with the god-mode PAT for bootstrap work
$env:GITHUB_TOKEN = az keyvault secret show `
  --vault-name kv-hcs-vault-01 `
  --name hcs-platform-github-kjt-godmode-pat `
  --query value --output tsv

# Authenticate the gh CLI
$env:GITHUB_TOKEN | gh auth login --with-token
gh auth status

Step 4 — Seed org-level Actions secrets (all 13 orgs)

powershell
# Preview first
pwsh D:\git\platform\scripts\identity\Invoke-GitHubSecretsDistribution.ps1 -DryRun

# Review log output, then run live
pwsh D:\git\platform\scripts\identity\Invoke-GitHubSecretsDistribution.ps1

What the script seeds:

GitHub secret nameSource KV secretOrgs targeted
ORG_PAThcs-platform-github-kjt-godmode-pat (fallback until per-org PATs exist)All 13 orgs
AZURE_SUBSCRIPTION_IDhcs-platform-azure-sub-idAzureLocal, thisismydemo
ANTHROPIC_API_KEYhcs-platform-anthropic-api-keyAzureLocal, thisismydemo

All secrets are set with --visibility all (every repo in the org can read them).


Phase 2 — Per-org scoped PATs (AB#22)

Create these after the god-mode bootstrap is confirmed working. Each is a Classic PAT on the kristopherjturner account, scoped only to repo + workflow + read:org — no admin or org-management scopes.

Expiration: 365 days with calendar reminder to rotate.

GitHub orgKV secret name (→ kv-hcs-vault-01)Scopes
AzureLocalhcs-platform-github-azurelocal-patrepo, workflow, read:org
thisismydemohcs-platform-github-thisismydemo-patrepo, workflow, read:org
holdfast-presshcs-platform-github-holdfast-press-patrepo, workflow
turnerlegacyhcs-platform-github-turnerlegacy-patrepo, workflow, read:org
faithfulcraftsmenhcs-platform-github-faithfulcraftsmen-patrepo, workflow
gunnerthelabhcs-platform-github-gunnerthelab-patrepo, workflow
Heritage-Virginiahcs-platform-github-heritage-virginia-patrepo, workflow
Hybrid-Solutions-Cloudhcs-platform-github-hybrid-solutions-cloud-patrepo, workflow
hybridsolutionscloudhcs-platform-github-hybridsolutionscloud-patrepo, workflow
ifartedcloudhcs-platform-github-ifartedcloud-patrepo, workflow
project42devhcs-platform-github-project42dev-patrepo, workflow
sunpath-devhcs-platform-github-sunpath-dev-patrepo, workflow

For each token, store it immediately:

powershell
az keyvault secret set `
  --vault-name kv-hcs-vault-01 `
  --name hcs-platform-github-<org>-pat `
  --value '<paste-token>'

Add each to docs/identity/secret-inventory.md and tick the corresponding row in Table B of docs/onboarding/tracker.md.

Re-seed org secrets with scoped PATs

Once all 13 per-org PATs are in KV, re-run the distribution script. It will automatically use each org's own PAT instead of the god-mode fallback:

powershell
pwsh D:\git\platform\scripts\identity\Invoke-GitHubSecretsDistribution.ps1 -DryRun
pwsh D:\git\platform\scripts\identity\Invoke-GitHubSecretsDistribution.ps1

Phase 3 — Revoke the god-mode PAT

Only do this after all 13 per-org PATs are confirmed in KV and ORG_PAT has been re-seeded from them.

  1. GitHub → Settings → Developer settings → Tokens (classic) → find hcs-platform-godmode-* → Delete
  2. Remove from KV:
    powershell
    az keyvault secret delete --vault-name kv-hcs-vault-01 --name hcs-platform-github-kjt-godmode-pat
  3. Update secret-inventory.md — mark the row as revoked/deleted with the date.

Phase 4 — Configure all repos (AB#15)

With ORG_PAT seeded in every org, configure all repos with Claude Code settings:

powershell
# Preview — classify repos and show what would be written
pwsh D:\git\platform\scripts\onboarding\Invoke-RepoClaudeSetup.ps1 -DryRun

# Run org by org to review before committing broadly
pwsh D:\git\platform\scripts\onboarding\Invoke-RepoClaudeSetup.ps1 -OrgFilter AzureLocal -DryRun
pwsh D:\git\platform\scripts\onboarding\Invoke-RepoClaudeSetup.ps1 -OrgFilter AzureLocal

# Then the remaining orgs
pwsh D:\git\platform\scripts\onboarding\Invoke-RepoClaudeSetup.ps1

Track per-repo completion in Table D of docs/onboarding/tracker.md.

Copyright © Hybrid Cloud Solutions LLC — Kristopher Turner