-
Notifications
You must be signed in to change notification settings - Fork 0
previewUrl silently fails when env var is unset or empty #37
Description
Problem
When app.previewUrl is set to an env var name (e.g. 'TEST_STORE_URL') and that variable is unset or empty in CI, the resolution falls back to the literal string 'TEST_STORE_URL'. This isn't a valid URL, so resolveBaseUrl returns null and the action fails with a generic error:
Error: No base URL available. Set app.previewUrl or app.startCommand + app.readyWhen in config.
This is confusing because the config does set app.previewUrl — the user has no idea the env var lookup silently failed.
Expected behaviour
If app.previewUrl is set to a string that looks like an env var name (no protocol) and process.env[value] is undefined or empty, the action should fail fast with a clear, actionable message:
Error: app.previewUrl is set to 'TEST_STORE_URL' but process.env.TEST_STORE_URL is not defined.
Make sure the variable is passed to the git-glimpse workflow step via env:.
Suggested fix
In resolveBaseUrl, after resolving the env var, check whether the result is a valid URL before returning it. If not, throw (or log + return null) with the specific variable name called out.