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/28 16:21:45 UTC

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

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


##########
.github/workflows/dev_pr/issue_check.js:
##########
@@ -78,11 +102,73 @@ async function commentNotStartedTicket(github, context, pullRequestNumber) {
     }
 }
 
+/**
+ * Assigns the Github Issue to the PR creator.
+ *
+ * @param {Object} github
+ * @param {Object} context
+ * @param {String} pullRequestNumber
+ * @param {Object} issueInfo
+ */
+async function assignGitHubIssue(github, context, pullRequestNumber, issueInfo) {
+    await github.issues.addAssignees({
+        owner: context.repo.owner,
+        repo: context.repo.repo,
+        issue_number: issueInfo.number,
+        assignees: context.payload.pull_request.user.login
+    });
+    await github.issues.createComment({
+        owner: context.repo.owner,
+        repo: context.repo.repo,
+        issue_number: pullRequestNumber,
+        body: ":warning: GitHub issue #" + issueInfo.number + " **has been automatically assigned in GitHub** to PR creator."
+    });
+}
+
+/**
+ * Performs checks on the GitHub Issue:
+ * - The issue is assigned to someone. If not assign it gets automatically
+ *   assigned to the PR creator.
+ * - The issue contains any label.
+ *
+ * @param {Object} github
+ * @param {Object} context
+ * @param {String} pullRequestNumber
+ * @param {String} issueID
+ */
+async function verifyGitHubIssue(github, context, pullRequestNumber, issueID) {
+    const issueInfo = await helpers.getGitHubInfo(github, context, issueID, pullRequestNumber);
+    if (issueInfo) {
+        if (!issueInfo.assignees.length) {
+            await assignGitHubIssue(github, context, pullRequestNumber, issueInfo);
+        }
+        if(!issueInfo.labels.length) {

Review Comment:
   I would maybe handle this later / separately? I didn't yet rename existing labels in the assumption that those are used by existing workflows as well that would have to be updated (i.e. labeler.yml). Although that would probably an easy PR to make to rename the labels in labeler.yml
   



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