CI: clean Key Vault secret retrieval in reusable review workflows#6
CI: clean Key Vault secret retrieval in reusable review workflows#6
Conversation
Reviewer's GuideAdds reusable AI-powered manual PR review workflows for Claude and OpenCode that retrieve secrets from Azure Key Vault via Azure PowerShell sessions instead of inline az CLI calls, introduces a required poutine security scanning workflow, adjusts permissions scoping for the owner-enforcement workflow, and documents these workflows in the README. Sequence diagram for reusable OpenCode manual PR review workflowsequenceDiagram
actor Developer
participant CallerRepoWorkflow as Caller_repo_workflow
participant ReusableOpenCodeWorkflow as Reusable_opencode_review
participant GitHubAPI as GitHub_API
participant AzureLogin as Azure_login_action
participant AzureKeyVault as Azure_Key_Vault
participant OpenCodeAction as OpenCode_GitHub_action
participant GitHubPR as GitHub_pull_request
Developer->>CallerRepoWorkflow: Dispatch workflow_call with pr_number and model inputs
CallerRepoWorkflow->>ReusableOpenCodeWorkflow: Invoke reusable-opencode-review with inputs
ReusableOpenCodeWorkflow->>GitHubAPI: Fetch PR metadata via gh api
GitHubAPI-->>ReusableOpenCodeWorkflow: PR head_sha, title, body, size metrics
ReusableOpenCodeWorkflow->>ReusableOpenCodeWorkflow: Check allowlist and default branch
ReusableOpenCodeWorkflow->>ReusableOpenCodeWorkflow: Evaluate size thresholds and force_review
alt PR below thresholds and not forced
ReusableOpenCodeWorkflow->>Developer: Log skip message and exit
else PR meets thresholds or forced
ReusableOpenCodeWorkflow->>AzureLogin: azure/login OIDC authentication
AzureLogin-->>ReusableOpenCodeWorkflow: Federated access token and Az PowerShell session
ReusableOpenCodeWorkflow->>AzureKeyVault: Get-AzKeyVaultSecret for ZHIPU API key
AzureKeyVault-->>ReusableOpenCodeWorkflow: ZHIPU API key (masked, via GITHUB_OUTPUT)
ReusableOpenCodeWorkflow->>ReusableOpenCodeWorkflow: Build OpenCode mock issue_comment event
ReusableOpenCodeWorkflow->>OpenCodeAction: anomalyco/opencode/github with model and MOCK_EVENT
OpenCodeAction->>GitHubAPI: Read PR diff and files
OpenCodeAction->>GitHubPR: Post consolidated review comment
OpenCodeAction-->>ReusableOpenCodeWorkflow: Completion status
alt OpenCode review step fails
ReusableOpenCodeWorkflow->>Developer: Emit non-blocking warning in step summary
else OpenCode review succeeds
ReusableOpenCodeWorkflow->>Developer: Summarize successful review in logs
end
end
Sequence diagram for reusable Claude manual PR review workflowsequenceDiagram
actor Developer
participant CallerRepoWorkflow as Caller_repo_workflow
participant ReusableClaudeWorkflow as Reusable_claude_review
participant GitHubAPI as GitHub_API
participant AzureLogin as Azure_login_action
participant AzureKeyVault as Azure_Key_Vault
participant ClaudeAction as Claude_code_action
participant GitHubPR as GitHub_pull_request
Developer->>CallerRepoWorkflow: Dispatch workflow_call with pr_number
CallerRepoWorkflow->>ReusableClaudeWorkflow: Invoke reusable-claude-review with inputs
ReusableClaudeWorkflow->>GitHubAPI: Fetch PR metadata via gh api
GitHubAPI-->>ReusableClaudeWorkflow: PR head_sha, title, body, size metrics
ReusableClaudeWorkflow->>ReusableClaudeWorkflow: Check allowlist and default branch
ReusableClaudeWorkflow->>ReusableClaudeWorkflow: Evaluate size thresholds and force_review
alt PR below thresholds and not forced
ReusableClaudeWorkflow->>Developer: Log skip message and exit
else PR meets thresholds or forced
ReusableClaudeWorkflow->>AzureLogin: azure/login OIDC authentication
AzureLogin-->>ReusableClaudeWorkflow: Federated access token and Az PowerShell session
ReusableClaudeWorkflow->>AzureKeyVault: Get-AzKeyVaultSecret for Claude OAuth token
AzureKeyVault-->>ReusableClaudeWorkflow: Claude OAuth token (masked, via GITHUB_OUTPUT)
ReusableClaudeWorkflow->>ClaudeAction: anthropics/claude-code-action with token and prompt
ClaudeAction->>GitHubAPI: Read PR diff and files
ClaudeAction->>GitHubPR: Post consolidated review comment
ClaudeAction-->>ReusableClaudeWorkflow: Completion status
alt Claude review step fails
ReusableClaudeWorkflow->>Developer: Emit non-blocking warning in step summary
else Claude review succeeds
ReusableClaudeWorkflow->>Developer: Summarize successful review in logs
end
end
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
c99a878 to
3c02b46
Compare
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- The
Authorize dispatcher (allowlist)and PR metadata resolution logic are duplicated between the Claude and OpenCode reusable workflows; consider extracting these into a shared composite action or a called job to keep behavior consistent and reduce future drift.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The `Authorize dispatcher (allowlist)` and PR metadata resolution logic are duplicated between the Claude and OpenCode reusable workflows; consider extracting these into a shared composite action or a called job to keep behavior consistent and reduce future drift.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
|
Addressing review context: the duplication between Claude/OpenCode workflows is pre-existing and outside the scope of this PR. This change is intentionally limited to replacing inline Key Vault CLI secret retrieval with Azure PowerShell retrieval + secure interpolation hardening. I’ll open a follow-up task for shared composite-action extraction so we can refactor both workflows safely in one dedicated change. |
4087985 to
39bd77a
Compare
Summary
az keyvault secret showcalls in reusable Claude/OpenCode review workflowsenable-AzPSSession: true)azure/powershell@v2+Get-AzKeyVaultSecretGITHUB_OUTPUThandoff for downstream stepsenvand using env vars insideinlineScriptValidation
actionlint .github/workflows/*.ymlzizmor .github/workflows/*.yml(clean)make sonaris not available in this repository (noMakefile/sonartarget)Risk
Summary by Sourcery
Introduce centralized reusable workflows for AI-assisted manual PR reviews and organization-wide Poutine scanning, while tightening permissions and documentation for governance workflows.
New Features:
Enhancements:
CI: