diff --git a/action.yml b/action.yml index b1b6cd6..ec91476 100644 --- a/action.yml +++ b/action.yml @@ -13,8 +13,10 @@ inputs: description: The working directory for this action work_in_root_file_dir: description: Change directory into each root file's directory before compiling each documents + default: "false" continue_on_error: description: Continuing to build document even with LaTeX build errors + default: "false" compiler: description: The LaTeX engine to be invoked default: latexmk @@ -31,10 +33,13 @@ inputs: description: Arbitrary bash codes to be executed after compiling LaTeX documents latexmk_shell_escape: description: Instruct latexmk to enable --shell-escape + default: "false" latexmk_use_lualatex: description: Instruct latexmk to use LuaLaTeX + default: "false" latexmk_use_xelatex: description: Instruct latexmk to use XeLaTeX + default: "false" runs: using: composite diff --git a/entrypoint.sh b/entrypoint.sh index 0823fe9..0c40c26 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -66,15 +66,15 @@ fi IFS=' ' read -r -a args <<<"$args" if [[ "$compiler" = "latexmk" ]]; then - if [[ -n "$latexmk_shell_escape" ]]; then + if [[ "$latexmk_shell_escape" = "true" ]]; then args+=("-shell-escape") fi - if [[ -n "$latexmk_use_lualatex" && -n "$latexmk_use_xelatex" ]]; then + if [[ "$latexmk_use_lualatex" = "true" && "$latexmk_use_xelatex" = "true" ]]; then error "Input 'latexmk_use_lualatex' and 'latexmk_use_xelatex' cannot be used at the same time." fi - if [[ -n "$latexmk_use_lualatex" ]]; then + if [[ "$latexmk_use_lualatex" = "true" ]]; then for i in "${!args[@]}"; do if [[ "${args[i]}" = "-pdf" ]]; then unset 'args[i]' @@ -92,7 +92,7 @@ if [[ "$compiler" = "latexmk" ]]; then args=("${args[@]/#-interaction=/--interaction=}") fi - if [[ -n "$latexmk_use_xelatex" ]]; then + if [[ "$latexmk_use_xelatex" = "true" ]]; then for i in "${!args[@]}"; do if [[ "${args[i]}" = "-pdf" ]]; then unset 'args[i]' @@ -102,7 +102,7 @@ if [[ "$compiler" = "latexmk" ]]; then fi else for VAR in "${!latexmk_@}"; do - if [[ -n "${!VAR}" ]]; then + if [[ "${!VAR}" = "true" ]]; then error "Input '${VAR}' is only valid if input 'compiler' is set to 'latexmk'." fi done @@ -152,7 +152,7 @@ for f in "${root_file[@]}"; do continue fi - if [[ -n "$work_in_root_file_dir" ]]; then + if [[ "$work_in_root_file_dir" = "true" ]]; then pushd "$(dirname "$f")" >/dev/null f="$(basename "$f")" info "Compile $f in $PWD" @@ -166,14 +166,14 @@ for f in "${root_file[@]}"; do "$compiler" "${args[@]}" "$f" || ret="$?" if [[ "$ret" -ne 0 ]]; then - if [[ -n "$continue_on_error" ]]; then + if [[ "$continue_on_error" = "true" ]]; then exit_code="$ret" else exit "$ret" fi fi - if [[ -n "$work_in_root_file_dir" ]]; then + if [[ "$work_in_root_file_dir" = "true" ]]; then popd >/dev/null fi done