From 2b82995ee31fe936bb73dc4c2a914fc0ace75919 Mon Sep 17 00:00:00 2001 From: Jinsong Ji Date: Mon, 31 Mar 2025 18:18:25 -0700 Subject: [PATCH 1/5] [CI] 2nd attempt to skip filtering large PR Problem Output Access: The output from the changed_files step is being accessed incorrectly. The changed_files step returns a value, but it's not being stored in a way that can be directly accessed in the if condition. Type Mismatch: The output from the changed_files step is likely a string, and you're trying to compare it as a number. This can lead to unexpected behavior. Solution To fix the issue, you need to ensure that the output from the changed_files step is correctly stored and accessed Why It Works for steps.result.outputs.result for steps.result.outputs.result Direct Access: The script directly accesses context.payload.pull_request.changed_files and performs the comparison within the JavaScript environment, which is more flexible and allows for direct manipulation of data. Output Return: The script returns a value based on the condition, which is then used as the output of the step. This output can be accessed in subsequent steps using ${{ steps.result.outputs.result }}. Difference from if Condition The if condition in GitHub Actions is evaluated using the expression syntax, which requires correct access to step outputs and proper handling of data types. The issue you faced was due to incorrect access to the output and potential type mismatch, whereas the script handles these aspects internally and directly. --- .github/workflows/sycl-detect-changes.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/sycl-detect-changes.yml b/.github/workflows/sycl-detect-changes.yml index 3be543dd2f15b..6fcff12220057 100644 --- a/.github/workflows/sycl-detect-changes.yml +++ b/.github/workflows/sycl-detect-changes.yml @@ -22,13 +22,13 @@ jobs: uses: actions/github-script@v7 with: script: | - console.log("Number of files changed:"); - console.log(context.payload.pull_request.changed_files); - return context.payload.pull_request.changed_files ; + const changedFiles = context.payload.pull_request.changed_files; + console.log("Number of files changed:", changedFiles); + return { changed_file_cnt: changedFiles } ; - name: Check file changes uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 - if: ${{ steps.changed_files.outputs.changed_files }} < 500 + if: ${{ steps.changed_files.outputs.changed_file_cnt }} < 500 id: changes with: filters: | From 3fabf43415169a688538f6d1f73dd982bd92998b Mon Sep 17 00:00:00 2001 From: Jinsong Ji Date: Tue, 1 Apr 2025 07:41:01 -0700 Subject: [PATCH 2/5] Revert "[CI] 2nd attempt to skip filtering large PR" This reverts commit 2b82995ee31fe936bb73dc4c2a914fc0ace75919. --- .github/workflows/sycl-detect-changes.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/sycl-detect-changes.yml b/.github/workflows/sycl-detect-changes.yml index 6fcff12220057..3be543dd2f15b 100644 --- a/.github/workflows/sycl-detect-changes.yml +++ b/.github/workflows/sycl-detect-changes.yml @@ -22,13 +22,13 @@ jobs: uses: actions/github-script@v7 with: script: | - const changedFiles = context.payload.pull_request.changed_files; - console.log("Number of files changed:", changedFiles); - return { changed_file_cnt: changedFiles } ; + console.log("Number of files changed:"); + console.log(context.payload.pull_request.changed_files); + return context.payload.pull_request.changed_files ; - name: Check file changes uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 - if: ${{ steps.changed_files.outputs.changed_file_cnt }} < 500 + if: ${{ steps.changed_files.outputs.changed_files }} < 500 id: changes with: filters: | From 3bdf5e2bf57e933c004faf3929d725d55c0e338b Mon Sep 17 00:00:00 2001 From: Jinsong Ji Date: Tue, 1 Apr 2025 07:42:23 -0700 Subject: [PATCH 3/5] try fromJSON --- .github/workflows/sycl-detect-changes.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/sycl-detect-changes.yml b/.github/workflows/sycl-detect-changes.yml index 3be543dd2f15b..e42cc66647224 100644 --- a/.github/workflows/sycl-detect-changes.yml +++ b/.github/workflows/sycl-detect-changes.yml @@ -28,7 +28,7 @@ jobs: - name: Check file changes uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 - if: ${{ steps.changed_files.outputs.changed_files }} < 500 + if: ${{ fromJSON(steps.changed_files.outputs.changed_files) }} < 500 id: changes with: filters: | From 65fddfbde6d9037d200c078ed5ce1c71b861a9bf Mon Sep 17 00:00:00 2001 From: Jinsong Ji Date: Tue, 1 Apr 2025 07:51:13 -0700 Subject: [PATCH 4/5] Revert "try fromJSON" This reverts commit 3bdf5e2bf57e933c004faf3929d725d55c0e338b. --- .github/workflows/sycl-detect-changes.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/sycl-detect-changes.yml b/.github/workflows/sycl-detect-changes.yml index e42cc66647224..3be543dd2f15b 100644 --- a/.github/workflows/sycl-detect-changes.yml +++ b/.github/workflows/sycl-detect-changes.yml @@ -28,7 +28,7 @@ jobs: - name: Check file changes uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 - if: ${{ fromJSON(steps.changed_files.outputs.changed_files) }} < 500 + if: ${{ steps.changed_files.outputs.changed_files }} < 500 id: changes with: filters: | From 3df7c33e3a542733ec677a7d7c9440d005e405b4 Mon Sep 17 00:00:00 2001 From: Jinsong Ji Date: Tue, 1 Apr 2025 07:51:20 -0700 Subject: [PATCH 5/5] Revert "Revert "[CI] 2nd attempt to skip filtering large PR"" This reverts commit 3fabf43415169a688538f6d1f73dd982bd92998b. --- .github/workflows/sycl-detect-changes.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/sycl-detect-changes.yml b/.github/workflows/sycl-detect-changes.yml index 3be543dd2f15b..6fcff12220057 100644 --- a/.github/workflows/sycl-detect-changes.yml +++ b/.github/workflows/sycl-detect-changes.yml @@ -22,13 +22,13 @@ jobs: uses: actions/github-script@v7 with: script: | - console.log("Number of files changed:"); - console.log(context.payload.pull_request.changed_files); - return context.payload.pull_request.changed_files ; + const changedFiles = context.payload.pull_request.changed_files; + console.log("Number of files changed:", changedFiles); + return { changed_file_cnt: changedFiles } ; - name: Check file changes uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 - if: ${{ steps.changed_files.outputs.changed_files }} < 500 + if: ${{ steps.changed_files.outputs.changed_file_cnt }} < 500 id: changes with: filters: |