Skip to content

Commit 79f07bf

Browse files
authored
[CI] 2nd attempt to skip filtering large PR (#17761)
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.
1 parent 752678e commit 79f07bf

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

.github/workflows/sycl-detect-changes.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@ jobs:
2222
uses: actions/github-script@v7
2323
with:
2424
script: |
25-
console.log("Number of files changed:");
26-
console.log(context.payload.pull_request.changed_files);
27-
return context.payload.pull_request.changed_files ;
25+
const changedFiles = context.payload.pull_request.changed_files;
26+
console.log("Number of files changed:", changedFiles);
27+
return { changed_file_cnt: changedFiles } ;
2828
2929
- name: Check file changes
3030
uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36
31-
if: ${{ steps.changed_files.outputs.changed_files }} < 500
31+
if: ${{ steps.changed_files.outputs.changed_file_cnt }} < 500
3232
id: changes
3333
with:
3434
filters: |

0 commit comments

Comments
 (0)