-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathentrypoint-action.sh
More file actions
executable file
·46 lines (38 loc) · 1.18 KB
/
entrypoint-action.sh
File metadata and controls
executable file
·46 lines (38 loc) · 1.18 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
#!/bin/sh
set -eu
git config --global --add safe.directory "$PWD"
# create and write ENV result (individual env variables)
if [ "$INPUT_ENV" = "true" ]; then
env_result=$(git-that-semver $INPUT_ARGS)
echo "$env_result" | tee -a "$GITHUB_OUTPUT"
echo ""
echo '```env' >> "$GITHUB_STEP_SUMMARY"
echo "$env_result" >> "$GITHUB_STEP_SUMMARY"
echo '```' >> "$GITHUB_STEP_SUMMARY"
fi
# create and write JSON result
if [ "$INPUT_JSON" = "true" ]; then
json_result=$(git-that-semver $INPUT_ARGS -o json -c output.json.indent=2)
{
echo 'GTS_JSON<<EOF'
echo "$json_result"
echo EOF
} | tee -a "$GITHUB_OUTPUT"
echo ""
echo '```json' >> "$GITHUB_STEP_SUMMARY"
echo "$json_result" >> "$GITHUB_STEP_SUMMARY"
echo '```' >> "$GITHUB_STEP_SUMMARY"
fi
# create and write YAML result
if [ "$INPUT_YAML" = "true" ]; then
yaml_result=$(git-that-semver $INPUT_ARGS -o yaml)
{
echo 'GTS_YAML<<EOF'
echo "$yaml_result"
echo EOF
} | tee -a "$GITHUB_OUTPUT"
echo ""
echo '```yaml' >> "$GITHUB_STEP_SUMMARY"
echo "$yaml_result" >> "$GITHUB_STEP_SUMMARY"
echo '```' >> "$GITHUB_STEP_SUMMARY"
fi