kou commented on code in PR #33615:
URL: https://github.com/apache/arrow/pull/33615#discussion_r1071594063
##########
dev/archery/archery/release/core.py:
##########
@@ -74,68 +90,122 @@ def from_jira(cls, jira_issue):
summary=jira_issue.fields.summary
)
+ @classmethod
+ def from_github(cls, github_issue):
+ original_jira = cls.original_jira_id(github_issue)
+ key = original_jira or github_issue.number
+ return cls(
+ key=key,
+ type=next(
+ iter(
+ [
+ label.name for label in github_issue.labels
+ if label.name.startswith("Type:")
+ ]
+ ), None),
+ summary=github_issue.title,
+ github_issue=github_issue
+ )
+
@property
def project(self):
+ if isinstance(self.key, int):
+ return 'GH'
return self.key.split('-')[0]
@property
def number(self):
- return int(self.key.split('-')[1])
+ if isinstance(self.key, str):
+ return int(self.key.split('-')[1])
+ else:
+ return self.key
+
+ @cached_property
+ def pr(self):
+ if self.is_pr:
+ return self._github_issue.as_pull_request()
+
+ @cached_property
+ def is_pr(self):
+ return bool(self._github_issue and self._github_issue.pull_request)
Review Comment:
I see. I don't object it.
FYI: Reusing this class for Jira issue may not be a good idea. If I
implement this, I'll define `GitHubIssue(Issue)` and `JiraIssue(Issue)` and
`JiraIssue.is_pr` always returns `False`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]