Skip to content

Commit eac9057

Browse files
committed
fix(action): improve input handling and command construction in entrypoint
1 parent 749f532 commit eac9057

File tree

2 files changed

+27
-9
lines changed

2 files changed

+27
-9
lines changed

action.yml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,3 @@ runs:
3737
image: 'Dockerfile'
3838
env:
3939
TYPSTIFY_WORKING_DIR: ${{ inputs.working-directory }}
40-
args:
41-
- ${{ inputs.command }}
42-
- '--config'
43-
- ${{ inputs.config }}
44-
- '--output'
45-
- ${{ inputs.output }}

entrypoint.sh

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,33 @@
22
set -e
33

44
# Change to working directory if specified
5-
if [ -n "$TYPSTIFY_WORKING_DIR" ] && [ "$TYPSTIFY_WORKING_DIR" != "." ]; then
5+
if [ -n "$INPUT_WORKING_DIRECTORY" ] && [ "$INPUT_WORKING_DIRECTORY" != "." ]; then
6+
cd "$INPUT_WORKING_DIRECTORY"
7+
elif [ -n "$TYPSTIFY_WORKING_DIR" ] && [ "$TYPSTIFY_WORKING_DIR" != "." ]; then
68
cd "$TYPSTIFY_WORKING_DIR"
79
fi
810

9-
# Execute typstify with all arguments
10-
exec typstify "$@"
11+
# If arguments are provided (via args in action.yml or manual override), execute them directly
12+
if [ $# -gt 0 ]; then
13+
exec typstify "$@"
14+
fi
15+
16+
# Otherwise, construct command from inputs
17+
# Note: --config is a global argument and must be placed before the subcommand
18+
CMD="typstify --config ${INPUT_CONFIG:-config.toml}"
19+
SUBCOMMAND="${INPUT_COMMAND:-build}"
20+
21+
CMD="$CMD $SUBCOMMAND"
22+
23+
# Add subcommand specific arguments
24+
if [ "$SUBCOMMAND" = "build" ]; then
25+
CMD="$CMD --output ${INPUT_OUTPUT:-public}"
26+
27+
if [ "$INPUT_DRAFTS" = "true" ]; then
28+
CMD="$CMD --drafts"
29+
fi
30+
fi
31+
32+
# Execute the constructed command
33+
echo "Executing: $CMD"
34+
exec $CMD

0 commit comments

Comments
 (0)