| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
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
| Back | FazBrowse Home | New Git URL |
Uh oh!
There was an error while loading. Please reload this page.
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.
Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality⚠️ Potential issue
timeout-minutes does not accept expressions – these jobs will fail to parse
timeout-minutes expects a literal integer. GitHub Actions currently rejects expressions such as
${{ contains(matrix.os, 'windows') && 40 || 30 }} with a schema-validation error (expected type: integer). As a result, both rust_tests and snippets_cpython jobs will never start.
Keep the workflow simple (per maintainer guidance) by using a constant, e.g. 40 minutes for all OSes, or split the job into two OS-specific matrix entries.
(Apply the same change to the snippets_cpython job.)
Also applies to: 242-242
🤖 Prompt for AI AgentsSorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
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.
Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Qualitythis evaluates to either 30 or 40
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
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.
Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality@ShaharNaveh You're absolutely right! I apologize for the incorrect assessment. GitHub Actions does indeed support expressions in the timeout-minutes field, and your expression ${{ contains(matrix.os, 'windows') && 40 || 30 }} will correctly evaluate to 40 minutes for Windows runners and 30 minutes for other OS runners.
Thank you for the correction - the workflow syntax is perfectly valid as implemented.
🌐 Web query:
💡 Result:
GitHub Actions' timeout-minutes does not fully support expressions like repository or environment variables without specific type conversion workarounds. Here are the facts and the current documentation status:
Workaround:
You can use the fromJSON() function to convert strings that contain numbers to a numeric value, making it possible to use expressions for timeout-minutes:
This treats a string like "10" as the number 10, which is accepted by the workflow syntax[3].
Documentation coverage:
The official [GitHub Expressions Documentation][2][8] describes how expressions are used generally—including in workflow conditions, environment variables, and other parameters—but it does not explicitly document that timeout-minutes requires a numeric type or how to use type conversion workarounds.
Global/default setting:
Setting timeout-minutes in the defaults block at the workflow level is not supported; it must be set at the job level. Only keys under defaults.run are currently accepted[6][9].
In summary:
References for further details:
Citations:
🌐 Web query:
💡 Result:
GitHub Actions expressions do not support a native ternary operator (? :) syntax, but you can achieve similar behavior using the && and || logical operators in combination. This pattern is commonly referred to as a "fake ternary" in the GitHub Actions community[1][5][6].
Syntax for Ternary-like Expressions
The general syntax is:
${{ condition && value_if_true || value_if_false }}For example, to conditionally set a parameter based on input:
This adds --production if inputs.production is 'true', otherwise adds nothing[1][3].
Important Caveats
Chaining Multiple Conditions
You can chain ternary-like expressions for multiple conditions using nested parentheses:
${{ cond1 && result1 || (cond2 && result2 || default_value) }}This approach is often used for more complex multi-branch logic, such as in runs-on or environment variable settings[7]:
Or a simpler three-way case:
${{ inputs.app == 'foo' && 'foo-bg-deploy' || ( inputs.app == 'bar' && 'star-bar-bg-deploy' || 'rocket-lite-bg-deploy' )}}If neither condition is met, the final value (rocket-lite-bg-deploy in this example) is selected[7].
Combining with contains, &&, and ||
You can freely use contains, &&, and || in these expressions:
This example will set timeout-minutes to 30 if the branch is main, otherwise 10.
Summary Table
For advanced logic or if you hit expression complexity limits, you can fall back to a pre-step in a shell script to set the value, then use that value in your step[2][4].
References:
Citations:
@ShaharNaveh You're absolutely correct, and I apologize for the misinformation in my original assessment.
The web search confirms that GitHub Actions does support ternary-like expressions using && and || operators in timeout-minutes. Your expression ${{ contains(matrix.os, 'windows') && 40 || 30 }} is perfectly valid syntax that will evaluate to 40 minutes for Windows runners and 30 minutes for other OS runners.
This is a common pattern in GitHub Actions workflows, often called a "fake ternary" since GitHub Actions doesn't have native ternary operator (? :) syntax. The expression works because both 40 and 30 are numeric literals that resolve directly to the expected integer type.
Thank you for the correction - the workflow implementation is correct as written.
✏️ Learnings added
Learnt from: ShaharNaveh PR: RustPython/RustPython#5947 File: .github/workflows/ci.yaml:116-116 Timestamp: 2025-07-11T09:35:43.545Z Learning: GitHub Actions timeout-minutes field supports expressions that evaluate to integers, such as `${{ contains(matrix.os, 'windows') && 40 || 30 }}`, which will conditionally set different timeout values based on the runner OS.Learnt from: ShaharNaveh PR: RustPython/RustPython#5947 File: .github/workflows/ci.yaml:116-116 Timestamp: 2025-07-11T09:35:43.545Z Learning: GitHub Actions supports ternary-like expressions using `&&` and `||` operators in timeout-minutes. The syntax `${{ condition && value_if_true || value_if_false }}` is valid and commonly used, such as `${{ contains(matrix.os, 'windows') && 40 || 30 }}` which evaluates to 40 for Windows runners and 30 for others.🧠 Learnings used
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.