Skip to content

fix: do not report committed=true for empty commit SHA - #757

Merged
EndBug merged 3 commits into
mainfrom
fix/committed-empty-sha
Aug 8, 2026
Merged

fix: do not report committed=true for empty commit SHA#757
EndBug merged 3 commits into
mainfrom
fix/committed-empty-sha

Conversation

@EndBug

@EndBug EndBug commented Aug 8, 2026

Copy link
Copy Markdown
Owner

Summary

  • Only set the committed output to true when git.commit() returns a non-empty SHA.
  • Fail the step if simple-git resolves without creating a commit, so workflows that gate on committed no longer get a false success signal.

Test plan

  • Unit tests / lint pass (npm test)
  • Simulate a no-op commit path (empty SHA from simple-git) and confirm the action fails with committed=false
  • Normal commit with staged changes still sets committed=true and populates commit_sha / commit_long_sha

Made with Cursor

simple-git can resolve successfully with an empty commit hash when no
commit was actually created; keep the committed output accurate.

Co-authored-by: Cursor <cursoragent@cursor.com>
@coderabbitai

coderabbitai Bot commented Aug 8, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@EndBug, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 57 seconds

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: fbf82e99-5b4a-4d32-a413-c1236a436ca0

📥 Commits

Reviewing files that changed from the base of the PR and between ebc24bf and c4b4c24.

📒 Files selected for processing (2)
  • lib/index.js
  • src/main.ts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR tightens the GitHub Action’s commit behavior so it only reports committed=true when simple-git returns a non-empty commit SHA, avoiding false-positive “success” signals for no-op commits.

Changes:

  • Add a guard to treat an empty data.commit as a failure instead of reporting committed=true.
  • Update the compiled runtime bundle (lib/index.js) to include the same empty-SHA protection.

Reviewed changes

Copilot reviewed 1 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/main.ts Adds an explicit empty-SHA check after git.commit() before setting commit-related outputs.
lib/index.js Updates the built distribution output to reflect the empty-SHA check at runtime.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/main.ts Outdated
Comment on lines +121 to +125
// simple-git can resolve with an empty SHA when no commit was created
// (e.g. nothing left to commit). Do not report a false success.
if (!data.commit) {
throw new Error(
'Commit did not produce a SHA; refusing to report committed=true.',
Let empty-SHA failures reject so the outer catch stops the action instead of continuing after setFailed.

Co-authored-by: Cursor <cursoragent@cursor.com>
@EndBug
EndBug enabled auto-merge (squash) August 8, 2026 22:20
Co-authored-by: Cursor <cursoragent@cursor.com>
@EndBug
EndBug merged commit f1bb0cc into main Aug 8, 2026
10 checks passed
@EndBug
EndBug deleted the fix/committed-empty-sha branch August 8, 2026 22:21
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.

2 participants