Skip to content

Conversation

@MattSturgeon
Copy link

@MattSturgeon MattSturgeon commented Sep 5, 2025

Description

Fixes #210

Only pass --option commit-lockfile-summary commitMessage to nix flake update when the commit-msg is defined; i.e. non-empty.

Changed the input's default to "" to allow it to be empty

Checklist

Summary by CodeRabbit

  • New Features

    • No default commit message is applied when running updates; if you don’t supply a commit message, none will be set.
    • The lockfile summary option is omitted when the commit message is empty, aligning behavior with user input.
  • Tests

    • Added test coverage for the empty/omitted commit message scenario to ensure correct argument generation.

@coderabbitai
Copy link

coderabbitai bot commented Sep 5, 2025

Walkthrough

The PR removes the default commit message in action.yml and updates makeNixCommandArgs to only include commit-lockfile-summary options when a non-empty commit message is provided. Tests are added to cover the empty commit message case.

Changes

Cohort / File(s) Summary
Action input config
action.yml
Removed default value for commit-msg input (changed from "flake.lock: Update" to empty string).
Nix command arg construction
src/nix.ts
Made lockfileSummaryFlags conditional: include --option commit-lockfile-summary <msg> only when commitMessage is non-empty; otherwise omit.
Tests
src/nix.test.ts
Added test case asserting that an empty commitMessage yields args without commit-lockfile-summary, i.e., ["flake","update","--commit-lock-file"].

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant Caller
  participant makeNixCommandArgs

  Caller->>makeNixCommandArgs: nixOptions, flakeInputs, commitMessage
  alt commitMessage is non-empty
    makeNixCommandArgs->>makeNixCommandArgs: Add ["--option","commit-lockfile-summary", commitMessage]
  else commitMessage is empty
    makeNixCommandArgs->>makeNixCommandArgs: Omit commit-lockfile-summary option
  end
  makeNixCommandArgs-->>Caller: ["flake","update","--commit-lock-file", ...flags]
  note over Caller: Downstream nix uses configured/default summary when not overridden
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Assessment against linked issues

Objective Addressed Explanation
Remove default for commit-msg input in action config [#210]
Include commit-lockfile-summary only when commitMessage is non-empty [#210]

Poem

I nibbled the lock, then hopped away,
No message left—let Nix have its say.
When carrots sing, I’ll pass a note,
Else silence guides the flake I wrote.
Commit or not, I twitch my ear—
Defaults by Nix, the path is clear. 🥕🐇


📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between f81a117 and 6d43cae.

⛔ Files ignored due to path filters (2)
  • dist/index.js is excluded by !**/dist/**
  • dist/index.js.map is excluded by !**/dist/**, !**/*.map
📒 Files selected for processing (3)
  • action.yml (1 hunks)
  • src/nix.test.ts (1 hunks)
  • src/nix.ts (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
src/nix.ts (1)
dist/index.js (1)
  • lockfileSummaryFlags (95329-95329)
🔇 Additional comments (3)
action.yml (1)

15-15: LGTM! Change aligns with PR objectives.

The default value change from "flake.lock: Update" to an empty string allows users to rely on nix's own configuration defaults when no commit message is explicitly provided.

src/nix.ts (1)

18-20: LGTM! Conditional logic correctly implements the intended behavior.

The conditional logic ensures that --option commit-lockfile-summary is only passed to nix when a commit message is explicitly provided (non-empty), addressing the core issue where the CLI was unconditionally overriding flake/global nix configuration.

src/nix.test.ts (1)

15-22: LGTM! Test case covers the new empty commit message behavior.

The new test case validates that when commitMessage is empty, the generated command excludes the --option commit-lockfile-summary flags, ensuring nix uses its own defaults. This test provides good coverage for the conditional logic change in src/nix.ts.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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 and usage tips.

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.

Only define commit-lock-file-summary when the commit-msg input is explicitly defined (non-empty)

1 participant