diff --git a/sample.redhat-ci.yml b/sample.redhat-ci.yml index 01bf5fe..c3a343b 100644 --- a/sample.redhat-ci.yml +++ b/sample.redhat-ci.yml @@ -111,13 +111,12 @@ context: 'CI Tester' # OPTIONAL # Mark this testsuite as required. This causes a special -# "required" context to be reported to GitHub on branch -# tests. The result is set to successful only if all -# testsuites marked as required are also successful. This is -# useful for integration with merge bots, so that they only -# need to watch for a single status rather than multiple -# (possibly changing) statuses. If omitted, defaults to -# false. +# "required" context to be reported to GitHub. The result is +# set to successful only if all testsuites marked as +# required are also successful. This is useful for +# integration with merge bots, so that they only need to +# watch for a single status rather than multiple (possibly +# changing) statuses. If omitted, defaults to false. required: true # OPTIONAL diff --git a/spawner.py b/spawner.py index 033653c..023f142 100755 --- a/spawner.py +++ b/spawner.py @@ -153,9 +153,14 @@ def count_failures(suites): def update_required_context(suites): - # only send 'required' context for branches if 'github_pull_id' in os.environ: - return + fallback_url = ('https://github.com/%s/pull/%s' % + (os.environ['github_repo'], + os.environ['github_pull_id'])) + else: + fallback_url = ('https://github.com/%s/commits/%s' % + (os.environ['github_repo'], + os.environ['github_branch'])) # don't send 'required' context if we're only targeting some testsuites if 'github_contexts' in os.environ: @@ -178,10 +183,9 @@ def update_required_context(suites): url = f.read().strip() else: # Something went really wrong in the tester. Just link back to the - # branch for now, though we should probably just capture the same - # text we used to update the commit status. - url = ('https://github.com/%s/commits/%s' % - (os.environ['github_repo'], os.environ['github_branch'])) + # branch/PR for now, though we should probably just capture the + # same text we used to update the commit status. + url = fallback_url result = (suite['rc'] == 0) results_suites.append((name, result, url))