Skip to content
This repository was archived by the owner on Jan 14, 2026. It is now read-only.

Commit 55ab246

Browse files
committed
feat(git): sort contributors by commit count in release notes
- sort contributors in descending order of commit count in generated release notes - use alphabetical order as a tiebreaker for contributors with equal commit counts
1 parent 3a020b8 commit 55ab246

1 file changed

Lines changed: 13 additions & 2 deletions

File tree

  • lua/codecompanion/_extensions/gitcommit/tools

lua/codecompanion/_extensions/gitcommit/tools/git.lua

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -837,8 +837,19 @@ function GitTool.generate_release_notes(from_tag, to_tag, format)
837837
end
838838

839839
release_notes = release_notes .. "### 👥 Contributors\n\n"
840-
for author, count in pairs(contributors) do
841-
release_notes = release_notes .. "- " .. author .. " (" .. count .. " commits)\n"
840+
local sorted_authors = {}
841+
for author in pairs(contributors) do
842+
table.insert(sorted_authors, author)
843+
end
844+
table.sort(sorted_authors, function(a, b)
845+
if contributors[a] == contributors[b] then
846+
return a < b
847+
end
848+
return contributors[a] > contributors[b]
849+
end)
850+
for _, author in ipairs(sorted_authors) do
851+
release_notes = release_notes .. "- " .. author .. " (" .. contributors[author] .. " commits)\n"
852+
end
842853
end
843854

844855
elseif format == "plain" then

0 commit comments

Comments
 (0)