feat: Added nix option

fix: nix options position

Use empty list


fix options
This commit is contained in:
xgroleau🐢 2023-03-28 16:38:02 -04:00 committed by Cole Helbling
parent bc75a5b55e
commit b55ee105d9
2 changed files with 14 additions and 2 deletions

View File

@ -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' description: 'GPG Private Key Passphrase for the GPG Private Key with which to sign the commits in the PR to be created'
required: false required: false
default: '' default: ''
nix-options:
description: 'A space-separated list of options to pass to the nix command'
required: false
default: ''
outputs: outputs:
pull-request-number: pull-request-number:
description: 'The number of the opened pull request' description: 'The number of the opened pull request'
@ -146,6 +150,7 @@ runs:
GIT_AUTHOR_EMAIL: ${{ env.GIT_AUTHOR_EMAIL }} GIT_AUTHOR_EMAIL: ${{ env.GIT_AUTHOR_EMAIL }}
GIT_COMMITTER_NAME: ${{ env.GIT_COMMITTER_NAME }} GIT_COMMITTER_NAME: ${{ env.GIT_COMMITTER_NAME }}
GIT_COMMITTER_EMAIL: ${{ env.GIT_COMMITTER_EMAIL }} GIT_COMMITTER_EMAIL: ${{ env.GIT_COMMITTER_EMAIL }}
NIX_OPTIONS: ${{ inputs.nix-options }}
TARGETS: ${{ inputs.inputs }} TARGETS: ${{ inputs.inputs }}
COMMIT_MSG: ${{ inputs.commit-msg }} COMMIT_MSG: ${{ inputs.commit-msg }}
PATH_TO_FLAKE_DIR: ${{ inputs.path-to-flake-dir }} PATH_TO_FLAKE_DIR: ${{ inputs.path-to-flake-dir }}

View File

@ -5,12 +5,19 @@ if [[ -n "$PATH_TO_FLAKE_DIR" ]]; then
cd "$PATH_TO_FLAKE_DIR" cd "$PATH_TO_FLAKE_DIR"
fi fi
options=()
if [[ -n "$NIX_OPTIONS" ]]; then
for option in $NIX_OPTIONS; do
options+=("${option}")
done
fi
if [[ -n "$TARGETS" ]]; then if [[ -n "$TARGETS" ]]; then
inputs=() inputs=()
for input in $TARGETS; do for input in $TARGETS; do
inputs+=("--update-input" "$input") inputs+=("--update-input" "$input")
done 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 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 fi