Skip to content

Commit

Permalink
feat: allow specifying a path to flake.nix within the repository
Browse files Browse the repository at this point in the history
  • Loading branch information
aanderse authored and cole-h committed Sep 14, 2022
1 parent 0ed7fb7 commit 0ad9a55
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down
4 changes: 4 additions & 0 deletions update-flake-lock.sh
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit 0ad9a55

Please sign in to comment.