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

jiacai2050 pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-horaedb.git


The following commit(s) were added to refs/heads/main by this push:
     new 7d6131cc chore: modify check-pr-title action (#1523)
7d6131cc is described below

commit 7d6131cc413f61e535d49eaac4c78d63a596fd3c
Author: chunshao.rcs <[email protected]>
AuthorDate: Mon Apr 22 15:50:26 2024 +0800

    chore: modify check-pr-title action (#1523)
    
    ## Rationale
    Refer to
    https://github.com/apache/incubator-horaedb/actions/runs/8779713550
    ```
    thehanimo/[email protected] is not allowed to be used in 
apache/incubator-horaedb. Actions in this workflow must be: within a repository 
owned by apache, created by GitHub, verified in the GitHub Marketplace
    ```
    
    ## Detailed Changes
    Use custom script to run.
    
    ## Test Plan
    CI.
---
 .github/pr-title-checker-config.json | 15 ---------------
 .github/workflows/check-pr-title.yml | 27 ++++++++++++++-------------
 2 files changed, 14 insertions(+), 28 deletions(-)

diff --git a/.github/pr-title-checker-config.json 
b/.github/pr-title-checker-config.json
deleted file mode 100644
index 0e850b43..00000000
--- a/.github/pr-title-checker-config.json
+++ /dev/null
@@ -1,15 +0,0 @@
-{
-  "LABEL": {
-    "name": "title needs formatting",
-    "color": "EEEEEE"
-  },
-  "CHECKS": {
-    "regexp": "^(feat|fix|refactor|chore|docs)(\\(.*\\))?\\!?:.*",
-    "ignoreLabels" : ["dont-check-PRs-with-this-label", "meta"]
-  },
-  "MESSAGES": {
-    "success": "All OK",
-    "failure": "Failing CI test",
-    "notice": ""
-  }
-}
diff --git a/.github/workflows/check-pr-title.yml 
b/.github/workflows/check-pr-title.yml
index 2fdf4d52..d955dee5 100644
--- a/.github/workflows/check-pr-title.yml
+++ b/.github/workflows/check-pr-title.yml
@@ -15,22 +15,23 @@
 # specific language governing permissions and limitations
 # under the License.
 
-name: "PR Title Checker"
+name: Check PR Title
+
 on:
-  pull_request_target:
-    types:
-      - opened
-      - edited
-      - synchronize
-      - labeled
-      - unlabeled
+  pull_request:
+    types: [opened, edited, synchronize, reopened]
 
 jobs:
-  check:
+  check-pr-title:
     runs-on: ubuntu-latest
     steps:
-      - uses: thehanimo/[email protected]
+      - name: Check Title
+        uses: actions/github-script@v5
         with:
-          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
-          pass_on_octokit_error: false
-          configuration_path: .github/pr-title-checker-config.json
+          script: |
+            const title = context.payload.pull_request.title;
+            const regex = /^(feat|fix|docs|refactor|chore)(\(.+\))?!?: .+$/; 
+            if (!regex.test(title)) {
+              core.setFailed('PR title does not follow the convention, the 
pattern: ^(feat|fix|docs|refactor|chore)(\(.+\))?!?: .+$');
+            }
+          github-token: ${{ secrets.GITHUB_TOKEN }}


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to