Skip to content

Commit 798e215

Browse files
add option to use tokens
1 parent 7eb8c88 commit 798e215

1 file changed

Lines changed: 18 additions & 1 deletion

File tree

github_scripts/rose_stem_extract_source.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,20 +18,37 @@
1818
from typing import Dict
1919

2020

21+
def set_https(dependencies: Dict) -> Dict:
22+
"""
23+
Change sources in a dependencies dictions to use https instead of ssh
24+
"""
25+
26+
for dependency in dependencies:
27+
if dependency["source"].startswith("git@github.com:"):
28+
dependencies[dependency]["source"].replace(
29+
"git@github.com:", "https://github.com/"
30+
)
31+
32+
return dependencies
33+
34+
2135
def main() -> None:
2236

2337
clone_loc = Path(os.environ["SOURCE_DIRECTORY"])
2438

2539
dependencies: Dict = literal_eval(os.environ["DEPENDENCIES"])
2640

41+
if os.environ.get("USE_TOKENS", "False") == "True":
42+
dependencies = set_https(dependencies)
43+
2744
for dependency, values in dependencies.items():
2845

2946
print(f"Extracting {dependency} at time {datetime.now()}")
3047

3148
loc = clone_loc / dependency
3249

3350
if ".git" in values["source"]:
34-
if os.environ["USE_MIRRORS"] == "True":
51+
if os.environ.get("USE_MIRRORS", "False") == "True":
3552
mirror_loc = Path(os.environ["GIT_MIRROR_LOC"]) / values["parent"]
3653
clone_repo_mirror(
3754
values["source"], values["ref"], values["parent"], mirror_loc, loc

0 commit comments

Comments
 (0)