-
Notifications
You must be signed in to change notification settings - Fork 38
/
Copy pathentrypoint.sh
51 lines (40 loc) · 1.45 KB
/
entrypoint.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/bin/sh -l
SPELLCHECK_CONFIG_FILE=''
if [ -n "$INPUT_CONFIG_PATH" ]; then
SPELLCHECK_CONFIG_FILE=$INPUT_CONFIG_PATH
else
if [ -f "./.spellcheck.yml" ]; then
SPELLCHECK_CONFIG_FILE=".spellcheck.yml"
elif [ -f "./.spellcheck.yaml" ]; then
SPELLCHECK_CONFIG_FILE=".spellcheck.yaml"
elif [ -f "./spellcheck.yml" ]; then
SPELLCHECK_CONFIG_FILE="spellcheck.yml"
else
SPELLCHECK_CONFIG_FILE="spellcheck.yaml"
fi
fi
echo ""
echo "Using pyspelling on configuration outlined in >$SPELLCHECK_CONFIG_FILE<"
if [ -n "$INPUT_SOURCE_FILES" ]; then
if [ -z "$INPUT_TASK_NAME" ]; then
echo "task_name must be specified to use source_files option"
exit 1
else
echo "Running task >$INPUT_TASK_NAME<"
fi
for FILE in $INPUT_SOURCE_FILES; do
SOURCES_LIST="$SOURCES_LIST --source $FILE"
echo "Checking file >$FILE<"
done
else
echo "Checking files matching specified outlined in >$SPELLCHECK_CONFIG_FILE<"
fi
if [ -n "$INPUT_TASK_NAME" ]; then
TASK_NAME="--name $INPUT_TASK_NAME"
fi
echo "----------------------------------------------------------------"
pyspelling --config $SPELLCHECK_CONFIG_FILE $TASK_NAME $SOURCES_LIST
EXITCODE=$?
test $EXITCODE -gt 1 && echo "::error title=Spelling check::Spelling check action failed, please check diagnostics";
test $EXITCODE -eq 1 && echo "::error title=Spelling errors::Files in repository contain spelling errors";
exit $EXITCODE