Skip to content

Conversation

@Julusian
Copy link
Member

@Julusian Julusian commented Dec 17, 2025

About the Contributor

This pull request is posted on behalf of myself.

Type of Contribution

This is a: Bug fix

Current Behavior

While making a release of a library, I was confused that it didnt make a commit. I then discovered it had made a tag, based on the existing commit.

This is because husky is misconfigured and is causing the commit to fail.

New Behavior

This ensures that when a commaand fails, it will cause a rejection and result in an error.

Skip running any commit hooks when making the commit, as they shouldn't matter and cause unexpected failures in this simple command

Testing Instructions

Other Information

Status

  • PR is ready to be reviewed.
  • The functionality has been tested by the author.
  • Relevant unit tests has been added / updated.
  • Relevant documentation (code comments, system documentation) has been added / updated.

Summary

This PR fixes two critical issues in the version update automation script:

Error Handling Fix

The execPromise wrapper function was modified to properly reject promises on command failures. Previously, the function would resolve with the error object instead of rejecting, causing error conditions to be silently passed through as successful resolutions. This is now corrected to use standard Promise semantics: reject(e) on errors and resolve(out) on successful output.

Commit Hook Bypass

Added the --no-verify flag to the git commit command that creates the release commit. This prevents git hooks (such as husky) from running during the automatic versioning commit, which could cause unexpected failures and prevent the commit from being created. This ensures that the version bump and corresponding tag are always created together, resolving an issue where tags could be created without corresponding commits due to hook misconfiguration.

Formatting

The code properly uses tabs for indentation as per project standards.

@Julusian Julusian requested a review from a team as a code owner December 17, 2025 16:19
@coderabbitai
Copy link

coderabbitai bot commented Dec 17, 2025

Walkthrough

The version update script's error handling has been refined by modifying the execPromise wrapper to properly reject Promises on shell command errors instead of resolving with error values. Additionally, a --no-verify flag was added to the final git commit invocation to bypass commit hooks during automatic versioning.

Changes

Cohort / File(s) Summary
Version Update Tooling
bin/updateVersion.mjs
Enhanced execPromise Promise semantics to reject on errors and resolve on success; added --no-verify flag to git commit to skip pre-commit hooks

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

  • The execPromise error handling change affects downstream code—verify all call sites properly handle Promise rejections
  • Confirm that skipping commit hooks with --no-verify aligns with project's versioning workflow and CI/CD practices

Poem

🐰 A promise kept is true indeed,
When errors flow where they should lead—
No hooks to slow our version train,
Just clean commits without a chain!

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly and accurately summarizes the two main changes: fixing command failure rejection and adding --no-verify to commits.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/commit-failing

📜 Recent review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 283cb13 and 95a5fc7.

📒 Files selected for processing (1)
  • bin/updateVersion.mjs (2 hunks)
🔇 Additional comments (2)
bin/updateVersion.mjs (2)

40-41: LGTM! Proper Promise rejection on command failure.

The updated implementation correctly rejects the Promise when exec returns an error, ensuring that command failures propagate properly. The short-circuit evaluation (e && reject(e)) || resolve(out) is functionally correct and will prevent the scenario described in the PR where tags were created without corresponding commits.


186-186: LGTM! Appropriate use of --no-verify for automated commits.

Adding --no-verify to skip commit hooks is the correct approach for automated versioning scripts. This prevents local developer hooks (like husky) from interfering with the release process, which addresses the issue described in the PR where commits could fail and leave orphaned tags.


Comment @coderabbitai help to get the list of available commands and usage tips.

Comment on lines +40 to +41
const execPromise = (command) =>
new Promise((resolve, reject) => exec(command, (e, out) => (e && reject(e)) || resolve(out)))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be better to use:

const execPromise = promisify(exec)

Like in https://github.com/Sofie-Automation/sofie-package-manager/blob/main/scripts/test-everything.js#L6 and some other places?

}

await execPromise(`git commit -m "chore(release): v${nextVersion}"`)
await execPromise(`git commit --no-verify -m "chore(release): v${nextVersion}"`)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not keen on this - I think if there is a pre-commit that fails, something weird is going on and we shouldn't proceed with making a new version until it's fixed.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

eh... this is only commiting a readme and the package.json so the precommit isn't all that relevant imo

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.

5 participants