From 773aa9d9faf982122c144857b4d309d9aaab11e6 Mon Sep 17 00:00:00 2001 From: Lim Chee Aun Date: Sun, 18 Aug 2024 18:24:33 +0800 Subject: [PATCH] Oops, need to handle more cases and debug --- .github/workflows/i18n-automerge.yml | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/.github/workflows/i18n-automerge.yml b/.github/workflows/i18n-automerge.yml index ed7a7a26..adb3d10b 100644 --- a/.github/workflows/i18n-automerge.yml +++ b/.github/workflows/i18n-automerge.yml @@ -18,8 +18,20 @@ jobs: - name: Count lines changed run: | + BASE_SHA="${{ github.event.pull_request.base.sha }}" + HEAD_SHA="${{ github.event.pull_request.head.sha }}" + + # Debug: Show the base and head SHA + echo "Base SHA: $BASE_SHA" + echo "Head SHA: $HEAD_SHA" + # Calculate the total number of lines changed (added, removed, or modified) - LINES_CHANGED=$(git diff --shortstat ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }} | awk '{print $4 + $6 + $8}') + LINES_CHANGED=$(git diff --shortstat $BASE_SHA $HEAD_SHA | awk '{print $4 + $6 + $8}') + + if [ -z "$LINES_CHANGED" ]; then + LINES_CHANGED=0 + fi + echo "Total lines changed: $LINES_CHANGED" # Check if the number of lines changed is more than 20