Skip to content

feat(gh): seal a secret into an environment with secret sync - #6789

Merged
dan-petty merged 5 commits into
mainfrom
feat/6781-secret-sync-environment
Nov 22, 2026
Merged

dan-petty merged 5 commits into
mainfrom
feat/6781-secret-sync-environment

Conversation

@dan-petty

Copy link
Copy Markdown
Owner

devops gh secret sync --env <name> seals a secret into a GitHub Actions
environment: it reads the public key of the environment, seals each value
with the PyNaCl sealed box, and sends the PUT body on stdin. It encodes the
environment name for the URL. Without --env, it writes repository secrets
as before. --from-file <path> (or - for stdin) gives the value of one
secret, and the command refuses it with two names or with --source vault.
read_secret_input in src/devops_cli/config/secret_input.py is now the
one reader of --from-file for this command and devops config set.
sync_repository_secrets and sync_secrets_requests take environment
for #6773. No value goes to output, logs, spans or error text: tests assert
it with a known test value and a fake of the secrets routes. A dry run
sends no request. The command docs and the CLI reference are generated
again.

Closes #6781

Change: openspec/changes/archive/2026-11-22-6781-secret-sync-environment/

@dan-petty dan-petty added type/feature Type feature: a new function scope/gh The devops gh commands labels Nov 22, 2026
@dan-petty

Copy link
Copy Markdown
Owner Author

Review points for the owner (no person steps in this item):

  1. --from-file keeps the last newline of the file, as devops config set --from-file does, so the keyring value and the GitHub value agree. gh secret set strips it from stdin. A PEM key works either way.
  2. A missing keyring entry still gives a warning and exit 0, as before. Only a failed upload, a missing environment or a seal error gives exit 1. feat(repos): onboard a repository with one command #6773 reads the SecretSyncResult of the library, not the exit code.
  3. --from-file with the default --source keyring reads only the file. Only --source vault with --from-file is refused.
  4. This item adds no devops gh secret list --env. The presence check by name of feat(repos): onboard a repository with one command #6773 can use secrets_path(repo, environment) with a GET.
  5. Pending a person: review the diff in tuicr (tuicr -r origin/main..HEAD).

The not-utf8 case now asserts the fixed message and that the text has no
0xff. Before, the test also passed when the error quoted the decode error.
gh secret list has no --env, so the group help now says that the group
lists the repository secrets. The command docs are generated again.
@dan-petty
dan-petty marked this pull request as ready for review November 22, 2026 17:20
@dan-petty
dan-petty merged commit f9627cd into main Nov 22, 2026
29 checks passed
@dan-petty
dan-petty deleted the feat/6781-secret-sync-environment branch November 22, 2026 18:10
dan-petty pushed a commit that referenced this pull request Nov 22, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.195.0](v0.194.2...v0.195.0)
(2026-11-22)


### Features

* **gh:** seal a secret into an environment with secret sync
([#6789](#6789))
([f9627cd](f9627cd))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: dan-petty-release[bot] <346998822+dan-petty-release[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope/gh The devops gh commands type/feature Type feature: a new function

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(gh): seal a secret into an environment with secret sync

1 participant