[llvm] [Github] Improve automatic new issue labelling (PR #65309)

via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 5 02:56:22 PDT 2023


https://github.com/cor3ntin updated https://github.com/llvm/llvm-project/pull/65309:

>From 71eea86dc0b221cdd13c6c8a1057cdab73a5bd9a Mon Sep 17 00:00:00 2001
From: Corentin Jabot <corentinjabot at gmail.com>
Date: Tue, 5 Sep 2023 08:55:34 +0200
Subject: [PATCH 1/2] [Github] Improve automatic new issue labelling

This patch:
  * Replace andymckay/labeler which does not appear to be maintained
    by github official solution
  * Remove the closed issue workflow which was disabled a few years
    ago and never fixed.
  * Add a few rules to add label based on PR title, hopefully that
    can make triaging simpler. If that turns out to be useful,
    we can consider adding more rules for backends, etc.
    We could technically also pattern match the body of the issue but
    I'm concerned about trying to be _too_ clever.

The new system is only triggered on PR open so manual labels
should not be removed.

Full disclosure, this was not tested, not sure how testing
could be done.
---
 .github/workflows/closed-issues.yml      | 20 --------------
 .github/workflows/new-issues-labeler.yml | 34 ++++++++++++++++++++++++
 .github/workflows/new-issues.yml         | 12 +++++----
 3 files changed, 41 insertions(+), 25 deletions(-)
 delete mode 100644 .github/workflows/closed-issues.yml
 create mode 100644 .github/workflows/new-issues-labeler.yml

diff --git a/.github/workflows/closed-issues.yml b/.github/workflows/closed-issues.yml
deleted file mode 100644
index b8ef53d4a471890..000000000000000
--- a/.github/workflows/closed-issues.yml
+++ /dev/null
@@ -1,20 +0,0 @@
-name: Labeling closed issues
-on:
-  workflow_dispatch
-#  issues:
-#    types: ['closed']
-
-permissions:
-  contents: read
-
-jobs:
-  automate-issues-labels:
-    permissions:
-      issues: write  # for andymckay/labeler to label issues
-      pull-requests: write  # for andymckay/labeler to label PRs
-    runs-on: ubuntu-latest
-    if: github.repository == 'llvm/llvm-project'
-    steps:
-      - uses: andymckay/labeler at 1.0.4
-        with:
-          remove-labels: 'awaiting-review'
diff --git a/.github/workflows/new-issues-labeler.yml b/.github/workflows/new-issues-labeler.yml
new file mode 100644
index 000000000000000..e196d7acc337aa5
--- /dev/null
+++ b/.github/workflows/new-issues-labeler.yml
@@ -0,0 +1,34 @@
+'new issue':
+  - '/.*/'
+
+'clang'
+  - '/\bclang(?!\-)\b/i'
+
+'clang-format'
+  - '/\bclang-format/i'
+
+'clang-tidy'
+  - '/\bclang-tidy/i'
+
+'libc++'
+  - '/\blibc++(?!\-)/i'
+  - '/\blibcxx(?!\-)/i'
+
+'libc++-abi'
+  - '/\blibc++-abi/i'
+  - '/\blibcxx-abi/i'
+
+'libc'
+  - '/\blibc(?![-+])\b/i'
+
+'flang'
+  - '/\bflang(?!\-)\b/i'
+
+'lld'
+  - '/\blld(?!\-)\b/i'
+
+'mlir'
+  - '/\bmlir(?!\-)\b/i'
+
+'bolt'
+  - '/\bbolt(?!\-)\b/i'
diff --git a/.github/workflows/new-issues.yml b/.github/workflows/new-issues.yml
index cd5fa1d58347417..e976525366d4636 100644
--- a/.github/workflows/new-issues.yml
+++ b/.github/workflows/new-issues.yml
@@ -9,12 +9,14 @@ permissions:
 jobs:
   automate-issues-labels:
     permissions:
-      issues: write  # for andymckay/labeler to label issues
-      pull-requests: write  # for andymckay/labeler to label PRs
+      issues: write
     runs-on: ubuntu-latest
     if: github.repository == 'llvm/llvm-project'
     steps:
-      - uses: andymckay/labeler at 1.0.4
+      - uses: github/issue-labeler at v3.2
         with:
-          add-labels: 'new issue'
-          ignore-if-labeled: true
+          repo-token: ${{ secrets.GITHUB_TOKEN }}
+          configuration-path: .github/workflows/new-issues-labeler.yml
+          include-title: 1
+          include-body: 0
+          sync-labels: 0

>From 8a535da9b408f17a436033a0c1f922ebaec5bc7f Mon Sep 17 00:00:00 2001
From: Corentin Jabot <corentinjabot at gmail.com>
Date: Tue, 5 Sep 2023 11:56:06 +0200
Subject: [PATCH 2/2] Fixes after tests on my fork

---
 .github/workflows/new-issues-labeler.yml | 26 +++++++++++-------------
 .github/workflows/new-issues.yml         |  1 +
 2 files changed, 13 insertions(+), 14 deletions(-)

diff --git a/.github/workflows/new-issues-labeler.yml b/.github/workflows/new-issues-labeler.yml
index e196d7acc337aa5..e6ac60960165474 100644
--- a/.github/workflows/new-issues-labeler.yml
+++ b/.github/workflows/new-issues-labeler.yml
@@ -1,34 +1,32 @@
 'new issue':
   - '/.*/'
 
-'clang'
+'clang':
   - '/\bclang(?!\-)\b/i'
 
-'clang-format'
+'clang-format':
   - '/\bclang-format/i'
 
-'clang-tidy'
+'clang-tidy':
   - '/\bclang-tidy/i'
 
-'libc++'
-  - '/\blibc++(?!\-)/i'
-  - '/\blibcxx(?!\-)/i'
+'libc++':
+  - '/libc[+x]{2}(?!\-)/i'
 
-'libc++-abi'
-  - '/\blibc++-abi/i'
-  - '/\blibcxx-abi/i'
+'libc++-abi':
+  - '/libc[+x]{2}-abi/i'
 
-'libc'
+'libc':
   - '/\blibc(?![-+])\b/i'
 
-'flang'
+'flang':
   - '/\bflang(?!\-)\b/i'
 
-'lld'
+'lld':
   - '/\blld(?!\-)\b/i'
 
-'mlir'
+'mlir':
   - '/\bmlir(?!\-)\b/i'
 
-'bolt'
+'bolt':
   - '/\bbolt(?!\-)\b/i'
diff --git a/.github/workflows/new-issues.yml b/.github/workflows/new-issues.yml
index e976525366d4636..82550f26e8991d6 100644
--- a/.github/workflows/new-issues.yml
+++ b/.github/workflows/new-issues.yml
@@ -20,3 +20,4 @@ jobs:
           include-title: 1
           include-body: 0
           sync-labels: 0
+          enable-versioned-regex: 0



More information about the llvm-commits mailing list