From 0ad9a550487687dcea451e57e09d99725e664d77 Mon Sep 17 00:00:00 2001 From: Aaron Andersen Date: Wed, 7 Sep 2022 22:11:56 -0400 Subject: [PATCH] feat: allow specifying a path to flake.nix within the repository --- README.md | 1 + action.yml | 5 +++++ update-flake-lock.sh | 4 ++++ 3 files changed, 10 insertions(+) diff --git a/README.md b/README.md index ffc5543..6d2b5b7 100644 --- a/README.md +++ b/README.md @@ -122,6 +122,7 @@ jobs: uses: DeterminateSystems/update-flake-lock@vX with: inputs: input1 input2 input3 + path-to-flake-dir: 'nix/' # in this example our flake doesn't sit at the root of the repository, it sits under 'nix/flake.nix' ``` ## Running GitHub Actions CI diff --git a/action.yml b/action.yml index d22fda3..81f92f7 100644 --- a/action.yml +++ b/action.yml @@ -17,6 +17,10 @@ inputs: description: 'The branch of the PR to be created' required: false default: "update_flake_lock_action" + path-to-flake-dir: + description: 'The path of the directory containing `flake.nix` file within your repository. Useful when `flake.nix` cannot reside at the root of your repository.' + required: false + default: '' pr-title: description: 'The title of the PR to be created' required: false @@ -114,6 +118,7 @@ runs: GIT_COMMITTER_EMAIL: ${{ env.GIT_COMMITTER_EMAIL }} TARGETS: ${{ inputs.inputs }} COMMIT_MSG: ${{ inputs.commit-msg }} + PATH_TO_FLAKE_DIR: ${{ inputs.path-to-flake-dir }} - name: Save PR Body as file uses: DamianReeves/write-file-action@v1.1 with: diff --git a/update-flake-lock.sh b/update-flake-lock.sh index c191dfa..e33a199 100755 --- a/update-flake-lock.sh +++ b/update-flake-lock.sh @@ -1,6 +1,10 @@ #!/usr/bin/env bash set -euo pipefail +if [[ -n "$PATH_TO_FLAKE_DIR" ]]; then + cd "$PATH_TO_FLAKE_DIR" +fi + if [[ -n "$TARGETS" ]]; then inputs=() for input in $TARGETS; do