mirror of
https://https.git.savannah.gnu.org/git/guix.git/
synced 2025-07-10 08:30:39 +02:00
teams: Add “codeowners” action.
* etc/teams.scm (team->codeowners-snippet, export-codeowners): New procedures. (main): Add “codeowners” action. * doc/contributing.texi (Teams): Document it. Change-Id: I601443981af374d85160833f7096d8c973873fb1
This commit is contained in:
parent
3b6e499d5e
commit
8dff813138
2 changed files with 38 additions and 0 deletions
|
@ -2733,6 +2733,13 @@ $ guix shell -D guix
|
|||
[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
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@ exec $pre_inst_env_maybe guix repl -- "$0" "$@"
|
|||
;;; Copyright © 2022 Simon Tournier <zimon.toutoune@gmail.com>
|
||||
;;; Copyright © 2025 Jelle Licht <jlicht@fsfe.org>
|
||||
;;; Copyright © 2025 Cayetano Santos <csantosb@inventati.org>
|
||||
;;; Copyright © 2025 Ludovic Courtès <ludo@gnu.org>
|
||||
;;;
|
||||
;;; This file is part of GNU Guix.
|
||||
;;;
|
||||
|
@ -1023,6 +1024,34 @@ and REV-END, two git revision strings."
|
|||
(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
|
||||
|
@ -1056,6 +1085,8 @@ and REV-END, two git revision strings."
|
|||
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>]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue