diff --git a/github/Deployment.py b/github/Deployment.py index ae7472bb..2c658e76 100644 --- a/github/Deployment.py +++ b/github/Deployment.py @@ -43,6 +43,14 @@ class Deployment(github.GithubObject.CompletableGithubObject): self._completeIfNotSet(self._id) return self._id.value + @property + def ref(self): + """ + :type: string + """ + self._completeIfNotSet(self._ref) + return self._ref.value + @property def url(self): """ @@ -254,6 +262,7 @@ class Deployment(github.GithubObject.CompletableGithubObject): def _initAttributes(self): self._id = github.GithubObject.NotSet self._production_environment = github.GithubObject.NotSet + self._ref = github.GithubObject.NotSet self._transient_environment = github.GithubObject.NotSet self._url = github.GithubObject.NotSet self._sha = github.GithubObject.NotSet @@ -275,6 +284,8 @@ class Deployment(github.GithubObject.CompletableGithubObject): self._production_environment = self._makeBoolAttribute( attributes["production_environment"] ) + if "ref" in attributes: # pragma no branch + self._ref = self._makeStringAttribute(attributes["ref"]) if "transient_environment" in attributes: # pragma no branch self._transient_environment = self._makeBoolAttribute( attributes["transient_environment"] diff --git a/github/Deployment.pyi b/github/Deployment.pyi index d3f34283..9d7cfa49 100644 --- a/github/Deployment.pyi +++ b/github/Deployment.pyi @@ -30,6 +30,8 @@ class Deployment(CompletableGithubObject): @property def sha(self) -> str: ... @property + def ref(self) -> str: ... + @property def task(self) -> str: ... @property def payload(self) -> Dict[str, Any]: ... diff --git a/tests/Deployment.py b/tests/Deployment.py index b0c2fbcb..5ab757e1 100644 --- a/tests/Deployment.py +++ b/tests/Deployment.py @@ -39,6 +39,9 @@ class Deployment(Framework.TestCase): self.deployment.url, "https://api.github.com/repos/jacquev6/PyGithub/deployments/263877258", ) + self.assertEqual( + self.deployment.ref, "743f5a58b0bce91c4eab744ff7e39dfca9e6e8a5" + ) self.assertEqual( self.deployment.sha, "743f5a58b0bce91c4eab744ff7e39dfca9e6e8a5" )