forked from toolshed/abra-bash
		
	Add mirroring script
This commit is contained in:
		| @ -28,7 +28,6 @@ RUN chmod +x ~/.abra/vendor/yq | |||||||
| # otherwise give us the latest abra on the latest tag | # otherwise give us the latest abra on the latest tag | ||||||
| RUN curl https://install.abra.coopcloud.tech | bash -s -- --dev | RUN curl https://install.abra.coopcloud.tech | bash -s -- --dev | ||||||
|  |  | ||||||
| COPY bin/abralib.py /root/.local/bin/abralib.py | COPY bin/* /root/.local/bin/ | ||||||
| COPY bin/app-json.py /root/.local/bin/app-json.py |  | ||||||
|  |  | ||||||
| ENTRYPOINT ["/root/.local/bin/abra"] | ENTRYPOINT ["/root/.local/bin/abra"] | ||||||
|  | |||||||
| @ -18,6 +18,7 @@ REPOS_TO_SKIP = ( | |||||||
|     "abra-gandi", |     "abra-gandi", | ||||||
|     "abra-hetzner", |     "abra-hetzner", | ||||||
|     "auto-apps-json", |     "auto-apps-json", | ||||||
|  |     "auto-mirror", | ||||||
|     "backup-bot", |     "backup-bot", | ||||||
|     "coopcloud.tech", |     "coopcloud.tech", | ||||||
|     "coturn", |     "coturn", | ||||||
|  | |||||||
							
								
								
									
										41
									
								
								bin/github-sync.py
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										41
									
								
								bin/github-sync.py
									
									
									
									
									
										Executable file
									
								
							| @ -0,0 +1,41 @@ | |||||||
|  | #!/usr/bin/env python3 | ||||||
|  |  | ||||||
|  | # Usage: ./github-sync.py | ||||||
|  | # | ||||||
|  | # Mirror repositories to Github (Fuck M$, get it straight) | ||||||
|  |  | ||||||
|  | from os import chdir, listdir | ||||||
|  |  | ||||||
|  | from abralib import ( | ||||||
|  |     CLONES_PATH, | ||||||
|  |     REPOS_TO_SKIP, | ||||||
|  |     _run_cmd, | ||||||
|  |     clone_all_apps, | ||||||
|  |     get_repos_json, | ||||||
|  |     log, | ||||||
|  | ) | ||||||
|  |  | ||||||
|  |  | ||||||
|  | def main(): | ||||||
|  |     """Run the script.""" | ||||||
|  |     repos_json = get_repos_json() | ||||||
|  |     clone_all_apps(repos_json) | ||||||
|  |  | ||||||
|  |     for app in listdir(CLONES_PATH): | ||||||
|  |         if app in REPOS_TO_SKIP: | ||||||
|  |             log.info(f"Skipping {app}") | ||||||
|  |             continue | ||||||
|  |  | ||||||
|  |         app_path = f"{CLONES_PATH}/{app}" | ||||||
|  |         chdir(app_path) | ||||||
|  |  | ||||||
|  |         log.info(f"Mirroring {app}...") | ||||||
|  |  | ||||||
|  |         _run_cmd( | ||||||
|  |             f"git remote add github git@github.com:Autonomic-Cooperative/{app}.git || true", | ||||||
|  |             shell=True, | ||||||
|  |         ) | ||||||
|  |         _run_cmd("git push github --all") | ||||||
|  |  | ||||||
|  |  | ||||||
|  | main() | ||||||
		Reference in New Issue
	
	Block a user