From 066044cd7da0e6bf3652f5eb79be9716193fe962 Mon Sep 17 00:00:00 2001 From: Ben Crocker Date: Sat, 12 Jun 2021 21:01:30 -0400 Subject: [PATCH] Support using the merge ref instead of the head ref in a pull request Add merge_commit_sha and mergeable properties to GithubPullRequest class (and PullRequest superclass). OGR issue #584. Signed-off-by: Ben Crocker --- ogr/abstract.py | 8 ++++++++ ogr/services/github/pull_request.py | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/ogr/abstract.py b/ogr/abstract.py index adeba5158..05ad37372 100644 --- a/ogr/abstract.py +++ b/ogr/abstract.py @@ -404,6 +404,14 @@ def patch(self) -> bytes: def head_commit(self) -> str: raise NotImplementedError + @property + def merge_commit_sha(self) -> str: + raise NotImplementedError + + @property + def mergeable(self) -> bool: + raise NotImplementedError + @property def source_project(self) -> "GitProject": raise NotImplementedError() diff --git a/ogr/services/github/pull_request.py b/ogr/services/github/pull_request.py index 40dfd325f..645a47c82 100644 --- a/ogr/services/github/pull_request.py +++ b/ogr/services/github/pull_request.py @@ -109,6 +109,14 @@ def commits_url(self) -> str: def head_commit(self) -> str: return self._raw_pr.head.sha + @property + def merge_commit_sha(self) -> str: + return self._raw_pr.merge_commit_sha + + @property + def mergeable(self) -> bool: + return self._raw_pr.mergeable + @property def source_project(self) -> "ogr_github.GithubProject": if self._source_project is None: