|
| 1 | +<?xml version="1.0" encoding="UTF-8"?> |
| 2 | +<Export generator="Cache" version="25"> |
| 3 | +<Class name="GitHub.Workflows"> |
| 4 | +<TimeCreated>63914,64417.969689</TimeCreated> |
| 5 | + |
| 6 | +<Method name="ProtectDefaultBranches"> |
| 7 | +<Description><![CDATA[ |
| 8 | +Protect default branches in organization.<br> |
| 9 | +<var>Org</var> - name of Organization<br> |
| 10 | +<var>Username</var> - GitHub user, whois organisation owner<br> |
| 11 | +<var>Password</var> - GitHub password, corresponding to Username.<br>]]></Description> |
| 12 | +<ClassMethod>1</ClassMethod> |
| 13 | +<FormalSpec>Org:%String,Username:%String,Password:%String</FormalSpec> |
| 14 | +<Implementation><![CDATA[ |
| 15 | + Set api = ##class(GitHub.API).%New(Username,Password) |
| 16 | + #dim repos As List of %ZEN.proxyObject |
| 17 | + Set st = api.GetOrgRepos(Org, "public", .repos) |
| 18 | + Write $System.Status.GetErrorText(st) |
| 19 | + For i=1:1:repos.Count() { |
| 20 | + Set repo = repos.GetAt(i).name |
| 21 | + Set branch = repos.GetAt(i)."default_branch" |
| 22 | + Set st = api.ProtectBranch(Org, repo, branch) |
| 23 | + Write repo, " ", $System.Status.GetErrorText(st), ! |
| 24 | + } |
| 25 | +]]></Implementation> |
| 26 | +</Method> |
| 27 | +</Class> |
| 28 | +</Export> |
0 commit comments