GNU bug report logs -
#78354
[PATCH] teams: Add “codeowners” action.
Previous Next
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
Your message dated Fri, 23 May 2025 13:36:51 +0200
with message-id <875xhr1ru4.fsf <at> gnu.org>
and subject line Re: [bug#78354] [PATCH] teams: Add “codeowners” action.
has caused the debbugs.gnu.org bug report #78354,
regarding [PATCH] teams: Add “codeowners” action.
to be marked as done.
(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)
--
78354: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=78354
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
* etc/teams.scm (team->codeowners-snippet, export-codeowners): New
procedures.
(main): Add “codeowners” action.
* doc/contributing.texi (Teams): Document it.
Change-Id: I601443981af374d85160833f7096d8c973873fb1
---
doc/contributing.texi | 7 +++++++
etc/teams.scm | 31 +++++++++++++++++++++++++++++++
2 files changed, 38 insertions(+)
Hello,
This patch enhances ‘etc/teams.scm’ so it can generate a ‘CODEOWNERS’
file. Forgejo can read that file to direct reviews to the right people.
The result here is a 357-line file, which looks like this:
--8<---------------cut here---------------start------------->8---
gnu/packages/audio\.scm @guix/audio
gnu/packages/commencement\.scm @guix/bootstrap
gnu/packages/mes\.scm @guix/bootstrap
gnu/build-system/cmake\.scm @guix/c++
gnu/build/cmake-build-system\.scm @guix/c++
gnu/packages/c\.scm @guix/c++
gnu/packages/cmake\.scm @guix/c++
gnu/packages/cpp\.scm @guix/c++
gnu/packages/ninja\.scm @guix/c++
gnu/packages/valgrind\.scm @guix/c++
--8<---------------cut here---------------end--------------->8---
Of course we’ll have to create those teams on Codeberg so it can
be on any use.
Ludo’.
diff --git a/doc/contributing.texi b/doc/contributing.texi
index f62939dc44..e98407edfd 100644
--- a/doc/contributing.texi
+++ b/doc/contributing.texi
@@ -2733,6 +2733,13 @@ Teams
[env]$ git send-email --to=@var{ISSUE_NUMBER}@@debbugs.gnu.org -2
@end example
+To generate a @file{CODEOWNERS} file, which Forgejo uses to determine
+which team or person should review changes to a given set of files, run:
+
+@example
+./etc/teams.scm codeowners > CODEOWNERS
+@end example
+
@node Making Decisions
@section Making Decisions
diff --git a/etc/teams.scm b/etc/teams.scm
index 17b5d4d1fe..5d5e104a48 100755
--- a/etc/teams.scm
+++ b/etc/teams.scm
@@ -14,6 +14,7 @@
;;; Copyright © 2022 Simon Tournier <zimon.toutoune <at> gmail.com>
;;; Copyright © 2025 Jelle Licht <jlicht <at> fsfe.org>
;;; Copyright © 2025 Cayetano Santos <csantosb <at> inventati.org>
+;;; Copyright © 2025 Ludovic Courtès <ludo <at> gnu.org>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -1016,6 +1017,34 @@ (define (patch->teams patch-file)
(find-team-by-scope (apply diff-revisions
(git-patch->revisions patch-file)))))
+(define (team->codeowners-snippet team)
+ (string-join (map (lambda (scope)
+ (format #f "~50a @guix/~a"
+ (if (regexp*? scope)
+ (regexp*-pattern scope)
+ (regexp-quote scope))
+ (team-id team)))
+ (team-scope team))
+ "\n"
+ 'suffix))
+
+(define (export-codeowners port)
+ (let ((teams (sort-teams
+ (hash-map->list (lambda (_ value) value) %teams))))
+ (display "\
+# This -*- conf -*- file was generated by './etc/teams.scm codeowners'.
+#
+# It describes the expected reviewers for a pull request based on the
+# changed files. Unlike what the name of the file suggests they don't
+# own the code (ownership is collective in this house!) but merely have
+# a good understanding of that area of the codebase and therefore are
+# usually suited as a reviewer.\n\n"
+ port)
+ (for-each (lambda (team)
+ (display (team->codeowners-snippet team) port)
+ (newline port))
+ teams)))
+
(define (main . args)
(match args
@@ -1049,6 +1078,8 @@ (define (main . args)
team-names))
(("show" . team-names)
(list-teams team-names))
+ (("codeowners")
+ (export-codeowners (current-output-port)))
(anything
(format (current-error-port)
"Usage: etc/teams.scm <command> [<args>]
base-commit: 2e1ead7c8b449b58d571d8f16c1586b675c13ab4
--
2.49.0
[Message part 3 (message/rfc822, inline)]
Maxim Cournoyer <maxim.cournoyer <at> gmail.com> writes:
> Ludovic Courtès <ludo <at> gnu.org> writes:
>
>> * etc/teams.scm (team->codeowners-snippet, export-codeowners): New
>> procedures.
>> (main): Add “codeowners” action.
>> * doc/contributing.texi (Teams): Document it.
>>
>> Change-Id: I601443981af374d85160833f7096d8c973873fb1
>
> Glad to see some use can be salvaged from etc/teams.scm. LGTM!
>
> Reviewed-by: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
Pushed as 8dff81313876a54519ce17e9fda64d4310e2dd5c.
Ludo’.
This bug report was last modified 23 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.