Skip to content

Commit 1bc12cb

Browse files
committed
bugfix in set_all_updated_pull_requests_docker_testbot_pending
1 parent b36a449 commit 1bc12cb

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

obspy_github_api/obspy_github_api.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -114,22 +114,26 @@ def get_pull_requests(state="open", sort="updated", direction="desc"):
114114
return prs
115115

116116

117-
def get_commit_status(commit, context=None):
117+
def get_commit_status(commit, context=None, fork='obspy'):
118118
"""
119119
Return current commit status. Either for a specific context, or overall.
120120
121121
:type commit: str
122+
:param commit: Commit SHA.
122123
:type context: str
123124
:param context: Commit status context (as a str) or ``None`` for overall
124125
commit status.
126+
:type fork: str
127+
:param fork: Obspy fork for commit (for commits on pull requests, 'obspy'
128+
should also work for commits on forks).
125129
:rtype: str or ``None``
126130
:returns: Current commit status (overall or for specific context) as a
127131
string or ``None`` if given context has no status.
128132
"""
129133
# github3.py seems to lack support for fetching the "current" statuses for
130134
# all contexts.. (which is available in "combined status" for an SHA
131135
# through github API)
132-
repo = gh.repository("obspy", "obspy")
136+
repo = gh.repository(fork, "obspy")
133137
commit = repo.commit(commit)
134138
statuses = {}
135139
for status in commit.statuses():
@@ -284,10 +288,10 @@ def set_all_updated_pull_requests_docker_testbot_pending(verbose=False):
284288
open_prs = get_pull_requests(state="open")
285289
if verbose:
286290
print("Working on PRs: " + ", ".join(
287-
[str(number) for number, _, _, _, _ in open_prs]))
288-
for number, fork, branch, commit, data in open_prs:
291+
[str(pr.number) for pr in open_prs]))
292+
for pr in open_prs:
289293
set_commit_status(
290-
commit=commit, status="pending", context="docker-testbot",
294+
commit=pr.commit, status="pending", context="docker-testbot",
291295
description="docker testbot results not available yet",
292296
only_when_no_status_yet=True,
293297
verbose=verbose)

0 commit comments

Comments
 (0)