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

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


The following commit(s) were added to refs/heads/master by this push:
     new 73c1e329fc7 add todos check (#14367)
73c1e329fc7 is described below

commit 73c1e329fc714d5b306c0c99c6f8a78ae6bff1d0
Author: CritasWang <[email protected]>
AuthorDate: Fri Dec 13 11:58:08 2024 +0800

    add todos check (#14367)
    
    * add todos check
    
    * change target branch
    
    * fix: no merge base
    
    * add FIXME
---
 .github/workflows/todos-check.yml | 43 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 43 insertions(+)

diff --git a/.github/workflows/todos-check.yml 
b/.github/workflows/todos-check.yml
new file mode 100644
index 00000000000..7db287212ae
--- /dev/null
+++ b/.github/workflows/todos-check.yml
@@ -0,0 +1,43 @@
+name: Check TODOs and FIXMEs in Changed Files
+
+on:
+  pull_request:
+    branches:
+      - master
+      - 'rel/*'
+      - "rc/*"
+    paths-ignore:
+      - 'docs/**'
+      - 'site/**'
+  # allow manually run the action:
+  workflow_dispatch:
+
+jobs:
+  todo-check:
+    runs-on: ubuntu-latest
+
+    steps:
+      - name: Checkout code
+        uses: actions/checkout@v4
+
+      - name: Check for TODOs and FIXMEs in changed files
+        run: |
+          # Fetch the target branch
+          git fetch origin $GITHUB_BASE_REF
+          
+          # Check if there is a common ancestor
+          if git merge-base --is-ancestor origin/$GITHUB_BASE_REF HEAD; then
+            # Get the diff of the changes
+            DIFF=$(git diff origin/$GITHUB_BASE_REF...HEAD)
+          else
+            # If no common ancestor, compare with the initial commit
+            DIFF=$(git diff $(git hash-object -t tree /dev/null) HEAD)
+          fi
+  
+          # Check the diff for TODOs
+          if echo "$DIFF" | grep -Eq '^\+.*(TODO|FIXME)'; then
+            echo "TODO found in the changes. Please resolve it before merging."
+            exit 1
+          else
+            echo "No TODOs found in changed content."
+          fi

Reply via email to