File tree Expand file tree Collapse file tree 3 files changed +18
-12
lines changed Expand file tree Collapse file tree 3 files changed +18
-12
lines changed Original file line number Diff line number Diff line change 19
19
kustomizations : |-
20
20
testdata/prod
21
21
testdata/stage
22
- - run : echo "${{ steps.test-action.outputs.diff }}"
23
22
- uses : mshick/add-pr-comment@v2
24
23
with :
25
- message : |
26
- ```diff
27
- ${{ steps.test-action.outputs.diff }}
28
- ```
24
+ message : ${{ steps.test-action.outputs.diff }}
Original file line number Diff line number Diff line change 1
- # GitHub Action for Kustomize Build+Diff
1
+ # GitHub Action for Kustomize Build+Diff
2
+
3
+ docker run --rm -t -w $(pwd) -v $(pwd):$(pwd): ro \
4
+ registry.salsa.debian.org/reproducible-builds/diffoscope --exclude-directory-metadata=yes testdata testdata2
Original file line number Diff line number Diff line change @@ -20,13 +20,20 @@ git config --global --add safe.directory "$GITHUB_WORKSPACE"
20
20
build " $INPUT_BASE_REF "
21
21
build " $INPUT_HEAD_REF "
22
22
23
- diffoscope " $build_dir /$INPUT_BASE_REF " " $build_dir / $INPUT_HEAD_REF " --markdown diff.md --exclude-directory-metadata=recursive || true
24
- output= $( cat diff.md )
23
+ base_ref_build_dir= " $build_dir /$INPUT_BASE_REF "
24
+ head_ref_build_dir= " $build_dir / $INPUT_HEAD_REF "
25
25
26
- # If escaped output is longer than 65000 characters return "output to 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."
29
- fi
26
+ set +e
27
+ for target in $INPUT_KUSTOMIZATIONS ; do
28
+ diffoscope " $base_ref_build_dir /$target " " $head_ref_build_dir /$target " \
29
+ --markdown - \
30
+ --exclude-directory-metadata=yes | tee -a diff.md
31
+ done
32
+
33
+ set -e
34
+
35
+ # Formatting hacks
36
+ output=$( cat diff.md | sed " s|$base_ref_build_dir /||" | sed ' /Comparing/ s/&.*$//' | sed " s|^#\{2,\} Comparing| Comparing|" | sed " s|^# Comparing|## Comparing|" )
30
37
31
38
{
32
39
echo ' diff<<EOF'
You can’t perform that action at this time.
0 commit comments