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

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


The following commit(s) were added to refs/heads/main by this push:
     new 2357165fe ci: assign issues to authors who will submit a PR (#9338)
2357165fe is described below

commit 2357165fef48e76fd484c48fd5b137f2c8c8117a
Author: Klesh Wong <[email protected]>
AuthorDate: Mon Nov 9 10:41:10 2026 +0800

    ci: assign issues to authors who will submit a PR (#9338)
    
    When the author of a bug report or feature request ticks
    "Yes I am willing to submit a PR!", assign the issue to them.
    The workflow runs on opened, edited and reopened, so ticking
    the box later also works.
    
    Co-authored-by: Claude Opus 5.5 <[email protected]>
---
 .github/workflows/issue-auto-assign.yml | 51 +++++++++++++++++++++++++++++++++
 1 file changed, 51 insertions(+)

diff --git a/.github/workflows/issue-auto-assign.yml 
b/.github/workflows/issue-auto-assign.yml
new file mode 100644
index 000000000..0cb1899c5
--- /dev/null
+++ b/.github/workflows/issue-auto-assign.yml
@@ -0,0 +1,51 @@
+# 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.
+
+# Assigns an issue to its author when the author ticks
+# "Yes I am willing to submit a PR!" in the bug report or feature request form.
+# Runs on `edited` too, so ticking the box after the issue is opened also 
works.
+
+name: issue-auto-assign
+
+on:
+  issues:
+    types: [opened, edited, reopened]
+
+permissions:
+  issues: write
+
+jobs:
+  assign-author:
+    runs-on: ubuntu-latest
+    if: >-
+      github.event.issue.state == 'open' &&
+      github.event.issue.user.type == 'User' &&
+      !contains(github.event.issue.assignees.*.login, 
github.event.issue.user.login)
+    steps:
+      - name: Assign the author when they will submit a PR
+        env:
+          GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+          GH_REPO: ${{ github.repository }}
+          ISSUE_NUMBER: ${{ github.event.issue.number }}
+          AUTHOR: ${{ github.event.issue.user.login }}
+          # Pass the body through env, never inline it into the script.
+          BODY: ${{ github.event.issue.body }}
+        run: |
+          if printf '%s' "$BODY" | grep -qiE 
'^[[:space:]]*-[[:space:]]*\[x\][[:space:]]*Yes I am willing to submit a PR!'; 
then
+            gh issue edit "$ISSUE_NUMBER" --add-assignee "$AUTHOR"
+            echo "Assigned #$ISSUE_NUMBER to @$AUTHOR"
+          else
+            echo "The PR checkbox is not ticked; nothing to do"
+          fi

Reply via email to