raulcd commented on code in PR #33615:
URL: https://github.com/apache/arrow/pull/33615#discussion_r1071111356
##########
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)
+
+ @property
+ def components(self):
+ if self._github_issue:
+ return [label for label in self._github_issue.labels
+ if label.name.startswith("Component:")]
+
+ def is_component(self, component_name):
+ if components := self.components:
+ for component in components:
+ if component.name == f"Component: {component_name}":
+ return True
+ return False
Review Comment:
I did use both the PR and components at one point when I was testing things
and thought that there was no harm on keeping them in case we want to improve /
add more functionality to the scripts to have them available but I plan for a
bigger refactor on archery in general an I'll tackle creating a small utility
library around those in the future so I've removed it as it is currently not
used.
--
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]