Skip to content

Invalid interpolations are hard to debug #447

Closed

Description

@pbrisbin

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.yaml

This 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

  1. travi commented on Apr 25, 2025

    @travi
    Member

    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?

  2. pbrisbin commented on Apr 28, 2025

    @pbrisbin
    ContributorAuthor

    Sure, I'll see what I can do.

  3. added a commit that references this issue on Apr 28, 2025
    6284bfe
  4. pbrisbin commented on Apr 28, 2025

    @pbrisbin
    ContributorAuthor

    Gave it a shot in #449.

  5. github-actions commented on May 9, 2025

    @github-actions

    🎉 This issue has been resolved in version 7.1.0 🎉

    The release is available on:

    Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions