Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[build-tools] Default missing output values to empty string (#500)
# Why https://exponent-internal.slack.com/archives/C06EFBQK3B7/p1737419576613249 # How When we're collecting job outputs from steps, we treat values as strings which may include template expressions. So: ```yaml outputs: foo: bar # sets foo="bar" build_id: ${{ steps.find_build.outputs.build_id }} # acts how `${steps.find_build.outputs.build_id}` in JS would act key: ios-${{ ... }} # concatenates "ios-" and whatever template expression evaluates to counter: ${{ 2 + 3 }} # sets counter="5" ``` I see a way of reasoning about `outputs` that they are never expected to be used as static values, i.e. `foo: bar` and `key: ios-${{ ... }}` are never what the user will want to use and instead we should always use value as an expression. However, ```yaml outputs: foo: "\"bar\"" build_id: steps.find_build.outputs.build_id key: "\"ios-\" + ..." counter: 2 + 3 ``` looks strange to me. We could also not stringify results and do what James suggests, let `undefined` be `undefined`. However, that would also mean `2` is `2`, not `"2"`. And I think it would be better for users that _do_ want this level of type-correctness to explicitly do `counter: ${{ toJSON(2) }}` and then `fromJSON(needs.setup.outputs.counter)`. # Test Plan Added test.
- Loading branch information