Skip to content

Commit 61d5e87

Browse files
authored
[3.12] Fix using check_source flags as bool (GH-121848) (#121855)
1 parent 106d645 commit 61d5e87

File tree

2 files changed

+24
-3
lines changed

2 files changed

+24
-3
lines changed

.github/workflows/build.yml

+23-3
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,30 @@ jobs:
3535
runs-on: ubuntu-latest
3636
timeout-minutes: 10
3737
outputs:
38+
# Some of the referenced steps set outputs conditionally and there may be
39+
# cases when referencing them evaluates to empty strings. It is nice to
40+
# work with proper booleans so they have to be evaluated through JSON
41+
# conversion in the expressions. However, empty strings used like that
42+
# may trigger all sorts of undefined and hard-to-debug behaviors in
43+
# GitHub Actions CI/CD. To help with this, all of the outputs set here
44+
# that are meant to be used as boolean flags (and not arbitrary strings),
45+
# MUST have fallbacks with default values set. A common pattern would be
46+
# to add ` || false` to all such expressions here, in the output
47+
# definitions. They can then later be safely used through the following
48+
# idiom in job conditionals and other expressions. Here's some examples:
49+
#
50+
# if: fromJSON(needs.check_source.outputs.run-docs)
51+
#
52+
# ${{
53+
# fromJSON(needs.check_source.outputs.run_tests)
54+
# && 'truthy-branch'
55+
# || 'falsy-branch'
56+
# }}
57+
#
3858
run-docs: ${{ steps.docs-changes.outputs.run-docs || false }}
39-
run_tests: ${{ steps.check.outputs.run_tests }}
40-
run_hypothesis: ${{ steps.check.outputs.run_hypothesis }}
41-
config_hash: ${{ steps.config_hash.outputs.hash }}
59+
run_tests: ${{ steps.check.outputs.run_tests || false }}
60+
run_hypothesis: ${{ steps.check.outputs.run_hypothesis || false }}
61+
config_hash: ${{ steps.config_hash.outputs.hash }} # str
4262
steps:
4363
- uses: actions/checkout@v4
4464
- name: Check for source changes

.github/workflows/reusable-windows.yml

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ on:
22
workflow_call:
33
inputs:
44
free-threading:
5+
description: Whether to compile CPython in free-threading mode
56
required: false
67
type: boolean
78
default: false

0 commit comments

Comments
 (0)