diff --git a/frappe/utils/change_log.py b/frappe/utils/change_log.py
index ed9f02fd6d..ff512dbe6a 100644
--- a/frappe/utils/change_log.py
+++ b/frappe/utils/change_log.py
@@ -131,24 +131,10 @@ def check_for_update():
apps = get_versions()
for app in apps:
- # Check if repo remote is on github
- remote_url = subprocess.check_output("cd ../apps/{} && git ls-remote --get-url".format(app), shell=True)
- if "github.com" not in remote_url:
- continue
-
- # Get latest version from github
- if 'https' not in remote_url:
- continue
-
- org_name = remote_url.split('/')[3]
- r = requests.get('https://api.github.com/repos/{}/{}/releases'.format(org_name, app))
- if r.status_code == 200 and r.json():
- # 0 => latest release
- github_version = Version(r.json()[0]['tag_name'].strip('v'))
- else:
- # In case of an improper response or if there are no releases
- continue
+ app_details = check_release_on_github(app)
+ if not app_details: continue
+ github_version, org_name = app_details
# Get local instance's current version or the app
instance_version = Version(apps[app]['version'])
# Compare and popup update message
@@ -163,6 +149,28 @@ def check_for_update():
))
break
+ generate_update_message(updates)
+
+def check_release_on_github(app):
+ # Check if repo remote is on github
+ remote_url = subprocess.check_output("cd ../apps/{} && git ls-remote --get-url".format(app), shell=True)
+ if "github.com" not in remote_url:
+ return None
+
+ # Get latest version from github
+ if 'https' not in remote_url:
+ return None
+
+ org_name = remote_url.split('/')[3]
+ r = requests.get('https://api.github.com/repos/{}/{}/releases'.format(org_name, app))
+ if r.status_code == 200 and r.json():
+ # 0 => latest release
+ return Version(r.json()[0]['tag_name'].strip('v')), org_name
+ else:
+ # In case of an improper response or if there are no releases
+ return None
+
+def generate_update_message(updates):
update_message = ""
for update_type in updates:
release_links = ""
@@ -176,20 +184,25 @@ def check_for_update():
if release_links:
update_message += "New {} releases for the following apps are available:
{}