Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WorkflowRun] - Add missing attributes (run_started_at & run_attempt), remove deprecated unicode type #2273

Merged
merged 3 commits into from Oct 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
27 changes: 27 additions & 0 deletions github/WorkflowRun.py
Expand Up @@ -60,6 +60,14 @@ def head_sha(self):
self._completeIfNotSet(self._head_sha)
return self._head_sha.value

@property
def run_attempt(self):
"""
:type: integer
"""
self._completeIfNotSet(self._run_attempt)
return self._run_attempt.value

@property
def run_number(self):
"""
Expand All @@ -76,6 +84,14 @@ def event(self):
self._completeIfNotSet(self._event)
return self._event.value

@property
def run_started_at(self):
"""
:type: datetime.datetime
"""
self._completeIfNotSet(self._run_started_at)
return self._run_started_at.value

@property
def status(self):
"""
Expand Down Expand Up @@ -266,8 +282,10 @@ def _initAttributes(self):
self._id = github.GithubObject.NotSet
self._head_branch = github.GithubObject.NotSet
self._head_sha = github.GithubObject.NotSet
self._run_attempt = github.GithubObject.NotSet
self._run_number = github.GithubObject.NotSet
self._event = github.GithubObject.NotSet
self._run_started_at = github.GithubObject.NotSet
self._status = github.GithubObject.NotSet
self._conclusion = github.GithubObject.NotSet
self._workflow_id = github.GithubObject.NotSet
Expand All @@ -294,10 +312,19 @@ def _useAttributes(self, attributes):
self._head_branch = self._makeStringAttribute(attributes["head_branch"])
if "head_sha" in attributes: # pragma no branch
self._head_sha = self._makeStringAttribute(attributes["head_sha"])
if "run_attempt" in attributes: # pragma no branch
self._run_attempt = self._makeIntAttribute(attributes["run_attempt"])
if "run_number" in attributes: # pragma no branch
self._run_number = self._makeIntAttribute(attributes["run_number"])
if "event" in attributes: # pragma no branch
self._event = self._makeStringAttribute(attributes["event"])
if "run_started_at" in attributes: # pragma no branch
assert attributes["run_started_at"] is None or isinstance(
attributes["run_started_at"], str
), attributes["run_started_at"]
self._run_started_at = self._makeDatetimeAttribute(
attributes["run_started_at"]
)
if "status" in attributes: # pragma no branch
self._status = self._makeStringAttribute(attributes["status"])
if "conclusion" in attributes: # pragma no branch
Expand Down
2 changes: 1 addition & 1 deletion scripts/add_attribute.py
Expand Up @@ -55,7 +55,7 @@
),
"datetime": (
"datetime.datetime",
"(str, unicode)",
"str",
'self._makeDatetimeAttribute(attributes["' + attributeName + '"])',
),
"class": (
Expand Down
4 changes: 2 additions & 2 deletions tests/ReplayData/ExposeAllAttributes.testAllClasses.txt

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion tests/ReplayData/PullRequest.testGetFiles.txt

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion tests/ReplayData/PullRequestFile.setUp.txt

Large diffs are not rendered by default.