forked from SoftwareUnderstanding/rs-metacheck-action
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathentrypoint.sh
More file actions
78 lines (62 loc) · 1.83 KB
/
Copy pathentrypoint.sh
File metadata and controls
78 lines (62 loc) · 1.83 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
#!/bin/bash
set -e
# Base command
CMD="rsmetacheck"
# Handle required input
if [ -n "$INPUT_INPUT" ]; then
# Note: Do not quote $INPUT_INPUT here in case multiple URLs are passed as spaces
CMD="$CMD --input $INPUT_INPUT"
else
echo "Error: The 'input' argument is required and $GITHUB_REPOSITORY environment variable is not set. Please provide an input or run this action within a GitHub repository context."
exit 1
fi
# Handle boolean flags
if [ "$INPUT_SKIP_SOMEF" = "true" ]; then
CMD="$CMD --skip-somef"
fi
if [ "$INPUT_GENERATE_CODEMETA" = "true" ]; then
CMD="$CMD --generate-codemeta"
fi
if [ "$INPUT_VERBOSE" = "true" ]; then
CMD="$CMD --verbose"
fi
# Handle parameters with values
if [ -n "$INPUT_PITFALLS_OUTPUT" ]; then
CMD="$CMD --pitfalls-output \"$INPUT_PITFALLS_OUTPUT\""
fi
if [ -n "$INPUT_SOMEF_OUTPUT" ]; then
CMD="$CMD --somef-output \"$INPUT_SOMEF_OUTPUT\""
fi
if [ -n "$INPUT_ANALYSIS_OUTPUT" ]; then
CMD="$CMD --analysis-output \"$INPUT_ANALYSIS_OUTPUT\""
fi
if [ -n "$INPUT_THRESHOLD" ]; then
CMD="$CMD --threshold \"$INPUT_THRESHOLD\""
fi
if [ -n "$INPUT_BRANCH" ]; then
CMD="$CMD --branch \"$INPUT_BRANCH\""
fi
if [ -n "$INPUT_CONFIG" ]; then
CMD="$CMD --config \"$INPUT_CONFIG\""
fi
if [ -n "$INPUT_CONFIG_PROFILE" ]; then
CMD="$CMD --config-profile \"$INPUT_CONFIG_PROFILE\""
fi
echo "Executing RsMetaCheck command:"
echo "$CMD"
RSMETA_EXIT=0
eval "$CMD" || RSMETA_EXIT=$?
# Run post-processing for GitHub Actions output
if [ -n "$GITHUB_STEP_SUMMARY" ] || [ -n "$GITHUB_OUTPUT" ]; then
echo "Generating GitHub Actions output..."
POST_EXIT=0
python3 /postprocess.py || POST_EXIT=$?
else
POST_EXIT=0
fi
# Use post-process exit code (1 = pitfalls found) if it applies,
# otherwise fall back to the rsmetacheck exit code
if [ "$POST_EXIT" -ne 0 ]; then
exit "$POST_EXIT"
fi
exit "$RSMETA_EXIT"