Skip to content

Commit 9e9e875

Browse files
author
Ruben Espinosa
committed
Add dynamic filepath
1 parent 65fd9a4 commit 9e9e875

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

action.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ runs:
1313
steps:
1414
- run: ${{ github.action_path }}/validator.sh
1515
shell: bash
16+
env:
17+
FILEPATH: ${{ inputs.filepath }}
1618
branding:
1719
icon: 'check-square'
1820
color: 'gray-dark'

validator.sh

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,16 @@
33
read_file()
44
{
55
invalid=()
6-
file=".env"
6+
file="$FILEPATH"
7+
if [ ! -f "$file" ]; then
8+
echo "ERROR! $file file does not exist."
9+
exit 1
10+
fi
711
while IFS="=" read -r key value; do
812
[ -z "$value" ] && invalid+=("$key")
913
done < "$file"
1014
if (( ${#invalid[@]} )); then
11-
echo "ERROR!! There are some invalid environment variables:"
15+
echo "ERROR! There are some invalid environment variables:"
1216
printf '%s\n' "${invalid[@]}"
1317
exit 1
1418
fi

0 commit comments

Comments
 (0)