From nobody Mon Jan 12 07:37:20 2026 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4dqPNK3ZRxz6NC6r for ; Mon, 12 Jan 2026 07:37:21 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R13" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4dqPNJ2zQ6z3bvv for ; Mon, 12 Jan 2026 07:37:20 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1768203441; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=xlYpAcgC2QqeCffuF+aHKeF33ryiiZFhSXcRDo1DQOE=; b=a/WvLOp+P/vrz2OyjxGwnJWmoIvFANPWnt+TOxmA2mePyzZ/VpEtw0M1co20cR9ehYsUgy /9u7J3sA1Mx5UK+X+mQBY3vhpka1jkt4A2DFgSWaHFj94TSSxhM2jxB5bnnGfVDwit5sA2 CMq3XC8MxPKBM0jInsquUqF48Zv91CNtLTHP2XwyRa3guMVNhCqoLvMUO1zwlWa/tAi7eK 9PaXCjwjX86+qsF76ntjN602vgD5HFuW0phwFmXiI7MNlhgw0fX2d4AxKcukCeZgLsETo1 7mDNpcXcSm3kMcI3840s+YhcjMjd46/83QkRqzStWQi3Q0CLbuywN+BuV/3hTQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1768203440; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=xlYpAcgC2QqeCffuF+aHKeF33ryiiZFhSXcRDo1DQOE=; b=rusmVB5sn6SBwsiG6rCrD71J0h+212/HQLRd96gGVI+QCFoYIdQK1VivJ5piRPotfJnx3X y2XDHfQXjO/wh6JZvRfUopcHkTj165vCuRNJocYXa8GdfI0P7vDKILJ/ZKOnaKtJHl1U8X YWOAEOq1gwH6ieKg55G4IxZgDA8vHS0dXBTIamGfOHF8gLVufUaZhbe5xZdOyIJJB0Ni2F I0WCQHJDXYVLNLZziczUHFzSYBO+MDeUrEkVyfTfDogx3yzDDBZofX11WR7ADIlOM6x/U5 gkC592IHrVp1SAJIA6F7uv971Jxmely59RYIhseqNdICNaYhxnCggET248yXJw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1768203440; a=rsa-sha256; cv=none; b=yqYL2+SEWS1QTUdmazLeYAMRQG42bi+CWLJQ4iJ5vBPc5rAx64oL58m0HxT/dF3Ws9MZ4F 86+x+rv4MaWEaKCMD8xQQ6e6G9Cz+3ZlROZW9Rx5xVmWl4XhLXD7BP3C/S+XTkcweEnpT2 T9JlpJTQXRoKBDH1EgZ+D6YdC96QfOhg00VChvbTk/niXXoc0K2vLK7P7igtSRkro+aAyh 0Cgj5YlFErvhY45oWL/Tt52UKWHreuxctZWNwDOFwWXv/y7mkNhgPS8U+wTg3ZSEWpXcyh V0anClmKGfj9fofuZ2Zzh0etSwKaQglLn81jBPkThJWpOoiKpf9+qh+9kuQzPA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4dqPNJ2Wq9z2Gf for ; Mon, 12 Jan 2026 07:37:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3d7cb by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Mon, 12 Jan 2026 07:37:20 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 7f8b4db9e001 - main - github: Add more context to pull requests List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7f8b4db9e001d94974a081e5fd58c4f3994429cb Auto-Submitted: auto-generated Date: Mon, 12 Jan 2026 07:37:20 +0000 Message-Id: <6964a4b0.3d7cb.74aa5260@gitrepo.freebsd.org> The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=7f8b4db9e001d94974a081e5fd58c4f3994429cb commit 7f8b4db9e001d94974a081e5fd58c4f3994429cb Author: Warner Losh AuthorDate: 2026-01-10 16:20:20 +0000 Commit: Warner Losh CommitDate: 2026-01-12 07:18:11 +0000 github: Add more context to pull requests Add code to fetch and decode CODEOWNERS and automatically @ people in the review. Create a new file, .github/path-rules.txt that has a set of paths to match and specific warnings about that part of the tree. We'll use this to try to wave off pull requests in certain areas of the tree, as well as remind people when contrib is involved, etc. Sponsored by: Netflix --- .github/path-rules.txt | 10 ++++ .github/workflows/checklist.yml | 106 ++++++++++++++++++++++++++++++++++++---- 2 files changed, 106 insertions(+), 10 deletions(-) diff --git a/.github/path-rules.txt b/.github/path-rules.txt new file mode 100644 index 000000000000..297cfe8def35 --- /dev/null +++ b/.github/path-rules.txt @@ -0,0 +1,10 @@ +# +# Format the similar to CODEOWNERS: Each line has a path, whitespace and a +# message for contributors. +# +sys/contrib/device-tree :caution: No changes should be made here by pull request +# Catch all +contrib :warning: Contributed software usually managed by vendor branch +crypto :warning: Contributed crypto software usually managed by vendor branch +sys/contrib :warning: Contributed software usually managed by vendor branch +sys/crypto :warning: Contributed crypto software usually managed by vendor branch diff --git a/.github/workflows/checklist.yml b/.github/workflows/checklist.yml index 44b264e9c031..303db9eb8534 100644 --- a/.github/workflows/checklist.yml +++ b/.github/workflows/checklist.yml @@ -36,11 +36,49 @@ jobs: pull_number: context.issue.number }); + /* Get owners */ + + let owners = []; + const { data: ownerData } = await github.rest.repos.getContent({ + owner: context.repo.owner, + repo: context.repo.repo, + path: '.github/CODEOWNERS', + ref: context.payload.pull_request.base.ref // Or a specific branch + }); + const oc = Buffer.from(ownerData.content, 'base64').toString(); + owners = oc.split(/\r?\n/) + .map(line => line.trim()) + // Filter out comments and empty lines + .filter(line => line && !line.startsWith('#')) + .map(line => { + // Split by the first block of whitespace to separate path and message + const [path, ...ownerParts] = line.substring(1).split(/\s+/); + return { path, owner: ownerParts.join(' ') }; + }); + + /* Get rules -- maybe refactor to a function for ownerPath too */ + let rules = []; + const { data: rulesData } = await github.rest.repos.getContent({ + owner: context.repo.owner, + repo: context.repo.repo, + path: '.github/path-rules.txt', + ref: context.payload.pull_request.base.ref // Or a specific branch + }); + const rc = Buffer.from(rulesData.content, 'base64').toString(); + rules = rc.split(/\r?\n/) + .map(line => line.trim()) + // Filter out comments and empty lines + .filter(line => line && !line.startsWith('#')) + .map(line => { + // Split by the first block of whitespace to separate path and message + const [path, ...messageParts] = line.split(/\s+/); + return { path, message: messageParts.join(' ') }; + }); + let checklist = {}; let checklist_len = 0; let comment_id = -1; - const msg_prefix = "Thank you for taking the time to contribute to FreeBSD!\n"; const addToChecklist = (msg, sha) => { if (!checklist[msg]) { checklist[msg] = []; @@ -72,6 +110,43 @@ jobs: addToChecklist("Real email address is needed", commit.sha); } + /* Check for different paths that have issues and/or owners */ + const { data: files } = await github.rest.pulls.listFiles({ + owner: context.repo.owner, + repo: context.repo.repo, + pull_number: context.payload.pull_request.number, + }); + + let infolist = {}; + let infolist_len = 0; + const addToInfolist = (msg) => { + if (!infolist[msg]) { + infolist[msg] = []; + infolist_len++; + } + } + + /* Give advice based on what's in the commit */ + for (const file of files) { + for (const owner of owners) { + if (file.filename.startsWith(owner.path)) { + addToInfolist("> [!IMPORTANT]\n> " + owner.owner + " wants to review changes to " + owner.path + "\n"); + } + } + for (const rule of rules) { + // Consider regexp in the future maybe? + if (file.filename.startsWith(rule.path)) { + if (rule.message.startsWith(":caution: ")) { + addToInfolist("> [!CAUTION]\n> " + rule.path + ": " + rule.message.substring(10) + "\n"); + } else if (rule.message.startsWith(":warning: ")) { + addToInfolist("> [!WARNING]\n> " + rule.path + ": " + rule.message.substring(10) + "\n"); + } else { + addToInfolist("> [!IMPORTANT]\n> " + rule.path + ": " + rule.message + "\n"); + } + } + } + } + /* Check if we've commented before. */ for (const comment of comments) { if (comment.user.login == "github-actions[bot]") { @@ -80,17 +155,28 @@ jobs: } } - if (checklist_len != 0) { - let msg = msg_prefix + - "There " + (checklist_len > 1 ? "are a few issues that need " : "is an issue that needs ") + - "to be fixed:\n"; + const msg_prefix = "Thank you for taking the time to contribute to FreeBSD!\n\n"; + if (checklist_len != 0 || infolist_len != 0) { + let msg = msg_prefix; let comment_func = comment_id == -1 ? github.rest.issues.createComment : github.rest.issues.updateComment; + if (checklist_len != 0) { + msg += + "There " + (checklist_len > 1 ? "are a few issues that need " : "is an issue that needs ") + + "to be resolved:\n"; - /* Loop for each key in "checklist". */ - for (const c in checklist) - msg += "- " + c + " (" + checklist[c].join(", ") + ")\n"; - msg += "\nPlease review [CONTRIBUTING.md](https://github.com/freebsd/freebsd-src/blob/main/CONTRIBUTING.md), then update and push your branch again.\n" - + /* Loop for each key in "checklist". */ + for (const c in checklist) + msg += "- " + c + " (" + checklist[c].join(", ") + ")\n"; + msg += "\n> [!NOTE]\n> Please review [CONTRIBUTING.md](https://github.com/freebsd/freebsd-src/blob/main/CONTRIBUTING.md), then update and push your branch again.\n\n" + } else { + let msg = "No Issues found.\n\n"; + } + if (infolist_len != 0) { + msg += "Some of files have special handling:\n" + for (const i in infolist) + msg += i + "\n"; + msg += "\n\n"; + } comment_func({ owner: context.repo.owner, repo: context.repo.repo,