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

yiconghuang pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/texera.git


The following commit(s) were added to refs/heads/main by this push:
     new d0d8c4f617 chore: Add issue triage workflow for label management 
(#4060)
d0d8c4f617 is described below

commit d0d8c4f617ed809c6633be0250faf88bd3d67b20
Author: Yicong Huang <[email protected]>
AuthorDate: Tue Nov 18 14:32:18 2025 -0800

    chore: Add issue triage workflow for label management (#4060)
    
    ### What changes were proposed in this PR?
    This PR adds a GitHub Actions workflow that automatically manages the
    triage label on issues based on their assignees:
    • When an issue is assigned (i.e., it has at least one assignee), the
    workflow removes the triage label.
    • When an assignee is removed and the issue ends up with no assignees,
    the workflow adds the triage label.
    
    ### Any related issues, documentation, discussions?
    None.
    
    ### How was this PR tested?
    Tested on my own fork.
    
    ### Was this PR authored or co-authored using generative AI tooling?
    Generated-by: ChatGPT (GPT-5.1 Thinking)
    
    ---------
    
    Signed-off-by: Yicong Huang <[email protected]>
---
 .github/workflows/issue-triage.yml | 89 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 89 insertions(+)

diff --git a/.github/workflows/issue-triage.yml 
b/.github/workflows/issue-triage.yml
new file mode 100644
index 0000000000..0846b98ebe
--- /dev/null
+++ b/.github/workflows/issue-triage.yml
@@ -0,0 +1,89 @@
+# 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: Issue triage
+on:
+  issues:
+    types: [assigned, unassigned]
+
+permissions:
+  issues: write
+  pull-requests: read
+
+jobs:
+  # --------------------------------------------------------
+  # 1) Issue triage: add/remove "triage" on assignment changes
+  # --------------------------------------------------------
+  issue-triage:
+    if: github.event_name == 'issues'
+    runs-on: ubuntu-latest
+    steps:
+      - name: Remove 'triage' label when issue is assigned
+        if: github.event.action == 'assigned'
+        uses: actions/github-script@v7
+        with:
+          github-token: ${{ secrets.GITHUB_TOKEN }}
+          script: |
+            const { owner, repo } = context.repo;
+            const issue_number = context.payload.issue.number;
+
+            try {
+              await github.rest.issues.removeLabel({
+                owner,
+                repo,
+                issue_number,
+                name: 'triage',
+              });
+              core.info(`Removed 'triage' from issue #${issue_number}`);
+            } catch (e) {
+              if (e.status === 404) {
+                core.info(`Issue #${issue_number} has no 'triage' label, 
nothing to remove.`);
+              } else {
+                core.warning(`Failed to remove 'triage' from issue 
#${issue_number}: ${e.message}`);
+                throw e;
+              }
+            }
+
+      - name: Add 'triage' label when issue is unassigned and has no assignees
+        if: github.event.action == 'unassigned'
+        uses: actions/github-script@v7
+        with:
+          github-token: ${{ secrets.GITHUB_TOKEN }}
+          script: |
+            const issue = context.payload.issue;
+            const { owner, repo } = context.repo;
+            const issue_number = issue.number;
+
+            const assignees = issue.assignees || [];
+            if (assignees.length > 0) {
+              core.info(
+                `Issue #${issue_number} still has ${assignees.length} 
assignee(s), not adding 'triage'.`
+              );
+              return;
+            }
+
+            core.info(`Issue #${issue_number} has no assignees, adding 
'triage' label.`);
+            try {
+              await github.rest.issues.addLabels({
+                owner,
+                repo,
+                issue_number,
+                labels: ['triage'],
+              });
+            } catch (e) {
+              core.warning(`Failed to add 'triage' to issue #${issue_number}: 
${e.message}`);
+              throw e;
+            }

Reply via email to