Skip to content

Commit

Permalink
feat: Added nix option
Browse files Browse the repository at this point in the history
fix: nix options position

Use empty list


fix options
  • Loading branch information
xgroleau authored and cole-h committed Mar 29, 2023
1 parent bc75a5b commit b55ee10
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
5 changes: 5 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,10 @@ inputs:
description: 'GPG Private Key Passphrase for the GPG Private Key with which to sign the commits in the PR to be created'
required: false
default: ''
nix-options:
description: 'A space-separated list of options to pass to the nix command'
required: false
default: ''
outputs:
pull-request-number:
description: 'The number of the opened pull request'
Expand Down Expand Up @@ -146,6 +150,7 @@ runs:
GIT_AUTHOR_EMAIL: ${{ env.GIT_AUTHOR_EMAIL }}
GIT_COMMITTER_NAME: ${{ env.GIT_COMMITTER_NAME }}
GIT_COMMITTER_EMAIL: ${{ env.GIT_COMMITTER_EMAIL }}
NIX_OPTIONS: ${{ inputs.nix-options }}
TARGETS: ${{ inputs.inputs }}
COMMIT_MSG: ${{ inputs.commit-msg }}
PATH_TO_FLAKE_DIR: ${{ inputs.path-to-flake-dir }}
Expand Down
11 changes: 9 additions & 2 deletions update-flake-lock.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,19 @@ if [[ -n "$PATH_TO_FLAKE_DIR" ]]; then
cd "$PATH_TO_FLAKE_DIR"
fi

options=()
if [[ -n "$NIX_OPTIONS" ]]; then
for option in $NIX_OPTIONS; do
options+=("${option}")
done
fi

if [[ -n "$TARGETS" ]]; then
inputs=()
for input in $TARGETS; do
inputs+=("--update-input" "$input")
done
nix flake lock "${inputs[@]}" --commit-lock-file --commit-lockfile-summary "$COMMIT_MSG"
nix "${options[@]}" flake lock "${inputs[@]}" --commit-lock-file --commit-lockfile-summary "$COMMIT_MSG"
else
nix flake update --commit-lock-file --commit-lockfile-summary "$COMMIT_MSG"
nix "${options[@]}" flake update --commit-lock-file --commit-lockfile-summary "$COMMIT_MSG"
fi

0 comments on commit b55ee10

Please sign in to comment.