Skip to content
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

[build-tools] Default missing outputs to empty string #500

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

sjchmiela
Copy link
Contributor

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:

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,

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.

@sjchmiela sjchmiela requested a review from szdziedzic as a code owner January 21, 2025 21:14
Copy link

linear bot commented Jan 21, 2025

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.

1 participant