update-flake-lock icon indicating copy to clipboard operation
update-flake-lock copied to clipboard

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

Open MattSturgeon opened this issue 4 months ago • 2 comments

It is possible to configure commit-lock-file-summary via a flake's nixConfig or via global nix config (e.g. specified in the install-nix action).

However, if --commit-lock-file-summary (or more precisely, --option commit-lockfile-summary) is supplied at the CLI, the configured value will be overridden by the value supplied at the CLI.

Instead, I'd propose removing the commit-msg input's default, and then only doing .concat(lockfileSummaryFlags) when commitMessage is truthy (non-empty). Alternatively, lockfileSummaryFlags could itself be an empty string when commitMessage is.

The default value specified in the input is usually[^1] identical to the default used by nix, so relying on nix's default when the input isn't defined seems like a reasonable behaviour.

The input: https://github.com/DeterminateSystems/update-flake-lock/blob/d6b471071f1d497ac41ef90623a618ba811bc98c/action.yml#L12-L15

The lockfileSummaryFlags definition: https://github.com/DeterminateSystems/update-flake-lock/blob/d6b471071f1d497ac41ef90623a618ba811bc98c/src/nix.ts#L12-L22

The concat: https://github.com/DeterminateSystems/update-flake-lock/blob/d6b471071f1d497ac41ef90623a618ba811bc98c/src/nix.ts#L30

[^1]: for top-level flake.lock files it is identical. For nested flake.lock files nix will default the commit summary to something like path/to/flake.lock: Update relative to the root of the flake's source repo.

MattSturgeon avatar Aug 30 '25 13:08 MattSturgeon