Skip to content

Match bot patterns against the author, so human commits mentioning GitHub still count [patch] - #179

Merged
matt-edmondson merged 1 commit into
mainfrom
fix/157-bot-commits-by-author
Sep 28, 2026
Merged

matt-edmondson merged 1 commit into
mainfrom
fix/157-bot-commits-by-author

Conversation

@matt-edmondson

Copy link
Copy Markdown
Contributor

Fixes #157

What was wrong

CommitAnalyzer and ChangelogGenerator each kept their own BotPatterns list, and both lists included "github" matched as a substring of the commit subject. A human commit such as "Fix GitHubApiClient retry" was therefore treated as a bot commit. It produced a prerelease instead of a patch and was left out of the changelog.

Change (per the maintainer decision on the issue)

  • A new internal BotCommitFilter (KtsuBuild/Git/BotCommitFilter.cs) holds both pattern lists, so the two classes can no longer drift apart:
    • Author patterns [bot] and github-actions are matched against the author only
    • Subject patterns ProjectDirector and SyncFileContents are matched against the subject
    • "github" is no longer matched against subjects or messages anywhere
  • CommitAnalyzer now reads commits with GetCommitsAsync (%h%x1f%s%x1f%aN), which gives it the author alongside the subject. Skip-ci and explicit [major]/[minor]/[patch]/[pre] tags still read the subject, as they did before.
  • ChangelogGenerator uses the shared filter.

Tests

  • New: AnalyzeAsync_HumanCommitMentioningGitHub_ReturnsPatch and GenerateAsync_KeepsHumanCommitMentioningGitHub. With "github" temporarily added back to the subject patterns, both fail. With the fix, both pass.
  • The bot-filter tests now use real bot authors (github-actions[bot], dependabot[bot]) and check that those commits are still excluded.
  • CommitAnalyzerTests, VersionCalculatorTests and the fake process runner in PipelineServiceTests now serve GetCommitsAsync in place of GetCommitMessagesAsync.
  • dotnet test: 762/762 passed. The Sonar-local build (.sonarlint/sonar-local.props) reports no new warnings in the touched files.

IGitService.GetCommitMessagesAsync is left in place. It has no callers in the library now, but removing it would be a public API change, so it is not part of this PR.

🤖 Generated with Claude Code

https://claude.ai/code/session_01KV83HNRiTm3h4n1KgMkdqX


Generated by Claude Code

…tHub still count [patch]

CommitAnalyzer and ChangelogGenerator matched "github" as a substring of the
commit subject, so a human commit such as "Fix GitHubApiClient retry" was treated
as a bot commit: it produced a prerelease instead of a patch and was left out of
the changelog.

Both now share BotCommitFilter. "[bot]" and "github-actions" are matched against
the author only, "ProjectDirector" and "SyncFileContents" against the subject, and
"github" is no longer matched anywhere. CommitAnalyzer reads commits through
GetCommitsAsync so it has the author.

Fixes #157

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KV83HNRiTm3h4n1KgMkdqX
@sonarqubecloud

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

A commit whose message mentions "GitHub" is treated as a bot commit: it gets a prerelease instead of a patch and is dropped from the changelog

2 participants