File tree Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change 15
15
# sys.path.insert(0, os.path.abspath('.'))
16
16
17
17
# List all organization extensions
18
+ import os
18
19
import pathlib
19
20
import requests
20
21
21
22
HERE = pathlib .Path (__file__ ).parent
22
23
GET_REPOS = "https://api.github.com/orgs/jupyterlab-contrib/repos"
24
+ TOKEN = os .getenv ("GITHUB_TOKEN" )
23
25
24
26
extensions = (HERE / "extensions.tpl" ).read_text ()
27
+ default_headers = {}
28
+ if TOKEN is not None :
29
+ default_headers ["authorization" ] = f"Bearer { TOKEN } "
30
+
25
31
try :
26
32
repos = requests .get (
27
33
GET_REPOS ,
28
- headers = {"Accept" : "application/vnd.github.v3+json" },
34
+ headers = {** default_headers , "Accept" : "application/vnd.github.v3+json" },
29
35
params = {"per_page" : 100 },
30
36
)
31
37
data = repos .json ()
39
45
try :
40
46
readme = requests .get (
41
47
repo ["contents_url" ].replace ("{+path}" , "README.md" ),
42
- headers = {"Accept" : "application/vnd.github.VERSION.raw" },
48
+ headers = {
49
+ ** default_headers ,
50
+ "Accept" : "application/vnd.github.VERSION.raw" ,
51
+ },
43
52
)
44
53
filename = repo ["name" ]
45
54
(HERE / (filename + ".md" )).write_text (readme .text )
You can’t perform that action at this time.
0 commit comments