ソースを参照

Add 3 dots to git diff to catch only the changed files at head (#222)

Mike Chang 2 年 前
コミット
2e1ee7b803
1 ファイル変更3 行追加3 行削除
  1. 3 3
      .github/workflows/build-package.yaml

+ 3 - 3
.github/workflows/build-package.yaml

@@ -26,7 +26,7 @@ jobs:
     - name: Get package and platform from JSON changes
     - name: Get package and platform from JSON changes
       id: detect-platform
       id: detect-platform
       run: |
       run: |
-        CHANGED_FILES=$(git diff ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }} --name-only)
+        CHANGED_FILES=$(git diff ${{ github.event.pull_request.base.sha }}...${{ github.event.pull_request.head.sha }} --name-only)
         # Construct the package and os into a json string to be consumed by Github Actions runners
         # Construct the package and os into a json string to be consumed by Github Actions runners
         JSON="{\"include\":["
         JSON="{\"include\":["
         for FILE in $CHANGED_FILES; do
         for FILE in $CHANGED_FILES; do
@@ -47,8 +47,8 @@ jobs:
               ;;
               ;;
             esac
             esac
 
 
-            DIFF=$(git diff ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }} --no-ext-diff --unified=0 \
-                        --exit-code -a --no-prefix -- $FILE | egrep "^\+" | grep Scripts) # Get only the changes that can be built
+            DIFF=$(git diff ${{ github.event.pull_request.base.sha }}...${{ github.event.pull_request.head.sha }} --no-ext-diff --unified=0 \
+                        --exit-code -a --no-prefix -- $FILE | egrep "^\+" | grep Scripts) # Get oly the changes that can be built
 
 
             if [[ $? -ne 0 ]]; then
             if [[ $? -ne 0 ]]; then
               echo No valid build change found. Exiting with non-zero
               echo No valid build change found. Exiting with non-zero