Skip to content

Commit 04df806

Browse files
committed
Add Team To All Organization Repositories
1 parent 0a794b8 commit 04df806

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

GitHub/Workflows.cls.xml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,27 @@ Protect default branches in organization.<br>
2424
}
2525
]]></Implementation>
2626
</Method>
27+
28+
<Method name="AddTeamToAllOrgRepos">
29+
<Description><![CDATA[
30+
Add team to all organization repositories<br>
31+
<var>Org</var> - name of Organization<br>
32+
<var>TeamId</var> - Id of a team<br>
33+
<var>Username</var> - GitHub user, whois organisation owner<br>
34+
<var>Password</var> - GitHub password, corresponding to Username.<br>]]></Description>
35+
<ClassMethod>1</ClassMethod>
36+
<FormalSpec>Org:%String,TeamId:%String,Username:%String,Password:%String</FormalSpec>
37+
<Implementation><![CDATA[
38+
Set api = ##class(GitHub.API).%New(Username,Password)
39+
#dim repos As List of %ZEN.proxyObject
40+
Set st = api.GetOrgReposNames(Org, "public", .repos)
41+
Write $System.Status.GetErrorText(st)
42+
For i=1:1:repos.Count() {
43+
Set repo = repos.GetAt(i)
44+
Set st = api.AddRepoToTeam(Org, TeamId, repo, "push")
45+
Write repo, " ", $System.Status.GetErrorText(st), !
46+
}
47+
]]></Implementation>
48+
</Method>
2749
</Class>
2850
</Export>

0 commit comments

Comments
 (0)