Skip to content

Commit 6c47016

Browse files
committed
check for too big output and no output
1 parent 352346d commit 6c47016

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

.github/workflows/test.yml

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,14 @@ jobs:
1111
- uses: actions/checkout@v4
1212
with:
1313
fetch-depth: 0
14-
- id: find
15-
run: |
16-
{
17-
echo 'kustomizations<<EOF'
18-
find testdata/* -maxdepth 1 -type d -not -name "*base"
19-
echo EOF
20-
} >>"$GITHUB_OUTPUT"
2114
- id: test-action
2215
uses: ./
2316
with:
2417
base_ref: 027b33661ae3211230e8cd03d19df49ba620b379
2518
head_ref: 182a672418c5bae4d6b7ca1244da5f28bf5ff6f0
26-
kustomizations: ${{ steps.find.outputs.kustomizations }}
19+
kustomizations: |-
20+
testdata/prod
21+
testdata/stage
2722
- uses: mshick/add-pr-comment@v2
2823
with:
2924
message: ${{ steps.test-action.outputs.diff }}

entrypoint.sh

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ set -eux
44

55
build_dir=$(mktemp -d)
66

7-
echo $INPUT_KUSTOMIZATIONS
8-
97
build() {
108
ref="$1"
119
git checkout "$1" --quiet
@@ -37,6 +35,14 @@ set -e
3735
# Formatting hacks
3836
output=$(cat diff.md | sed "s|$base_ref_build_dir/||" | sed '/Comparing/ s/&.*$//' | sed "s|^#\{2,\} Comparing| Comparing|" | sed "s|^# Comparing|## Comparing|")
3937

38+
if [ ${#output} -gt 65535 ]; then
39+
output="Kustomize diff too large to display"
40+
fi
41+
42+
if [ -z "$output" ]; then
43+
output="Kustomize diff did not find any differences"
44+
fi
45+
4046
{
4147
echo 'diff<<EOF'
4248
echo "$output"

0 commit comments

Comments
 (0)