@@ -192,16 +192,40 @@ jobs:
192192
193193 if [ ! -f "$RUNNER_TEMP/old/$templates_file" ]; then
194194 file_content=$(sed -e 's/^/+ /' < "$RUNNER_TEMP/new/$templates_file")
195- comment_templates_body+="<details><summary>$current_file (added)</summary>\n"
196- comment_templates_body+='\n```diff\n'
197- comment_templates_body+="# The full content of the file is available in ${ARTIFACT_URL}\n"
198- comment_templates_body+=$(head -n 5 <<< "$file_content")
199- comment_templates_body+='\n...\n```\n</details>\n\n'
195+ api_version=$(yq '.apiVersion' "$RUNNER_TEMP/new/$templates_file")
196+ kind=$(yq '.kind' "$RUNNER_TEMP/new/$templates_file")
197+ name=$(yq '.metadata.name' "$RUNNER_TEMP/new/$templates_file")
198+ namespace=$(yq '.metadata.namespace' "$RUNNER_TEMP/new/$templates_file")
199+ metadata=$(yq '.metadata' "$RUNNER_TEMP/new/$templates_file")
200+ comment_templates_body+="@@ $current_file @@\n"
201+ comment_templates_body+="# $api_version/$kind/$namespace/$name\n"
202+ comment_templates_body+="! + one file added - the full content of the file is available in ${ARTIFACT_URL}\n"
203+ comment_templates_body+="+ apiVersion: $api_version\n"
204+ comment_templates_body+="+ kind: $kind\n"
205+ comment_templates_body+="+ metadata:\n"
206+ while IFS= read -r line; do
207+ comment_templates_body+="+ $line\n"
208+ done <<< "$metadata"
209+ comment_templates_body+="\n"
200210 continue
201211 fi
202212
203213 if [ ! -f "$RUNNER_TEMP/new/$templates_file" ]; then
204- comment_templates_body+="**$current_file** (removed)\n\n"
214+ api_version=$(yq '.apiVersion' "$RUNNER_TEMP/old/$templates_file" )
215+ kind=$(yq '.kind' "$RUNNER_TEMP/old/$templates_file")
216+ name=$(yq '.metadata.name' "$RUNNER_TEMP/old/$templates_file")
217+ namespace=$(yq '.metadata.namespace' "$RUNNER_TEMP/old/$templates_file")
218+ metadata=$(yq '.metadata.namespace' "$RUNNER_TEMP/old/$templates_file")
219+ comment_templates_body+="@@ $current_file @@\n"
220+ comment_templates_body+="# $api_version/$kind/$namespace/$name\n"
221+ comment_templates_body+="! - one file removed\n"
222+ comment_templates_body+="- apiVersion: $api_version\n"
223+ comment_templates_body+="- kind: $kind\n"
224+ comment_templates_body+="- metadata:\n"
225+ while IFS= read -r line; do
226+ comment_templates_body+="- $line\n"
227+ done <<< "$metadata"
228+ comment_templates_body+="\n"
205229 continue
206230 fi
207231
@@ -212,17 +236,24 @@ jobs:
212236 echo "failed with file $templates_file"
213237 exit 1
214238 fi
215- comment_templates_body+="<details><summary>$current_file (changed)</summary>\n"
216- comment_templates_body+='\n```diff\n'
217- comment_templates_body+=$dyff_detail
218- comment_templates_body+='\n```\n</details>\n\n'
239+
240+ api_version=$(yq '.apiVersion' "$RUNNER_TEMP/new/$templates_file")
241+ kind=$(yq '.kind' "$RUNNER_TEMP/new/$templates_file")
242+ name=$(yq '.metadata.name' "$RUNNER_TEMP/new/$templates_file")
243+ namespace=$(yq '.metadata.namespace' "$RUNNER_TEMP/new/$templates_file")
244+ resource_metadata="# $api_version/$kind/$namespace/$name"
245+ comment_templates_body+='\n'
246+ comment_templates_body+=$(sed "/^@@/a$resource_metadata" <<< "$dyff_detail")
247+ comment_templates_body+="\n"
219248 fi
220249 done <<< "$templates_files"
221250
222251 if [[ -n "$comment_templates_body" ]]; then
223252 comment_body+="<details><summary><b>$values_dir.yaml</b></summary>\n"
253+ comment_body+='\n```diff\n'
224254 comment_body+="$comment_templates_body"
225- comment_body+="---\n</details>\n"
255+ comment_body+='\n```\n'
256+ comment_body+="\n</details>\n"
226257 fi
227258
228259 done <<< "$values_directories"
@@ -231,7 +262,7 @@ jobs:
231262 comment_body="No changes in rendered templates"
232263 fi
233264
234- echo -e "$header$comment_body" | tee "$RUNNER_TEMP/dyff-output"
265+ echo -e "$header$comment_body" | tee "$RUNNER_TEMP/dyff-output.md "
235266
236267 - name : Upload generated manifests
237268 uses : actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
@@ -255,5 +286,5 @@ jobs:
255286 with :
256287 comment-id : ${{ steps.find-dyff-comment.outputs.comment-id }}
257288 issue-number : ${{ github.event.pull_request.number }}
258- body-path : ${{ runner.temp }}/dyff-output
289+ body-path : ${{ runner.temp }}/dyff-output.md
259290 edit-mode : replace
0 commit comments