Allow consumers to update specific flake inputs

This commit is contained in:
Cole Helbling 2021-11-29 11:10:08 -08:00 committed by Cole Helbling
parent 8145cc6e00
commit 0f6e7d684e
2 changed files with 18 additions and 1 deletions

View File

@ -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]

12
update-input-or-inputs.sh Executable file
View File

@ -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