Skip to content

feat: add secret helper#6223

Merged
mnkiefer merged 22 commits intomainfrom
token-getter
Dec 12, 2025
Merged

feat: add secret helper#6223
mnkiefer merged 22 commits intomainfrom
token-getter

Conversation

@mnkiefer
Copy link
Copy Markdown
Collaborator

@mnkiefer mnkiefer commented Dec 12, 2025

Secret helper and tokens bootstrap command

  • Add a gh aw secret set command that sets GitHub Actions repository secrets via the public‑key REST API using NaCl sealed‑box encryption, with no external secret helper dependencies.
  • Adds golang.org/x/crypto to go.mod/go.sum to support NaCl sealed‑box encryption.
  • Adds a GitHub Tokens reference/guide with:
    • A concise, scenario‑based quick‑start table, and
    • A Security and scopes section that recommends minimal PAT/App scopes and per‑workflow permissions: usage.
  • Add a new gh aw tokens bootstrap command that inspects the current repo’s secrets via the GitHub CLI and prints which recommended gh‑aw token secrets are missing, when they’re needed, suggested scopes, and gh aw secret set commands to add them. The command is read‑only and does not create tokens or secrets itself.
  • Always keeps all token consent and scope decisions with the user: they still create PATs in GitHub’s UI, with docs and CLI output pointing them to minimal, scenario‑specific scopes. This reduces token sprawl, clarifies exactly which secrets are needed when, and proactively flags missing or under‑scoped tokens so GitHub Agentic Workflows fail less often on permissions issues.

@mnkiefer mnkiefer self-assigned this Dec 12, 2025
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces a token management system for GitHub Agentic Workflows, adding a new CLI command to help users bootstrap and validate their GitHub token secrets, along with an internal helper tool for programmatic secret management.

Key changes:

  • New gh aw tokens bootstrap command that inspects repository secrets and provides guidance on missing tokens
  • Internal ghsecret tool that sets GitHub Actions repository secrets using NaCl encryption
  • Enhanced documentation with security best practices and least-privilege guidance

Reviewed changes

Copilot reviewed 6 out of 7 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
pkg/cli/tokens.go New parent command for token-related utilities
pkg/cli/tokens_bootstrap.go New bootstrap subcommand that checks and suggests token setup (missing cobra import)
internal/tools/ghsecret/main.go Internal tool for setting repository secrets via GitHub API with NaCl encryption
go.mod Added golang.org/x/crypto v0.36.0 dependency for NaCl encryption support
go.sum Updated checksums for new crypto dependency
docs/src/content/docs/reference/tokens.md Added quick start guide and security best practices for token configuration
cmd/gh-aw/main.go Integrated new tokens command into CLI with setup group assignment

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread pkg/cli/tokens_bootstrap.go
Comment thread pkg/cli/tokens_bootstrap.go Outdated
Comment thread internal/tools/ghsecret/main.go Outdated
Comment thread pkg/cli/tokens_bootstrap.go
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 7 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread internal/tools/ghsecret/main.go Outdated
Comment thread docs/src/content/docs/reference/tokens.md Outdated
Comment thread pkg/cli/tokens_bootstrap.go Outdated
mnkiefer and others added 3 commits December 12, 2025 10:34
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@mnkiefer
Copy link
Copy Markdown
Collaborator Author

@copilot fix lint issues

Copy link
Copy Markdown
Contributor

Copilot AI commented Dec 12, 2025

@mnkiefer I've opened a new pull request, #6233, to work on those changes. Once the pull request is ready, I'll request review from you.

@mnkiefer
Copy link
Copy Markdown
Collaborator Author

@pelikhan: This PR attempts to tackle the user pain of figuring out the right GitHub token and permissions setup by standardizing how gh‑aw uses GITHUB_TOKEN and PATs, and by giving you a concrete token/permissions checklist instead of opaque trial‑and‑error.

@mnkiefer mnkiefer requested a review from pelikhan December 12, 2025 10:53
Copy link
Copy Markdown
Collaborator

@pelikhan pelikhan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • must work properly from a codespace with underprivileged token (graceful failure )

Comment thread pkg/cli/tokens_bootstrap.go
Comment thread internal/tools/ghsecret/main.go Outdated
Comment thread internal/tools/ghsecret/main.go Outdated
Comment thread internal/tools/ghsecret/main.go Outdated
Comment thread pkg/cli/tokens_bootstrap.go
@pelikhan
Copy link
Copy Markdown
Collaborator

Why a separate tool? We typically have sub comments instead.

@pelikhan
Copy link
Copy Markdown
Collaborator

Aside from comments this is really good. Configuring tokens is the #1 source of friction.

I would like to see the token validation flow merged into the "init" command (init --tokens) and also the install.md should be smart about it.

@mnkiefer mnkiefer changed the title feat: add internal secret helper feat: add secret helper Dec 12, 2025
@mnkiefer mnkiefer requested a review from pelikhan December 12, 2025 15:29
@mnkiefer mnkiefer merged commit e553b69 into main Dec 12, 2025
22 checks passed
@mnkiefer mnkiefer deleted the token-getter branch December 12, 2025 16:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants