Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ inputs:
commit-msg:
description: "The message provided with the commit"
required: false
default: "flake.lock: Update"
default: ""
base:
description: "Sets the pull request base branch. Defaults to the branch checked out in the workflow."
required: false
Expand Down
6 changes: 1 addition & 5 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -95326,11 +95326,7 @@ function makeNixCommandArgs(nixOptions, flakeInputs, commitMessage) {
"--update-input",
input
]);
const lockfileSummaryFlags = [
"--option",
"commit-lockfile-summary",
commitMessage
];
const lockfileSummaryFlags = commitMessage ? ["--option", "commit-lockfile-summary", commitMessage] : [];
const updateLockMechanism = flakeInputFlags.length === 0 ? "update" : "lock";
return nixOptions.concat(["flake", updateLockMechanism]).concat(flakeInputFlags).concat(["--commit-lock-file"]).concat(lockfileSummaryFlags);
}
Expand Down
2 changes: 1 addition & 1 deletion dist/index.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions src/nix.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@ type TestCase = {

test("Nix command arguments", () => {
const testCases: TestCase[] = [
{
inputs: {
nixOptions: [],
flakeInputs: [],
commitMessage: "",
},
expected: ["flake", "update", "--commit-lock-file"],
},
{
inputs: {
nixOptions: ["--log-format", "raw"],
Expand Down
8 changes: 3 additions & 5 deletions src/nix.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,9 @@ export function makeNixCommandArgs(
// configured via `--option <alias name> <option value>`
// (https://github.com/NixOS/nix/issues/10989).
// So, we go the long way so that we can support versions both before and after Nix 2.23.0.
const lockfileSummaryFlags = [
"--option",
"commit-lockfile-summary",
commitMessage,
];
const lockfileSummaryFlags = commitMessage
? ["--option", "commit-lockfile-summary", commitMessage]
: [];

const updateLockMechanism = flakeInputFlags.length === 0 ? "update" : "lock";

Expand Down