From 4c3ae91e984e4f0cf9490c27a5ccd6e9d69c09cd Mon Sep 17 00:00:00 2001 From: lethosor Date: Sun, 14 Jun 2015 11:54:25 -0400 Subject: [PATCH] Respect TRAVIS_REPO_SLUG environment variable when checking PRs --- travis/pr-check-base.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/travis/pr-check-base.py b/travis/pr-check-base.py index e4e9ae910..e31e33bcf 100644 --- a/travis/pr-check-base.py +++ b/travis/pr-check-base.py @@ -5,14 +5,18 @@ else: from urllib.request import urlopen from urllib.error import HTTPError try: + repo = os.environ.get('TRAVIS_REPO_SLUG', 'dfhack/dfhack').lower() pr_id = int(os.environ.get('TRAVIS_PULL_REQUEST', 'false')) except ValueError: print('Not a pull request') sys.exit(0) -print('Pull request %i' % pr_id) +print('Pull request %s#%i' % (repo, pr_id)) +if repo != 'dfhack/dfhack': + print('Not in dfhack/dfhack') + sys.exit(0) res = {} try: - res = json.loads(urlopen('https://api.github.com/repos/dfhack/dfhack/pulls/%i' % pr_id).read().decode('utf-8')) + res = json.loads(urlopen('https://api.github.com/repos/%s/pulls/%i' % (repo, pr_id)).read().decode('utf-8')) except ValueError: pass except HTTPError: