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


##########
.github/workflows/dev_pr_merged.yml:
##########
@@ -0,0 +1,110 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+name: Dev PR merged
+
+on:
+  push:
+    branches:
+      - main
+
+permissions:
+  contents: read
+  issues: write
+
+jobs:
+  update:
+    name: Update issue
+    if: github.repository == 'apache/arrow'
+    runs-on: ubuntu-latest
+    env:
+      GH_REPO: ${{ github.repository }}
+      GH_TOKEN: ${{ github.token }}
+    steps:
+      # GitHub closes the issue of a "GH-XXX: ..." pull request on merge
+      # because of "* GitHub Issue: Closes #XXX" in the pull request
+      # description. The following steps set what GitHub doesn't set:
+      # the assignee and the milestone of the issue.
+      - name: Get issue
+        id: issue
+        env:
+          MESSAGE: ${{ github.event.head_commit.message }}
+        run: |
+          set -euo pipefail
+
+          title=${MESSAGE%%$'\n'*}
+          if [[ ! "${title}" =~ ^GH-([0-9]+) ]]; then
+            echo "No GitHub issue in the commit title: ${title}"
+            exit 0
+          fi
+          issue_number=${BASH_REMATCH[1]}
+          issue=$(gh api "repos/${GH_REPO}/issues/${issue_number}")
+          if [ "$(jq 'has("pull_request")' <<< "${issue}")" = "true" ]; then
+            echo "#${issue_number} is a pull request, not an issue."
+            exit 0
+          fi
+          # The issue is open if the pull request description didn't
+          # have "Closes #XXX", for example for a partial fix.
+          if [ "$(jq -r .state <<< "${issue}")" != "closed" ]; then
+            echo "::notice::#${issue_number} is still open. It isn't updated."
+            exit 0
+          fi
+
+          # The following steps don't run without these outputs.
+          {
+            echo "number=${issue_number}"
+            echo "n_assignees=$(jq '.assignees | length' <<< "${issue}")"
+            echo "has_milestone=$(jq '.milestone != null' <<< "${issue}")"
+          } | tee -a "${GITHUB_OUTPUT}"
+      # Assign the issue to the commit author, who is the pull request
+      # author for a squash merge, if it isn't assigned to anyone.
+      # GitHub ignores this silently if the author can't be assigned.
+      - name: Assign issue
+        if: >-
+          steps.issue.outputs.n_assignees == '0' &&
+          github.event.head_commit.author.username
+        env:
+          AUTHOR: ${{ github.event.head_commit.author.username }}
+          ISSUE_NUMBER: ${{ steps.issue.outputs.number }}
+        run: |
+          gh api "repos/${GH_REPO}/issues/${ISSUE_NUMBER}/assignees" \
+            -f "assignees[]=${AUTHOR}" > /dev/null

Review Comment:
   For the release we don't. We currently extract them from the signed-off-by 
trail. This PR changes how we compute them so assigning issues seems it was 
merely cosmetic.



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

Reply via email to