[sysadmin-bin] Only attempt keeping up-to-date an existing GitHub repository



commit 387e69b4adac7bff80132056c213de083e649162
Author: Andrea Veri <averi redhat com>
Date:   Mon Dec 10 12:01:46 2018 +0100

    Only attempt keeping up-to-date an existing GitHub repository

 git/post-receive-mirror-github | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)
---
diff --git a/git/post-receive-mirror-github b/git/post-receive-mirror-github
index 9a09459..9c91e35 100755
--- a/git/post-receive-mirror-github
+++ b/git/post-receive-mirror-github
@@ -164,18 +164,19 @@ def main():
     if repo_name.endswith('.wiki'):
         sys.exit(1)
 
-    github_name = gh.normalize_name(repo_name)
-    description, homepage = gh.fetch_github_repo(github_name)
     settings = get_repo_settings(repo_name)
 
-    if description != settings["description"]:
-        gh.update_github_repo(github_name, 'description', settings["description"])
-
-    if homepage != settings["homepage"]:
-        gh.update_github_repo(github_name, 'homepage', settings["homepage"])
-
     if not gh.check_if_repo_exists(repo_name):
         gh.create_github_repo(settings["name"], settings["description"], settings["homepage"])
+    else:
+        github_name = gh.normalize_name(repo_name)
+        description, homepage = gh.fetch_github_repo(github_name)
+
+        if description != settings["description"]:
+            gh.update_github_repo(github_name, 'description', settings["description"])
+
+        if homepage != settings["homepage"]:
+            gh.update_github_repo(github_name, 'homepage', settings["homepage"])
     
     for organization in [gh.organization] + ADDITIONAL_ORGANIZATIONS.get(repo_name, []):
         try:


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]