Skip to content

[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

Merged
merged 5 commits into from
Apr 1, 2025

Conversation

jsji
Copy link
Contributor

@jsji jsji commented Apr 1, 2025

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.
@jsji jsji requested a review from a team as a code owner April 1, 2025 01:24
@jsji jsji self-assigned this Apr 1, 2025
@jsji jsji temporarily deployed to WindowsCILock April 1, 2025 01:24 — with GitHub Actions Inactive
@jsji
Copy link
Contributor Author

jsji commented Apr 1, 2025

Unfortunately, #17728 doesn't work as expected. The step is not skipped.
https://github.com/intel/llvm/actions/runs/14184748358/job/39737961081?pr=17710
This is 2nd attempt to fix it.

@jsji jsji temporarily deployed to WindowsCILock April 1, 2025 01:41 — with GitHub Actions Inactive
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;
Copy link
Contributor

@sarnex sarnex Apr 1, 2025

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."

https://docs.github.com/en/enterprise-cloud@latest/actions/writing-workflows/choosing-what-your-workflow-does/evaluate-expressions-in-workflows-and-actions

Can we just use this in the if?

Copy link
Contributor Author

@jsji jsji Apr 1, 2025

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. "

Copy link
Contributor

@sarnex sarnex Apr 1, 2025

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?

Copy link
Contributor Author

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.

Copy link
Contributor Author

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

@jsji jsji requested a review from sarnex April 1, 2025 14:42
sarnex
sarnex previously approved these changes Apr 1, 2025
@sarnex
Copy link
Contributor

sarnex commented Apr 1, 2025

Error: The template is not valid. Newtonsoft.Json.JsonReaderException: Error reading JToken from JsonReader. Path '', line 0, position 0.

@sarnex
Copy link
Contributor

sarnex commented Apr 1, 2025

maybe that means its not a string?A

@sarnex sarnex dismissed their stale review April 1, 2025 14:49

failing

@jsji jsji temporarily deployed to WindowsCILock April 1, 2025 14:51 — with GitHub Actions Inactive
Copy link
Contributor

@sarnex sarnex left a 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

@jsji jsji temporarily deployed to WindowsCILock April 1, 2025 15:11 — with GitHub Actions Inactive
@jsji jsji temporarily deployed to WindowsCILock April 1, 2025 15:11 — with GitHub Actions Inactive
@uditagarwal97 uditagarwal97 merged commit 79f07bf into intel:sycl Apr 1, 2025
30 of 35 checks passed
ggojska pushed a commit to ggojska/llvm that referenced this pull request Apr 7, 2025
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants