Skip to content

Commit a74c97b

Browse files
committed
WIP
1 parent 182a672 commit a74c97b

File tree

3 files changed

+20
-28
lines changed

3 files changed

+20
-28
lines changed

.github/workflows/test.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,14 @@ jobs:
1515
uses: ./
1616
with:
1717
base_ref: 027b33661ae3211230e8cd03d19df49ba620b379
18-
head_ref: b887e3e0a09cc67b0d12c1d16200955cdf0f767a
18+
head_ref: 182a672418c5bae4d6b7ca1244da5f28bf5ff6f0
1919
kustomizations: |-
2020
testdata/prod
2121
testdata/stage
2222
- run: echo "${{ steps.test-action.outputs.diff }}"
2323
- uses: mshick/add-pr-comment@v2
2424
with:
25-
message: "```${{ steps.test-action.outputs.diff }}```"
25+
message: |
26+
```diff
27+
${{ steps.test-action.outputs.diff }}
28+
```

Dockerfile

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,7 @@
1-
# FROM debian:bookworm-slim
2-
3-
# ARG TARGETOS
4-
# ARG TARGETARCH
5-
# ARG KUSTOMIZE_VERSION=5.4.3
6-
7-
# RUN apt-get -yqq update \
8-
# && apt-get -yqq install --no-install-recommends \
9-
# bash \
10-
# curl \
11-
# git \
12-
# ca-certificates \
13-
# && rm -rf /var/lib/apt/lists/*
14-
15-
# RUN curl -fL https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize/v${KUSTOMIZE_VERSION}/kustomize_v${KUSTOMIZE_VERSION}_${TARGETOS}_${TARGETARCH}.tar.gz | tar xz -C /usr/local/bin
16-
17-
# COPY entrypoint.sh .
18-
# ENTRYPOINT [ "./entrypoint.sh" ]
19-
201
FROM registry.k8s.io/kustomize/kustomize:v5.0.0
212

3+
RUN apk add --no-cache sed && \
4+
apk add difftastic --repository=https://dl-cdn.alpinelinux.org/alpine/edge/community
5+
226
COPY entrypoint.sh .
237
ENTRYPOINT [ "./entrypoint.sh" ]

entrypoint.sh

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,21 @@ build() {
1717

1818
git config --global --add safe.directory "$GITHUB_WORKSPACE"
1919

20-
build $INPUT_BASE_REF
21-
build $INPUT_HEAD_REF
20+
build "$INPUT_BASE_REF"
21+
build "$INPUT_HEAD_REF"
2222

23-
diff="$(git diff --no-index "$build_dir/$INPUT_BASE_REF" "$build_dir/$INPUT_HEAD_REF")"
24-
escaped_output=$diff # TODO Escape output
23+
diff="$(GIT_EXTERNAL_DIFF=difft git diff --no-index "$build_dir/$INPUT_BASE_REF" "$build_dir/$INPUT_HEAD_REF" || true)"
24+
output=$(echo "$diff")
2525

2626
# If escaped output is longer than 65000 characters return "output to large to print as a github comment"
27-
if [ ${#escaped_output} -gt 65000 ]; then
28-
escaped_output="Output is greater than 65000 characters, and therefore too large to print as a github comment."
27+
if [ ${#output} -gt 65000 ]; then
28+
output="Output is greater than 65000 characters, and therefore too large to print as a github comment."
2929
fi
3030

31-
echo "diff=$escaped_output" >>"$GITHUB_OUTPUT"
31+
{
32+
echo 'diff<<EOF'
33+
echo "$output"
34+
echo 'EOF'
35+
} >>"$GITHUB_OUTPUT"
36+
3237
exit 0

0 commit comments

Comments
 (0)