The code above still fails and exits when attempting to read the resource.
Originally created by @jjuliano on GitHub (Sep 3, 2024).
I have a template that reads an optional resource.
`
field: String? = read("env:STRING")
`
However, this causes an error when the resource is read because `env:STRING` needs to exist, so I added a default value.
`
field: String? = read("env:STRING") ?? "DEFAULT_STRING"
`
The code above still fails and exits when attempting to read the resource.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Originally created by @jjuliano on GitHub (Sep 3, 2024).
I have a template that reads an optional resource.
field: String? = read("env:STRING")However, this causes an error when the resource is read because
env:STRINGneeds to exist, so I added a default value.field: String? = read("env:STRING") ?? "DEFAULT_STRING"The code above still fails and exits when attempting to read the resource.
@shurshun commented on GitHub (Sep 3, 2024):
This one should work:
field: String? = read?("env:STRING") ?? "DEFAULT_STRING"