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 15:50:46 UTC

[GitHub] [arrow] raulcd commented on a diff in pull request #14731: ARROW-18380: [Dev] Update dev_pr GitHub workflows to accept both GitHub issues and JIRA

raulcd commented on code in PR #14731:
URL: https://github.com/apache/arrow/pull/14731#discussion_r1032566976


##########
.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:
   I've refactored everything on `detectIssue` which returns the structure suggested.



-- 
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