Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Be able to configure the server startup waiting duration #54

Merged
merged 4 commits into from
Nov 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ inputs:
custom_api_endpoint:
description: 'Custom API endpoint of LanguageTool server. e.g. https://languagetool.org/api'
default: ''
wait_server_startup_duration:
description: 'Wait the startup of the server.'
default: '3'
runs:
using: 'docker'
image: 'Dockerfile'
Expand Down
3 changes: 2 additions & 1 deletion entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
#!/bin/sh
set -eo pipefail

Check warning on line 2 in entrypoint.sh

View workflow job for this annotation

GitHub Actions / runner / shellcheck

[shellcheck] reported by reviewdog 🐶 In POSIX sh, set option pipefail is undefined. [SC3040](https://github.com/koalaman/shellcheck/wiki/SC3040) Raw Output: ./entrypoint.sh:2:9:warning:In POSIX sh, set option pipefail is undefined. [SC3040](https://github.com/koalaman/shellcheck/wiki/SC3040)

API_ENDPOINT="${INPUT_CUSTOM_API_ENDPOINT}"
if [ -z "${INPUT_CUSTOM_API_ENDPOINT}" ]; then
API_ENDPOINT=http://localhost:8010
java -cp "/LanguageTool/languagetool-server.jar" org.languagetool.server.HTTPServer --port 8010 &
sleep 3 # Wait the server statup.
echo "Wait the server startup for ${INPUT_WAIT_SERVER_STARTUP_DURATION}s"
sleep "${INPUT_WAIT_SERVER_STARTUP_DURATION}" # Wait the server startup.
fi

echo "API ENDPOINT: ${API_ENDPOINT}" >&2
Expand All @@ -14,7 +15,7 @@
cd "${GITHUB_WORKSPACE}" || exit
fi

git config --global --add safe.directory $GITHUB_WORKSPACE

Check warning on line 18 in entrypoint.sh

View workflow job for this annotation

GitHub Actions / runner / shellcheck

[shellcheck] reported by reviewdog 🐶 Double quote to prevent globbing and word splitting. [SC2086](https://github.com/koalaman/shellcheck/wiki/SC2086) Raw Output: ./entrypoint.sh:18:42:info:Double quote to prevent globbing and word splitting. [SC2086](https://github.com/koalaman/shellcheck/wiki/SC2086)

Check failure on line 18 in entrypoint.sh

View workflow job for this annotation

GitHub Actions / runner / shellcheck

[shellcheck (suggestion)] reported by reviewdog 🐶 Raw Output: entrypoint.sh:18:-git config --global --add safe.directory $GITHUB_WORKSPACE entrypoint.sh:18:+git config --global --add safe.directory "$GITHUB_WORKSPACE"

# https://languagetool.org/http-api/swagger-ui/#!/default/post_check
DATA="language=${INPUT_LANGUAGE}"
Expand All @@ -36,7 +37,7 @@

# Disable glob to handle glob patterns with ghglob command instead of with shell.
set -o noglob
FILES="$(git ls-files | ghglob ${INPUT_PATTERNS})"

Check warning on line 40 in entrypoint.sh

View workflow job for this annotation

GitHub Actions / runner / shellcheck

[shellcheck] reported by reviewdog 🐶 Double quote to prevent globbing and word splitting. [SC2086](https://github.com/koalaman/shellcheck/wiki/SC2086) Raw Output: ./entrypoint.sh:40:32:info:Double quote to prevent globbing and word splitting. [SC2086](https://github.com/koalaman/shellcheck/wiki/SC2086)

Check failure on line 40 in entrypoint.sh

View workflow job for this annotation

GitHub Actions / runner / shellcheck

[shellcheck (suggestion)] reported by reviewdog 🐶 Raw Output: entrypoint.sh:40:-FILES="$(git ls-files | ghglob ${INPUT_PATTERNS})" entrypoint.sh:40:+FILES="$(git ls-files | ghglob "${INPUT_PATTERNS}")"
set +o noglob

run_langtool() {
Expand Down
Loading