Skip to content

Commit

Permalink
Implement Github CI status
Browse files Browse the repository at this point in the history
  • Loading branch information
ye11ow committed Jan 23, 2020
1 parent 85e9409 commit d243ad1
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions noti.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,12 +186,13 @@ def get_mrs(self):
repo = self._gh.get_repo(repo_name)
pulls = repo.get_pulls(state='open', sort='created', base='master')
for pr in pulls:
mrs.append(GithubPR(pr))
mrs.append(GithubPR(repo, pr))

return mrs

class GithubPR:
def __init__(self, pr):
def __init__(self, repo, pr):
self._repo = repo
self._pr = pr

@property
Expand All @@ -200,7 +201,11 @@ def ci_failed(self):

@property
def ci_status(self):
return 'success'
if not hasattr(self, '_status'):
sha = self._pr.head.sha
self._status = self._repo.get_commit(sha).get_combined_status()

return self._status.state

@property
def failed_pipeline_jobs(self):
Expand Down

0 comments on commit d243ad1

Please sign in to comment.