diff --git a/plexpy/versioncheck.py b/plexpy/versioncheck.py index 1d459d56..a36d0f9f 100644 --- a/plexpy/versioncheck.py +++ b/plexpy/versioncheck.py @@ -223,10 +223,11 @@ def check_github(scheduler=False, notify=False, use_cache=False): commits = github_cache('commits', use_cache=use_cache) if not commits: logger.info('Comparing currently installed version with latest GitHub version') + # Need to compare CURRENT << LATEST to get a list of commits url = 'https://api.github.com/repos/%s/%s/compare/%s...%s' % (plexpy.CONFIG.GIT_USER, plexpy.CONFIG.GIT_REPO, - plexpy.LATEST_VERSION, - plexpy.CURRENT_VERSION) + plexpy.CURRENT_VERSION, + plexpy.LATEST_VERSION) commits = request.request_json(url, headers=headers, timeout=20, whitelist_status_code=404, validator=lambda x: type(x) == dict) github_cache('commits', github_data=commits) @@ -236,8 +237,20 @@ def check_github(scheduler=False, notify=False, use_cache=False): return plexpy.LATEST_VERSION try: - plexpy.COMMITS_BEHIND = int(commits['behind_by']) - logger.debug("In total, %d commits behind", plexpy.COMMITS_BEHIND) + ahead_by = int(commits['ahead_by']) + logger.debug("In total, %d commits behind", ahead_by) + + # Do not count [skip ci] commits for Docker or Snap on the nightly branch + if (plexpy.DOCKER or plexpy.SNAP) and plexpy.CONFIG.GIT_BRANCH == 'nightly': + for commit in reversed(commits['commits']): + if '[skip ci]' not in commit['commit']['message']: + plexpy.LATEST_VERSION = commit['sha'] + break + ahead_by -= 1 + install = 'Docker container' if plexpy.DOCKER else 'Snap package' + logger.debug("%s %d commits behind", install, ahead_by) + + plexpy.COMMITS_BEHIND = ahead_by except KeyError: logger.info('Cannot compare versions. Are you running a local development version?') plexpy.COMMITS_BEHIND = 0