You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/11/25 09:03:09 UTC
[GitHub] [arrow] pitrou commented on a diff in pull request #14731: ARROW-18380: [Dev] Update dev_pr GitHub workflows to accept both GitHub issues and JIRA
pitrou commented on code in PR #14731:
URL: https://github.com/apache/arrow/pull/14731#discussion_r1032144952
##########
.github/workflows/dev_pr/helpers.js:
##########
@@ -69,8 +72,44 @@ async function getJiraInfo(jiraID) {
});
}
+/**
+ * Retrieves information about a GitHub issue.
+ * @param {String} issueID
+ * @returns {Object} the information about a GitHub issue.
+ */
+ async function getGitHubInfo(github, context, issueID, pullRequestNumber) {
+ try {
+ const response = await github.issues.get({
+ issue_number: issueID,
+ owner: context.repo.owner,
+ repo: context.repo.repo,
+ })
+ return response.data
+ } catch (error) {
+ console.log(`${error.name}: ${error.code}`);
+ return false
+ }
+}
+
+/**
+ * Given the title of a PullRequest checks if it contains a GitHub issue ID
+ * @param {String} title
+ * @returns {Boolean} true if title starts with a GitHub ID or MINOR:
+ */
+ function haveGitHubIssueID(title) {
+ if (!title) {
+ return false;
+ }
+ if (title.startsWith("MINOR: ")) {
+ return true;
+ }
+ return /^(WIP:?\s*)?(GH)-\d+/.test(title);
Review Comment:
Hmm, why not consolidate the id detection functions?
You could have a single function that returns one of these possibilities:
* `{kind: "minor"}`: for a MINOR issue
* `{kind: "jira", id: "ARROW-1234"}`: for JIRA issue ARROW-1234
* `{kind: "github", id: 5678}`: for GH issue 5678
* `null`: if the title failed matching
--
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org