From 0f6e7d684ec3787a7520062f9441177208cdb5df Mon Sep 17 00:00:00 2001 From: Cole Helbling Date: Mon, 29 Nov 2021 11:10:08 -0800 Subject: [PATCH] Allow consumers to update specific flake inputs --- action.yml | 7 ++++++- update-input-or-inputs.sh | 12 ++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100755 update-input-or-inputs.sh diff --git a/action.yml b/action.yml index 0d59255..e9fecd3 100644 --- a/action.yml +++ b/action.yml @@ -1,9 +1,14 @@ name: 'Update flake.lock' description: 'Update your flake.lock and send a PR' +inputs: + inputs: + description: 'A space-separated list of inputs to update. Leave empty to update all inputs.' + required: false + default: '' runs: using: "composite" steps: - - run: nix flake update --commit-lock-file + - run: ./update-input-or-inputs.sh ${{ inputs.inputs }} shell: bash env: GIT_AUTHOR_NAME: github-actions[bot] diff --git a/update-input-or-inputs.sh b/update-input-or-inputs.sh new file mode 100755 index 0000000..d01d0e3 --- /dev/null +++ b/update-input-or-inputs.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash +to_update=$* + +if [ -n "$to_update" ]; then + inputs=() + for input in $to_update; do + inputs+=("--update-input" "$input") + done + nix flake lock "${inputs[@]}" --commit-lock-file +else + nix flake update --commit-lock-file +fi