This repository has been archived by the owner on May 31, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
entrypoint.sh
executable file
·68 lines (59 loc) · 2.34 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#!/usr/bin/env bash
# ########################################################################
# Copyright 2021 Splunk Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ######################################################################## export REVIEWDOG_GITHUB_API_TOKEN="${INPUT_GITHUB_TOKEN}"
WORKSPACE_DIR=/github/workspace
FALSE_POSITIVE_FILE="${WORKSPACE_DIR}/.false-positives.yaml"
CUSTOM_IGNORE_FILE="${WORKSPACE_DIR}/.ge_ignore"
IGNORE_FILE="/.ge_ignore"
if [ -d ".go-earlybird" ]; then
cp -f .go-earlybird/* /.go-earlybird/
fi
if [ -f "${FALSE_POSITIVE_FILE}" ]; then
echo "Adding exceptions from ${FALSE_POSITIVE_FILE} file"
cp "${FALSE_POSITIVE_FILE}" /.go-earlybird/falsepositives
fi
if [ -f "${CUSTOM_IGNORE_FILE}" ]; then
echo "Adding files from custom ignorefile to ${IGNORE_FILE}"
cat "${CUSTOM_IGNORE_FILE}" >> "${IGNORE_FILE}"
fi
echo ::group::scanner_output
go-earlybird -show-solutions -suppress -config=/.go-earlybird/ -ignorefile="${IGNORE_FILE}" \
-path=${WORKSPACE_DIR}/${INPUT_WORKDIR} ${INPUT_ARGS} || true
echo "::endgroup::"
echo ::group::reviewdog_output
if [ -z ${INPUT_REPORTER+x} ];
then
if [ -z ${GITHUB_BASE_REF+x} ];
then
export REPORTER=github-pr-review
else
export REPORTER=github-check
fi
else
export REPORTER=$INPUT_REPORTER
fi
go-earlybird -show-solutions -suppress -config=/.go-earlybird/ -ignorefile="${IGNORE_FILE}" \
-path=${WORKSPACE_DIR}/${INPUT_WORKDIR} -format=json ${INPUT_ARGS} \
| python3 /annotate.py \
| reviewdog -f=rdjson \
-name="addonfactory-sample-scanner" \
-reporter="${REPORTER:-github-check}" \
-filter-mode="${INPUT_FILTER_MODE}" \
-fail-on-error="${INPUT_FAIL_ON_ERROR}" \
-level="${INPUT_LEVEL}" \
${INPUT_REVIEWDOG_FLAGS} ; exitCode=$?
echo "::endgroup::"
exit $exitCode