mirror of
https://codeberg.org/guix/guix.git
synced 2025-10-02 02:15:12 +00:00
teams: ‘sync-codeberg-teams’ associates teams with ‘guix/guix’.
Fixes guix/guix#466. Previously those teams would exist at the organization-level but would not be associated with the ‘guix/guix’ repository, thereby preventing people from adding them as reviewers and from mentioning them. * etc/teams.scm (repository-teams, add-repository-team): New Forgejo requests. (synchronize-teams): Call the latter. Change-Id: Ibc6726cda66552ee9dd1df24d57b80f903712e67
This commit is contained in:
parent
0d0eae1600
commit
82748f595f
1 changed files with 31 additions and 1 deletions
|
@ -326,6 +326,19 @@ PARAMETERS."
|
||||||
"members" user)
|
"members" user)
|
||||||
=> 204)
|
=> 204)
|
||||||
|
|
||||||
|
(define-forgejo-request (repository-teams owner repository)
|
||||||
|
"Return the list of teams assigned to REPOSITORY of OWNER."
|
||||||
|
(GET "repos" owner repository "teams"
|
||||||
|
& '(("limit" . "100"))) ;get up to 100 teams
|
||||||
|
=> 200
|
||||||
|
(lambda (port)
|
||||||
|
(map json->forgejo-team (vector->list (json->scm port)))))
|
||||||
|
|
||||||
|
(define-forgejo-request (add-repository-team owner repository team-name)
|
||||||
|
"Add TEAM-NAME as a team of OWNER's REPOSITORY."
|
||||||
|
(PUT "repos" owner repository "teams" team-name)
|
||||||
|
=> 204)
|
||||||
|
|
||||||
(define (team->forgejo-team team)
|
(define (team->forgejo-team team)
|
||||||
"Return a Forgejo team derived from TEAM, a <team> record."
|
"Return a Forgejo team derived from TEAM, a <team> record."
|
||||||
(forgejo-team (team-id->forgejo-id (team-id team))
|
(forgejo-team (team-id->forgejo-id (team-id team))
|
||||||
|
@ -409,7 +422,24 @@ already exists. Lookup team IDs among CURRENT-TEAMS."
|
||||||
(lambda (team)
|
(lambda (team)
|
||||||
(synchronize-team token team
|
(synchronize-team token team
|
||||||
#:current-teams teams)))
|
#:current-teams teams)))
|
||||||
teams)))
|
teams)
|
||||||
|
|
||||||
|
;; Ensure all the teams are associated with the main repository.
|
||||||
|
(let ((repository-teams (repository-teams token
|
||||||
|
%codeberg-organization
|
||||||
|
"guix")))
|
||||||
|
(for-each (lambda (missing)
|
||||||
|
(format (current-error-port)
|
||||||
|
"adding team '~a' to '~a/guix'~%"
|
||||||
|
(team-id missing) %codeberg-organization)
|
||||||
|
(add-repository-team token %codeberg-organization "guix"
|
||||||
|
(team-id->forgejo-id
|
||||||
|
(team-id missing))))
|
||||||
|
(let ((names (map forgejo-team-name repository-teams)))
|
||||||
|
(remove (lambda (team)
|
||||||
|
(member (team-id->forgejo-id (team-id team))
|
||||||
|
names))
|
||||||
|
teams))))))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue