-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathentrypoint.sh
More file actions
executable file
·87 lines (75 loc) · 2.37 KB
/
entrypoint.sh
File metadata and controls
executable file
·87 lines (75 loc) · 2.37 KB
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#!/usr/bin/env bash
set -e
set -o pipefail
if [[ "$INPUT_INCLUDE" == '-' ]] || [[ "$INPUT_EXCLUDE" == '-' ]]; then
if [[ -z "$INPUT_PIPE" ]]; then
echo "::error ::The 'pipe' input is required in order to read from the standard input"
exit 1
fi
if [[ "$INPUT_INCLUDE" == '-' ]] && [[ "$INPUT_EXCLUDE" == '-' ]]; then
echo "::error ::The 'include' and 'exclude' lists can not be read from the standard" \
"input at the same time"
exit 1
fi
fi
if [[ -n "$INPUT_PIPE" ]] && [[ "$INPUT_INCLUDE" != '-' ]] && [[ "$INPUT_EXCLUDE" != '-' ]]; then
echo "::warning ::The 'pipe' input is ignored as neither 'include' nor 'exclude' is"\
"configured to read from the standard input"
fi
if sdk_version=$(dotnet --version 2>&1); then
echo "Using .NET SDK version '$sdk_version'"
else
if [[ "$INPUT_USE_STANDALONE_TOOL" == "false" ]]; then
echo "::error ::The .NET SDK is not installed"
exit 1
fi
fi
if [[ "$INPUT_USE_STANDALONE_TOOL" == "true" ]]; then
cmd="dotnet-format"
else
cmd="dotnet format"
fi
if version=$(eval "$cmd --version" 2>&1); then
echo "Using 'dotnet format' version '$version'"
else
echo "::error ::The 'dotnet-format' tool is not installed"
exit 1
fi
if [[ -n "$INPUT_WORKSPACE" ]]; then
cmd+=" '$INPUT_WORKSPACE'"
fi
if [[ "$INPUT_IMPLICIT_RESTORE" == "false" ]]; then
cmd+=" --no-restore"
fi
if [[ -n "$INPUT_DIAGOSTICS" ]]; then
values=$(printf '%s\n' "$INPUT_DIAGNOSTICS" | "$GITHUB_ACTION_PATH/shellquote.sh" ' ')
cmd+=" --diagnostics $values"
fi
if [[ -n "$INPUT_SEVERITY" ]]; then
cmd+=" --severity '$INPUT_SEVERITY'"
fi
if [[ "$INPUT_VERIFY_NO_CHANGES" == "true" ]]; then
cmd+=" --verify-no-changes"
fi
if [[ -n "$INPUT_INCLUDE" ]]; then
if [[ "$INPUT_INCLUDE" == '-' ]]; then
cmd+=" --include -"
cmd="$INPUT_PIPE | $cmd"
else
files=$(printf '%s\n' "$INPUT_INCLUDE" | "$GITHUB_ACTION_PATH/shellquote.sh" ' ')
cmd+=" --include $files"
fi
fi
if [[ -n "$INPUT_EXCLUDE" ]]; then
if [[ "$INPUT_EXCLUDE" == '-' ]]; then
cmd+=" --exclude -"
cmd="$INPUT_PIPE | $cmd"
else
files=$(printf '%s\n' "$INPUT_EXCLUDE" | "$GITHUB_ACTION_PATH/shellquote.sh" ' ')
cmd+=" --exclude $files"
fi
fi
if [[ -n "$INPUT_REPORT_PATH" ]]; then
cmd+=" --report '$INPUT_REPORT_PATH'"
fi
eval "$cmd"