Skip to content

Commit 313642a

Browse files
committed
Fix #140: Grab changelog from default branch using github api
1 parent af1170f commit 313642a

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

command_line.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,13 +354,29 @@ def show_error(self, error):
354354
def enable_ui_after_error(self):
355355
pass
356356

357+
def get_default_nwjs_branch(self):
358+
"""
359+
Get the default nwjs branch to search for
360+
the changelog from github.
361+
"""
362+
github_url = self.settings['version_info']['github_api_url']
363+
364+
resp = request.urlopen(github_url)
365+
json_string = resp.read().decode('utf-8')
366+
data = json.loads(json_string)
367+
368+
return data['default_branch']
369+
357370
def get_versions(self):
358371
if self.logger is not None:
359372
self.logger.info('Getting versions...')
360373

361374
union_versions = set()
362375

376+
current_branch = self.get_default_nwjs_branch()
377+
363378
for url in self.settings['version_info']['urls']:
379+
url = url.format(current_branch)
364380
response = request.urlopen(url)
365381
html = response.read().decode('utf-8')
366382

files/settings.cfg

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,4 +307,5 @@ linux_64_dir_prefix = 'node-webkit-v{}-linux-x64'
307307
'force_download']"""
308308

309309
[version_info]
310-
urls="""['https://raw.githubusercontent.com/nwjs/nw.js/nw15/CHANGELOG.md']"""
310+
urls="""['https://raw.githubusercontent.com/nwjs/nw.js/{}/CHANGELOG.md']"""
311+
github_api_url="https://api.github.com/repos/nwjs/nw.js"

0 commit comments

Comments
 (0)