@@ -47,17 +47,17 @@ declare namespace json = "http://www.json.org";
4747(: Set up global variables :)
4848declare variable $gitcommit:authorization-token := '${github-pat}' ;
4949declare variable $gitcommit:apiURL := 'https://api.github.com' ;
50- declare variable $gitcommit:owner := if (request:get-parameter ('githubOwner' ,'' ) != '' ) then request:get-parameter ('githubOwner' ,'' ) else 'wsalesky ' ;
51- declare variable $gitcommit:repoName := if (request:get-parameter ('githubRepoName' ,'' ) != '' ) then request:get-parameter ('githubRepoName' ,'' ) else 'blogs ' ;
52- declare variable $gitcommit:branch := if (request:get-parameter ('githubBranch' ,'' ) != '' ) then request:get-parameter ('githubBranch' ,'' ) else 'master ' ;
50+ declare variable $gitcommit:owner := if (request:get-parameter ('githubOwner' ,'' ) != '' ) then request:get-parameter ('githubOwner' ,'' ) else 'majlis-erc ' ;
51+ declare variable $gitcommit:repoName := if (request:get-parameter ('githubRepoName' ,'' ) != '' ) then request:get-parameter ('githubRepoName' ,'' ) else 'majlis-data ' ;
52+ declare variable $gitcommit:branch := if (request:get-parameter ('githubBranch' ,'' ) != '' ) then request:get-parameter ('githubBranch' ,'' ) else 'main ' ;
5353declare variable $gitcommit:dataPath := if (request:get-parameter ('githubPath' ,'' ) != '' ) then request:get-parameter ('githubPath' ,'' ) else 'data/tei/' ;
5454
5555declare function gitcommit:list-files (){
56- (:https://github.com/wsalesky/blogs :)
57- (: https://api.github.com/ repos/octocat/hello-world/autolinks/42 :)
58- (:Step 1: /repos/{ owner}/{repo} /contents/{path} : )
56+ (: https://docs. github.com/en/rest/repos/contents?apiVersion=2022-11-28#get-repository-content :)
57+ (: Step 1: / repos/{owner}/{repo}/contents/{path}?ref=branch :)
58+ let $uri := xs:anyURI ( concat ($gitcommit:apiURL, ' /repos/' , $gitcommit: owner, '/' , $gitcommit:repoName, ' /contents/' , $gitcommit:dataPath, "?ref=" , $gitcommit:branch) )
5959 let $request :=
60- http:send-request (<http:request http-version = "1.1" href = "{xs:anyURI ( concat ($gitcommit:apiURL, '/repos/' ,$gitcommit:owner, '/' ,$gitcommit:repoName, '/contents/' ,$gitcommit:branch)) } " method = "get" >
60+ http:send-request (<http:request http-version = "1.1" href = "{$uri } " method = "get" >
6161 <http:header name = "Authorization" value = "{concat ('token ' ,$gitcommit:authorization-token)} " />
6262 <http:header name = "Connection" value = "close" />
6363 </http:request>)
0 commit comments