ci/github-script/bot: only look at commit subject when deciding if a package is new/updated

This commit is contained in:
Michael Daniels
2026-01-25 16:11:24 -05:00
parent 6ba71cbcab
commit c717c98bc8
+5 -3
View File
@@ -332,13 +332,15 @@ module.exports = async ({ github, context, core, dry }) => {
pull_number,
per_page: 100,
})
const commitMessages = prCommits.map((c) => c.commit.message)
const commitSubjects = prCommits.map(
(c) => c.commit.message.split('\n')[0],
)
// Label new package PRs: "packagename: init at X.Y.Z"
// Exclude NixOS module commits like "nixos/timekpr: init at 0.5.8"
const newPackagePattern = /(?<!nixos\/\S+): init at\b/
const hasNewPackages = changedPaths.attrdiff?.added?.length > 0
const commitsIndicateNewPackage = commitMessages.some((msg) =>
const commitsIndicateNewPackage = commitSubjects.some((msg) =>
newPackagePattern.test(msg),
)
evalLabels['8.has: package (new)'] =
@@ -348,7 +350,7 @@ module.exports = async ({ github, context, core, dry }) => {
// Matches versions like: 1.2.3, 0-unstable-2024-01-15, 1.3rc1, alpha, unstable
// Exclude NixOS module commits like "nixos/ncps: types.str -> types.path"
const updatePackagePattern = /(?<!nixos\/\S+): [\w.-]+ (->|→) [\w.-]+/
const commitsIndicateUpdate = commitMessages.some((msg) =>
const commitsIndicateUpdate = commitSubjects.some((msg) =>
updatePackagePattern.test(msg),
)
evalLabels['8.has: package (update)'] = commitsIndicateUpdate