-
Notifications
You must be signed in to change notification settings - Fork 766
[CI] 2nd attempt to skip filtering large PR #17761
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
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.
Unfortunately, #17728 doesn't work as expected. The step is not skipped. |
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; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"For numerical comparison, the fromJSON() function can be used to convert a string to a number. For more information on the fromJSON() function, see fromJSON."
Can we just use this in the if
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we can. My understanding is that if
in steps is not Javascript. We can only access context
only in JavaScript
( script in steps).
"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."
"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. "
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where is that explanation from?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh, you meant we call fromJSON
to convert the value to number in if
.
Certainly we can try.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where is that explanation from?
GPT. :P
This reverts commit 2b82995.
|
maybe that means its not a string?A |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dont really know js but seems not totally insane
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.
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.