Repository navigation
Invalid interpolations are hard to debug #447
Description
I have a case where I need to perform a sed during a dry_run (because I need this update to apply before compilation of the binary being released), so I'm using the verify hook to do it.
Something like,
plugins:
- - "@semantic-release/exec"
- verifyConditionsCmd: |
sed -i 's/^version: .*$/version: ${nextRelease.version}/' package.yamlThis won't work because nextRelease is not defined yet, so the incorrect interpolation produces an error. Trouble is, it took forever for me to debug this, because this sort of failure produces no useful output:
[3:20:54 PM] [semantic-release] › ℹ Start step "verifyConditions" of plugin "@semantic-release/exec"
[3:20:54 PM] [semantic-release] › ✘ Failed step "verifyConditions" of plugin "@semantic-release/exec"
[3:20:54 PM] [semantic-release] › ℹ Start step "verifyConditions" of plugin "@semantic-release/github"
[3:20:54 PM] [semantic-release] [@semantic-release/github] › ℹ Verify GitHub authentication (https://github.com/proxy/api.github.com/)
[3:20:54 PM] [semantic-release] › ✔ Completed step "verifyConditions" of plugin "@semantic-release/github"
[3:20:54 PM] [semantic-release] › ⚠ Skip step "fail" of plugin "@semantic-release/exec" in dry-run mode
[3:20:54 PM] [semantic-release] › ⚠ Skip step "fail" of plugin "@semantic-release/github" in dry-run mode
[3:20:54 PM] [semantic-release] › ✘ EVERIFYCONDITIONS
Error: AggregateError:
SemanticReleaseError
at verifyConditions (file:///home/runner/work/_actions/cycjimmy/semantic-release-action/v4/node_modules/@semantic-release/exec/index.js:17:13)
at async validator (file:///home/runner/work/_actions/cycjimmy/semantic-release-action/v4/node_modules/semantic-release/lib/plugins/normalize.js:36:24)
at async file:///home/runner/work/_actions/cycjimmy/semantic-release-action/v4/node_modules/semantic-release/lib/plugins/pipeline.js:38:36
at async Promise.all (index 0)
at async next (file:///home/runner/work/_actions/cycjimmy/semantic-release-action/v4/node_modules/semantic-release/node_modules/p-reduce/index.js:15:44)
I'm guessing it's because in this code,
try {
await exec("verifyConditionsCmd", pluginConfig, context);
} catch (error) {
throw new SemanticReleaseError(error.stdout, "EVERIFYCONDITIONS");
}error.stdout is empty, so nothing is seen.
I eventually figured out that I have to use verifyReleaseCmd for my use-case, but I think it's a bug that there is absolutely no output when this sort of interpolation failure occurs. Interpolation like this is generally error-prone, so good feedback seems important.
Activity
travi commentedon Apr 25, 2025
this is fair feedback. would you be interested in contributing tests to prove this situation and possibly continue that effort toward improving the implementation to resolve it?
pbrisbin commentedon Apr 28, 2025
Sure, I'll see what I can do.
Print more useful error for non-process failure
pbrisbin commentedon Apr 28, 2025
Gave it a shot in #449.
github-actions commentedon May 9, 2025
🎉 This issue has been resolved in version 7.1.0 🎉
The release is available on:
Your semantic-release bot 📦🚀