Skip to content

Commit 2c79610

Browse files
committed
get archive added
1 parent 6655c77 commit 2c79610

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

src/cls/GitHub/API.cls

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ Method MirrorAll(Directory As %String = {..#Directory}) As %Status
225225
Set ownerto = mirror.to
226226
Set org = mirror.org
227227
Set repos = mirror.repos
228-
228+
229229
for j=0:1:repos.%Size()-1
230230
{
231231
Set repo = repos.%Get(j)_".git"
@@ -337,7 +337,6 @@ Method MirrorReleases(OwnerFrom As %String, OwnerTo As %String, Repo As %String)
337337
Set st = ..GetReleasesList(OwnerTo, Repo, .releasesTo)
338338

339339
set count = releases.Count()-releasesTo.Count()
340-
341340

342341
For i=1:1:count
343342
{
@@ -530,6 +529,22 @@ ClassMethod UpdateMirrorReposInDirectory(Directory As %String = {..#Directory})
530529
return st
531530
}
532531

532+
/// ArchiveFormat - Can be either tarball or zipball. Default: tarball
533+
/// Ref - A valid Git reference. Default: the repository’s default branch (usually master)
534+
Method GetArchive(Owner As %String, Repo As %String, ArchiveFormat As %String = "tarball", Ref As %String = "master", Filename As %String) As %Status
535+
{
536+
Set ..Request.Location = "/repos/"_Owner_"/"_Repo_"/"_ArchiveFormat_"/"_Ref
537+
538+
Set st = ..Request.Get()
539+
540+
Set file = ##class(%Stream.FileBinary).%New()
541+
Set file.Filename = Filename
542+
543+
Set st = file.CopyFromAndSave(..Request.HttpResponse.Data)
544+
545+
Return st
546+
}
547+
533548
Method test(test)
534549
{
535550
zw

0 commit comments

Comments
 (0)