Skip to content

Commit 78ad149

Browse files
committed
Switch to bash script
1 parent ddd3eb7 commit 78ad149

File tree

2 files changed

+31
-22
lines changed

2 files changed

+31
-22
lines changed

action.yml

+10-22
Original file line numberDiff line numberDiff line change
@@ -25,29 +25,17 @@ runs:
2525
using: 'composite'
2626
steps:
2727
- run: |
28-
INPUT_DIRECTORY="${{ inputs.directory }}"
29-
INPUT_OUTPUTS="$(echo '${{ inputs.outputs }}' | jq @json)"
30-
INPUT_KEYS="${{ inputs.keys }}"
31-
INPUT_EXTENSION="${{ inputs.extension }}"
32-
INPUT_BIN_PATH="${{ inputs.bin_path }}"
33-
34-
if [[ -z "$BIN_PATH" ]]; then
35-
## TODO: use "curl -sf https://[github releases - latest]] | PREFIX=. sh"
36-
exit 1;
37-
fi
38-
39-
echo "::debug::Generating output using ${BIN_PATH}..."
40-
41-
$BIN_PATH --keys="$INPUT_KEYS" --outputs=="$INPUT_OUTPUTS" \
42-
--directory="$INPUT_DIRECTORY" --extension="$INPUT_EXTENSION" && exit_status=$? || exit_status=$?
43-
44-
rm -f $BIN_PATH
45-
46-
if [[ $exit_status -ne 0 ]]; then
47-
echo "::error::Error generating output files from JSON"
48-
exit $exit_status;
49-
fi
28+
bash $GITHUB_ACTION_PATH/entrypoint.sh
29+
id: json2file
5030
shell: bash
31+
env:
32+
# INPUT_<VARIABLE_NAME> is not available in Composite run steps
33+
# https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions#example-specifying-inputs
34+
INPUT_DIRECTORY: ${{ inputs.directory }}
35+
INPUT_OUTPUTS: ${{ inputs.outputs }}
36+
INPUT_KEYS: ${{ inputs.keys }}
37+
INPUT_EXTENSION: ${{ inputs.extension }}
38+
INPUT_BIN_PATH: ${{ inputs.bin_path }}
5139
5240
branding:
5341
icon: file-text

entrypoint.sh

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
INPUT_OUTPUTS="$(echo "$INPUT_OUTPUTS" | jq @json)"
5+
6+
if [[ -z "$INPUT_BIN_PATH" ]]; then
7+
## TODO: use "curl -sf https://[github releases - latest]] | PREFIX=. sh"
8+
exit 1;
9+
fi
10+
11+
echo "::debug::Generating output using ${BIN_PATH}..."
12+
13+
$INPUT_BIN_PATH --keys="$INPUT_KEYS" --outputs=="$INPUT_OUTPUTS" \
14+
--directory="$INPUT_DIRECTORY" --extension="$INPUT_EXTENSION" && exit_status=$? || exit_status=$?
15+
16+
rm -f "$INPUT_BIN_PATH"
17+
18+
if [[ $exit_status -ne 0 ]]; then
19+
echo "::error::Error generating output files from JSON"
20+
exit $exit_status;
21+
fi

0 commit comments

Comments
 (0)