feat(KFLUXVNGD-1022): add operator changelog workflow and placeholder comment#12030
feat(KFLUXVNGD-1022): add operator changelog workflow and placeholder comment#12030kelchen123 wants to merge 1 commit into
Conversation
… comment Co-authored-by: Cursor <cursoragent@cursor.com>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: kelchen123 The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Kustomize Render DiffComparing No render differences detected. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #12030 +/- ##
==========================================
+ Coverage 52.37% 52.45% +0.07%
==========================================
Files 19 19
Lines 1283 1285 +2
==========================================
+ Hits 672 674 +2
Misses 539 539
Partials 72 72
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
Review Summary by QodoAdd operator changelog workflow with placeholder comment generator
WalkthroughsDescription• Add changelog-generator binary to post placeholder comments on operator SHA bump PRs • Implement operator-changelog GitHub workflow triggered on kustomization.yaml changes • Refactor GitHub comment client to support custom markers for multiple tools • Update Makefile to build new changelog-generator binary Diagramflowchart LR
PR["PR bumps operator SHA"] -->|Triggers workflow| WF["operator-changelog.yaml"]
WF -->|Builds & runs| CG["changelog-generator"]
CG -->|Posts comment| GH["GitHub PR"]
CC["CommentClient refactored"] -->|Supports custom markers| CG
File Changes1. infra-tools/cmd/changelog-generator/main.go
|
Code Review by Qodo
Context used✅ Compliance rules (platform):
2 rules 1. Comment failures hidden
|
| func postOrPrint(ctx context.Context, dryRun bool, token, repo, prStr, body string) { | ||
| if dryRun || token == "" || repo == "" || prStr == "" { | ||
| fmt.Print(body) | ||
| return | ||
| } | ||
|
|
||
| prNumber := 0 | ||
| if _, err := fmt.Sscanf(prStr, "%d", &prNumber); err != nil || prNumber == 0 { | ||
| slog.Error("invalid PR number — printing to stdout", "pr", prStr) | ||
| fmt.Print(body) | ||
| return | ||
| } | ||
|
|
||
| client, err := ghclient.NewCommentClient(token, repo) | ||
| if err != nil { | ||
| slog.Error("creating GitHub client — printing to stdout", "err", err) | ||
| fmt.Print(body) | ||
| return | ||
| } | ||
|
|
||
| if err := client.UpsertCommentByMarker(ctx, prNumber, body, commentMarker); err != nil { | ||
| slog.Error("posting PR comment — printing to stdout as fallback", "err", err) | ||
| fmt.Print(body) | ||
| } |
There was a problem hiding this comment.
1. Comment failures hidden 🐞 Bug ☼ Reliability
changelog-generator logs and prints the comment on GitHub API/client failures but still exits successfully, so the workflow can go green without ever posting/updating the PR comment. This undermines the stated goal of proving the trigger-to-comment pipeline and makes breakage hard to notice.
Agent Prompt
## Issue description
`postOrPrint` swallows failures when creating the GitHub client or upserting the PR comment and returns success after printing to stdout. In CI mode (i.e., when `GITHUB_TOKEN`, `GITHUB_REPOSITORY`, and `PR_NUMBER` are set and `--dry-run` is not used), failures should cause a non-zero exit so the workflow run clearly indicates the pipeline is broken.
## Issue Context
This tool is run from a `pull_request_target` workflow to validate end-to-end commenting. A “successful” run that only prints to logs defeats the purpose.
## Fix Focus Areas
- infra-tools/cmd/changelog-generator/main.go[28-71]
## Suggested change
- Change `postOrPrint` to return an `error`.
- In `main()`, if `postOrPrint` returns error, log it and `os.Exit(1)`.
- Keep stdout printing only for true dry-run mode or when required identifiers are missing (explicitly treat that as non-CI mode).
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
Adds the changelog-generator workflow and a minimal binary that posts a placeholder comment on any PR that bumps the operator SHA, proving the trigger-to-comment pipeline before changelog logic is added in subsequent PRs.