You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beam.apache.org by da...@apache.org on 2022/06/24 13:52:51 UTC

[beam] branch master updated: Enable close issue as not planned (#22032)

This is an automated email from the ASF dual-hosted git repository.

damccorm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/beam.git


The following commit(s) were added to refs/heads/master by this push:
     new e7924d181b9 Enable close issue as not planned (#22032)
e7924d181b9 is described below

commit e7924d181b9fc6549a0db0772ac93aa768bbfc1c
Author: Yi Hu <ya...@google.com>
AuthorDate: Fri Jun 24 09:52:44 2022 -0400

    Enable close issue as not planned (#22032)
    
    * Enable close issue as not planned
    
    * Make use of state_reason attribute
    
    * Run on only issue comment and exclude pull request comment
    
    * Added documentation
    
    * apply suggested changes
    
    * only issue assignee triggers close issue
    
    * remove .close-issue restriction
---
 .github/README.md                 | 31 +++++++++++++++++++++++++++++++
 .github/workflows/self-assign.yml |  9 +++++++--
 2 files changed, 38 insertions(+), 2 deletions(-)

diff --git a/.github/README.md b/.github/README.md
new file mode 100644
index 00000000000..0b664022d3f
--- /dev/null
+++ b/.github/README.md
@@ -0,0 +1,31 @@
+<!--
+    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.
+-->
+
+> **PLEASE update this file if you add new github action or change name/trigger phrase of a github action.**
+
+## Beam Github Actions
+
+### Issue Self-assign
+
+Phrases for self-assign and close the issue:
+| Phrase | Effect |
+|--------|--------|
+| `.take-issue` | Self-assign the issue |
+| `.close-issue` | Close the issue as completed |
+| `.close-issue not_planned` | Close the issue as not-planned |
diff --git a/.github/workflows/self-assign.yml b/.github/workflows/self-assign.yml
index 50279e1fd71..f939237c974 100644
--- a/.github/workflows/self-assign.yml
+++ b/.github/workflows/self-assign.yml
@@ -20,6 +20,7 @@ on:
 jobs:
   assign:
     name: Take or close an issue
+    if: ${{ !github.event.issue.pull_request }}
     runs-on: ubuntu-latest
     steps:
     - run: |
@@ -35,9 +36,13 @@ jobs:
           curl -X DELETE -H "Authorization: token $GITHUB_TOKEN" https://api.github.com/repos/$REPO/issues/$ISSUE_NUMBER/labels/awaiting%20triage
         fi
         if [[ $BODY == *"$INPUT_CLOSE"* && $BODY != *"\`$INPUT_CLOSE\`"* ]]; then
-          echo "Closing issue $ISSUE_NUMBER"
+          ISSUE_CLOSE_CONFIG='"state":"closed"'
+          if [[ $BODY == *"not_planned"* ]]; then
+            ISSUE_CLOSE_CONFIG='"state":"closed","state_reason":"not_planned"'
+          fi
+          echo "Closing issue $ISSUE_NUMBER as {$ISSUE_CLOSE_CONFIG}"
           echo "Using the link: https://api.github.com/repos/$REPO/issues/$ISSUE_NUMBER"
-          curl -X PATCH -H "Authorization: token $GITHUB_TOKEN" -d '{"state":"closed"}' https://api.github.com/repos/$REPO/issues/$ISSUE_NUMBER
+          curl -X PATCH -H "Authorization: token $GITHUB_TOKEN" -d "{$ISSUE_CLOSE_CONFIG}" https://api.github.com/repos/$REPO/issues/$ISSUE_NUMBER
         fi
       shell: bash
       env: