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

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


The following commit(s) were added to refs/heads/master by this push:
     new a04d9e12fb infra: add auto notify GHA when issue is created (#6198)
a04d9e12fb is described below

commit a04d9e12fb5101b97743a92ffb951631e8359e15
Author: shown <[email protected]>
AuthorDate: Sun Oct 5 21:51:49 2025 +0800

    infra: add auto notify GHA when issue is created (#6198)
    
    Signed-off-by: yuluo-yx <[email protected]>
    Co-authored-by: aias00 <[email protected]>
---
 .github/activie-committers.yml    | 19 +++++++++++
 .github/workflows/auto-notify.yml | 68 +++++++++++++++++++++++++++++++++++++++
 2 files changed, 87 insertions(+)

diff --git a/.github/activie-committers.yml b/.github/activie-committers.yml
new file mode 100644
index 0000000000..42640cd79e
--- /dev/null
+++ b/.github/activie-committers.yml
@@ -0,0 +1,19 @@
+# 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.
+
+# Apache ShenYu active committers list.
+
+@yuluo-yx
+@Aais00
diff --git a/.github/workflows/auto-notify.yml 
b/.github/workflows/auto-notify.yml
new file mode 100644
index 0000000000..d14a1e7f94
--- /dev/null
+++ b/.github/workflows/auto-notify.yml
@@ -0,0 +1,68 @@
+# 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.
+
+# When issue opened, notify ShenYu active committers.
+# And randomly select one from the list, not all.
+# See .github/activie-committers.yml for the list of active committers.
+
+name: Auto Notify
+
+on:
+  issues:
+    types: [opened]
+
+jobs:
+  notify-committers:
+    runs-on: ubuntu-latest
+    steps:
+      - name: Checkout repository
+        uses: actions/checkout@v4
+
+      - name: Read active committers list and select random one
+        id: read-committers
+        run: |
+          # Read committers from the YAML file and extract GitHub usernames
+          committers=$(grep -E "^@" .github/activie-committers.yml)
+          # Randomly select one committer
+          selected_committer=$(echo "$committers" | shuf -n 1)
+          echo "committer=$selected_committer" >> $GITHUB_OUTPUT
+
+      - name: Notify randomly selected committer
+        uses: actions/github-script@v7
+        with:
+          github-token: ${{ secrets.GITHUB_TOKEN }}
+          script: |
+            const committer = '${{ steps.read-committers.outputs.committer }}';
+            const issueNumber = context.issue.number;
+            const issueTitle = context.payload.issue.title;
+            const issueAuthor = context.payload.issue.user.login;
+            const issueUrl = context.payload.issue.html_url;
+            
+            const commentBody = [
+              `👋 Hello ${committer}`,
+              '',
+              `A new issue has been opened by @${issueAuthor}:`,
+              `- **Title**: ${issueTitle}`,
+              `- **Link**: ${issueUrl}`,
+              '',
+              'Please review when you have time. Thank you! 🙏'
+            ].join('\n');
+
+            await github.rest.issues.createComment({
+              owner: context.repo.owner,
+              repo: context.repo.repo,
+              issue_number: issueNumber,
+              body: commentBody
+            });

Reply via email to