]> gitweb.factorcode.org Git - factor.git/commitdiff
github: add some more github api calls
authorDoug Coleman <doug.coleman@gmail.com>
Tue, 18 Apr 2023 01:54:58 +0000 (20:54 -0500)
committerDoug Coleman <doug.coleman@gmail.com>
Tue, 18 Apr 2023 01:54:58 +0000 (20:54 -0500)
extra/github/github.factor

index c22c15d230800721a2f138c9bb997e00b2fd7227..be0f1becc4427c2c606f7b5f7231234aa1ba11ac 100644 (file)
@@ -73,12 +73,34 @@ SYMBOL: github-token
 : list-repository-tags ( owner repo -- seq )
     "/repos/%s/%s/tags" sprintf github-get ;
 
+: list-repository-tags-all ( owner repo -- seq )
+    "/repos/%s/%s/git/refs/tags" sprintf github-get ;
+
+: list-repository-branches-matching ( owner repo ref -- seq )
+    "/repos/%s/%s/git/matching-refs/heads/%s" sprintf github-get ;
+
+: list-repository-tags-matching ( owner repo ref -- seq )
+    "/repos/%s/%s/git/matching-refs/tags/%s" sprintf github-get ;
+
 : list-repository-teams ( owner repo -- seq )
     "/repos/%s/%s/teams" sprintf github-get ;
 
 : list-repository-topics ( owner repo -- seq )
     "/repos/%s/%s/topics" sprintf github-get ;
 
+: github-file* ( owner repo path -- meta contents )
+    "/repos/%s/%s/contents/%s" sprintf github-get
+    dup "download_url" of http-get nip ;
+
+: github-file ( owner repo path -- contents )
+    github-file* nip ;
+
+: github-code-search ( query -- seq )
+    "/search/code?q=%s" sprintf github-get ;
+
+: github-factor-code-search ( query -- seq )
+    "/search/code?q=%s+language:factor" sprintf github-get ;
+
 : check-enabled-vulnerability-alerts ( owner repo -- json )
     "/repos/%s/%s/vulnerability-alerts" sprintf github-get-code ;