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

morningman pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris-website.git


The following commit(s) were added to refs/heads/master by this push:
     new 0de3badc87d feat: add GitHub Action to check PR file sizes (#3586)
0de3badc87d is described below

commit 0de3badc87dc1e04c13ac90bcebb073eadde98cc
Author: Mingyu Chen (Rayner) <[email protected]>
AuthorDate: Sun Apr 26 08:59:28 2026 -0700

    feat: add GitHub Action to check PR file sizes (#3586)
    
    Co-authored-by: Claude Opus 4.7 <[email protected]>
---
 .github/workflows/approve-check.yml       | 50 ++++++++++++++---------------
 .github/workflows/check-pr-file-sizes.yml | 53 +++++++++++++++++++++++++++++++
 tools/check_review.py                     |  4 +--
 3 files changed, 80 insertions(+), 27 deletions(-)

diff --git a/.github/workflows/approve-check.yml 
b/.github/workflows/approve-check.yml
index 1693ff9d70b..eeea37ba2d7 100644
--- a/.github/workflows/approve-check.yml
+++ b/.github/workflows/approve-check.yml
@@ -14,30 +14,30 @@
 # KIND, either express or implied.  See the License for the
 # specific language governing permissions and limitations
 # under the License.
----
-name: Need_2_Approval
+# ---
+# name: Need_2_Approval
 
-on:
-  pull_request_review:
-    types: [ submitted ]
+# on:
+#   pull_request_review:
+#     types: [ submitted ]
 
-jobs:
-  Need_2_Approval:
-    runs-on: ubuntu-latest
-    timeout-minutes: 5
-    steps:
-      - uses: actions/checkout@v3
-      - name: Install Python dependencies
-        uses: actions/setup-python@v5
-        with:
-          python-version: '3.10'  # Adjust if needed
-      - name: Install match library
-        run: |
-          pip install --upgrade pip 
-          pip install match
-          pip install requests
-      - name: Run Python script
-        run: |
-          python tools/check_review.py  ${{ github.event.pull_request.number 
}} ${{secrets.GITHUB_TOKEN}}
-env:
-  GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 
\ No newline at end of file
+# jobs:
+#   Need_2_Approval:
+#     runs-on: ubuntu-latest
+#     timeout-minutes: 5
+#     steps:
+#       - uses: actions/checkout@v3
+#       - name: Install Python dependencies
+#         uses: actions/setup-python@v5
+#         with:
+#           python-version: '3.10'  # Adjust if needed
+#       - name: Install match library
+#         run: |
+#           pip install --upgrade pip
+#           pip install match
+#           pip install requests
+#       - name: Run Python script
+#         run: |
+#           python tools/check_review.py  ${{ github.event.pull_request.number 
}} ${{secrets.GITHUB_TOKEN}}
+# env:
+#   GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 
\ No newline at end of file
diff --git a/.github/workflows/check-pr-file-sizes.yml 
b/.github/workflows/check-pr-file-sizes.yml
new file mode 100644
index 00000000000..dcc3aa22b5e
--- /dev/null
+++ b/.github/workflows/check-pr-file-sizes.yml
@@ -0,0 +1,53 @@
+name: Check PR File Sizes
+
+on:
+  pull_request:
+    types: [opened, synchronize, reopened]
+
+jobs:
+  check-file-sizes:
+    runs-on: ubuntu-latest
+    steps:
+      - name: Checkout PR
+        uses: actions/checkout@v4
+        with:
+          fetch-depth: 0
+
+      - name: Get changed files in PR
+        id: changed
+        run: |
+          # Get list of files changed in the PR compared to base branch
+          # Use delimiter syntax for multi-line output
+          {
+            echo 'files<<EOF'
+            git diff --name-only ${{ github.event.pull_request.base.sha }} 
HEAD | head -100
+            echo EOF
+          } >> $GITHUB_OUTPUT
+
+      - name: Check file sizes
+        run: |
+          MAX_SIZE=512000  # 500KB in bytes
+          OVER_LIMIT=()
+
+          while IFS= read -r file; do
+            [ -z "$file" ] && continue
+            if [ -f "$file" ]; then
+              size=$(stat -c%s "$file" 2>/dev/null || stat -f%z "$file" 
2>/dev/null)
+              if [ "$size" -gt "$MAX_SIZE" ]; then
+                size_kb=$((size / 1024))
+                OVER_LIMIT+=("❌ $file (${size_kb}KB)")
+              fi
+            fi
+          done <<< "${{ steps.changed.outputs.files }}"
+
+          if [ ${#OVER_LIMIT[@]} -gt 0 ]; then
+            echo "❌ The following files exceed 500KB:"
+            for f in "${OVER_LIMIT[@]}"; do
+              echo "  $f"
+            done
+            echo ""
+            echo "Please reduce file sizes or use Git LFS to store large 
files."
+            exit 1
+          fi
+
+          echo "✅ All files are under 500KB"
\ No newline at end of file
diff --git a/tools/check_review.py b/tools/check_review.py
index 443d49e099b..2ab53842ef1 100644
--- a/tools/check_review.py
+++ b/tools/check_review.py
@@ -77,8 +77,8 @@ def check_review_pass(pr_num, maintainers_file, token):
       if not path_found:
           continue
   print(approves)
-  if len(approves) < 2:
-      print("PR has not been approved by at least 2 reviewers")
+  if len(approves) < 1:
+      print("PR has not been approved by at least 1 reviewer")
       exit(1)
 
   return has_maintainer_review


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

Reply via email to