HYPERFLEET-1068 - fix: whitelist bot authors in commitlint validation#9
Merged
Conversation
7df3d4a to
a86221e
Compare
Konflux PaC onboarding PRs fail commitlint because the bot commit messages don't follow the HyperFleet commit standard. Add author-based whitelisting so commits from known bot accounts are automatically skipped during validation. - Add whitelistedAuthors field to Validator with IsWhitelistedAuthor() - Skip validation for commits from konflux@no-reply.konflux-ci.dev - Add AuthorEmail to PRCommit for GitHub API fallback path - Remove unused getCommitMessage function (inlined in validateCommits) - Add tests for whitelist behaviour in both git and validator paths Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
a86221e to
0575f9e
Compare
|
/lgtm |
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
getCommitMessagefunction (logic inlined invalidateCommits)AuthorEmailtoPRCommitand refactorsGetPRTitletoGetPRInfoto include PR author loginProblem
Konflux PaC sends onboarding PRs with commit messages like
Red Hat Konflux kflux-prd-rh02 update hyperfleet-apiwhich fail the HyperFleet commit standard. Both the commit message AND the PR title fail validation, blocking merge of.tekton/pipeline files on all three component repos.Approach
Whitelist by author identity rather than commit message pattern — bot identities are stable, messages could change. Whitelisted commits and PR titles print
SKIP (whitelisted author: ...)and count as passed.Currently whitelisted:
konflux@no-reply.konflux-ci.dev(commit author email)red-hat-konflux-kflux-prd-rh02[bot](GitHub PR author login)Manual Verification
Built locally and ran against the actual Konflux onboarding PR (hyperfleet-api #132):
Follow-up
After this merges and a new release is cut, the Prow presubmit job in
openshift/releaseneeds updating to use the new version.Test plan
TestValidator_IsWhitelistedAuthor— unit tests for whitelist lookup (email, GitHub login, case insensitive, empty, non-whitelisted)TestValidateCommits_WhitelistedAuthor— integration test: bot commit skipped, user commit validatedTestValidateCommits_WhitelistedAuthorInvalidMessage— non-whitelisted author with bad message still failsTestGetPRInfo_InvalidRepoFormat— updated from GetPRTitleTestGetPRInfoFromEnv_MissingEnvVars— updated from GetPRTitleFromEnv🤖 Generated with Claude Code