Skip to content

Commit aa0b444

Browse files
author
Stijn Opheide
authored
Merge pull request #1 from vouch-opensource/add-working-directory
add working directory input
2 parents d6a3d6e + 6779482 commit aa0b444

File tree

3 files changed

+24
-1
lines changed

3 files changed

+24
-1
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ Note: Since the action is not interactive, it invokes the CLI via `clojure` rath
2121

2222
**Default:** none are set
2323

24+
### `working-directory`
25+
26+
**Optional:** In case the clojure command should not be executed in the root directory, you can specify another working directory.
27+
2428
### `ssh-key`
2529

2630
**Optional:** A GitHub secret that has the The SSH key needed to access code from other private repositories (eg `${{ secrets.SSH_PRIVATE_KEY }}`)

action.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,15 @@ inputs:
1515
ssh-key:
1616
description: 'GitHub secret with the SSH private key to access your private repositories'
1717
required: false
18+
working-directory:
19+
description: 'Working directoy in which to execute the clojure command'
20+
required: false
1821
runs:
1922
using: 'docker'
2023
image: 'Dockerfile'
2124
args:
2225
- ${{ inputs.alias }}
2326
- ${{ inputs.java-opts }}
2427
- ${{ inputs.ssh-key }}
28+
- ${{ inputs.working-directory }}
2529

entrypoint.sh

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,22 @@ then
3535

3636
fi
3737

38+
# Working Directory
39+
workingDirectory=$4
40+
41+
set +e
42+
if [[ -n $workingDirectory ]]; then
43+
if [[ -d $workingDirectory ]]; then
44+
cd "$workingDirectory"
45+
else
46+
echo "ERROR: working-directory $workingDirectory does not exist"
47+
exit 1
48+
fi
49+
fi
50+
51+
set -e
52+
3853
# Log the actions
3954
set -x
4055

41-
clojure $j_Opts $a_Opts
56+
clojure $j_Opts $a_Opts

0 commit comments

Comments
 (0)