diff --git a/.github/workflows/reusable-update-flake-lock.yml b/.github/workflows/reusable-update-flake-lock.yml index 42d1a4cf..9c11d81f 100644 --- a/.github/workflows/reusable-update-flake-lock.yml +++ b/.github/workflows/reusable-update-flake-lock.yml @@ -9,6 +9,11 @@ on: default: '["self-hosted"]' required: false type: string + flake-input: + description: 'Parameter for determining which flake will get updated' + default: '' + required: false + type: string secrets: NIX_GITHUB_TOKEN: @@ -46,7 +51,7 @@ jobs: curl -fsSL --proto '=https' --tlsv1.2 \ https://raw.githubusercontent.com/metacraft-labs/nixos-modules/main/scripts/commit_flake_update.bash \ -o commit_flake_update.bash - bash commit_flake_update.bash + FLAKE_INPUT=${{ inputs.flake-input }} bash commit_flake_update.bash - uses: tibdex/github-app-token@v2.1.0 id: generate-token diff --git a/scripts/commit_flake_update.bash b/scripts/commit_flake_update.bash index cc557027..ba589a04 100755 --- a/scripts/commit_flake_update.bash +++ b/scripts/commit_flake_update.bash @@ -2,6 +2,8 @@ set -euo pipefail +FLAKE_INPUT=${FLAKE_INPUT:-""} + if ! git config --get user.name >/dev/null 2>&1 || \ [ "$(git config --get user.name)" = "" ] || ! git config --get user.email >/dev/null 2>&1 || \ @@ -15,11 +17,15 @@ fi current_commit="$(git rev-parse HEAD)" export PRE_COMMIT_ALLOW_NO_CONFIG=1 -nix flake update --accept-flake-config --commit-lock-file +nix flake update $FLAKE_INPUT --accept-flake-config --commit-lock-file commit_after_update="$(git rev-parse HEAD)" if [[ "$commit_after_update" = "$current_commit" ]]; then - echo "All flake inputs are up to date." + if [[ "$FLAKE_INPUT" = "" ]]; then + echo "All flake inputs are up to date." + else + echo "$FLAKE_INPUT input is up to date." + fi exit 0 fi @@ -30,11 +36,19 @@ msg_file=./commit_msg_body.txt echo '```' } > $msg_file -git commit --amend -F - <