From bb0ec76b447f21063beb0448b61cd54d85096735 Mon Sep 17 00:00:00 2001 From: Aliaksandr Date: Thu, 22 Jan 2026 01:45:07 +0200 Subject: [PATCH] ci(bot): auto-label new package PRs with '8.has: package (new)' Checks all PR commit messages for ': init at' pattern and requires eval to report added packages (attrdiff.added). --- ci/github-script/bot.js | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/ci/github-script/bot.js b/ci/github-script/bot.js index f812df3c565f..ba53aded5e37 100644 --- a/ci/github-script/bot.js +++ b/ci/github-script/bot.js @@ -321,9 +321,28 @@ module.exports = async ({ github, context, core, dry }) => { expectedHash: artifact.digest, }) - const evalLabels = JSON.parse( + const changedPaths = JSON.parse( await readFile(`${pull_number}/changed-paths.json`, 'utf-8'), - ).labels + ) + const evalLabels = changedPaths.labels + + // Fetch all PR commits to check their messages for package patterns + const prCommits = await github.paginate(github.rest.pulls.listCommits, { + ...context.repo, + pull_number, + per_page: 100, + }) + const commitMessages = prCommits.map((c) => c.commit.message) + + // Label new package PRs: "packagename: init at X.Y.Z" + // Exclude NixOS module commits like "nixos/timekpr: init at 0.5.8" + const newPackagePattern = /(? 0 + const commitsIndicateNewPackage = commitMessages.some((msg) => + newPackagePattern.test(msg), + ) + evalLabels['8.has: package (new)'] = + hasNewPackages && commitsIndicateNewPackage // TODO: Get "changed packages" information from list of changed by-name files // in addition to just the Eval results, to make this work for these packages