ci: add automated OpenAI grant rotation workflow (device flow) - #200
Merged
Conversation
Automated rotation of the OpenAI OAuth grant for the cluster backend: runs the opencode CLI headless device flow (URL and code surfaced in the run summary), regenerates the SOPS Secret with sops --encrypt using the repository creation rules (no age key in CI), bumps auth-seed-revision, and commits, opens a pull request, and enables auto-merge using a scoped makeitworkbot installation token, mirroring the charts post-publish pattern. Requires the tfroot-github secret distribution change to be applied before the first dispatch.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
.github/workflows/rotate-opencode-openai.yml, aworkflow_dispatchworkflow that rotates the OpenAI OAuth grant inworkloads/opencode/opencode-openai-secret.yamlend to end:opencode auth login --provider openai --method "ChatGPT Pro/Plus (headless)"(verified device flow on the deployed CLI 1.18.23) and surfaces the device URL and code in the run summary.sops --encryptunder the repository creation rules — encryption-only, so CI holds no age key and no Actions secret beyond the App key below.auth-seed-revisionto<date>-<run_number>in the same change so theseed-openai-authinit container re-seeds the home PVC.makeitworkbotinstallation token (actions/create-github-app-token, mirroring the charts post-publish pattern), which branch protection onmainallows to complete the merge once the requiredtestcheck passes. Includes a branch-update fallback for the strict up-to-date requirement.Type of change
Validation
test(pre-commit): successDesign evidence: CLI behavior probed on the deployed image version (device flow output, no localhost callback), install steps pinned to
opencode-ai@1.18.23and sopsv3.13.3with checksum verification, and the App-token merge pattern copied from the proven chartsupdate-opencode-gitopsjob. First dispatch is the smoke test.Impact and rollout
Prerequisite: makeitworkcloud/tfroot-github#58 distributing
CHART_UPDATER_GITHUB_APP_PRIVATE_KEYto this repository must be applied before the first dispatch; until then the token step fails fast. The workflow is dispatch-only, serialized by a concurrency group, and never syncs Argo CD — generated rotation pull requests merge through the requiredtestcheck, then the existing Argo CD + Reloader + init-container chain applies them.Safety and secrets
Agent disclosure: workflow, branch, and this pull request were prepared by the makeitwork OpenCode agent at the owner's direction.