From f7babf5c9bd904b6206eaf625449691d27878041 Mon Sep 17 00:00:00 2001
From: Kisaragi <48310258+KisaragiEffective@users.noreply.github.com>
Date: Sat, 21 Sep 2024 12:11:26 +0900
Subject: [PATCH] =?UTF-8?q?ci:=20api.json=E3=81=AE=E5=B7=AE=E5=88=86?=
=?UTF-8?q?=E3=81=8C=E3=81=AA=E3=81=84=E6=99=82=E3=81=AF=E6=8A=98=E3=82=8A?=
=?UTF-8?q?=E3=81=9F=E3=81=9F=E3=81=BF=E3=82=92=E7=94=9F=E6=88=90=E3=81=97?=
=?UTF-8?q?=E3=81=AA=E3=81=84=E3=82=88=E3=81=86=E3=81=AB=E3=81=99=E3=82=8B?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.github/workflows/report-api-diff.yml | 33 +++++++++++++++++----------
1 file changed, 21 insertions(+), 12 deletions(-)
diff --git a/.github/workflows/report-api-diff.yml b/.github/workflows/report-api-diff.yml
index df9cc279e866..9fd1e28f0154 100644
--- a/.github/workflows/report-api-diff.yml
+++ b/.github/workflows/report-api-diff.yml
@@ -70,18 +70,27 @@ jobs:
- id: out-diff
name: Build diff Comment
run: |
- cat <<- EOF > ./output.md
- このPRによるapi.jsonの差分
-
- 差分はこちら
-
- \`\`\`diff
- $(cat ./api.json.diff)
- \`\`\`
-
-
- [Get diff files from Workflow Page](https://github.com/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID})
- EOF
+ HEADER="このPRによるapi.jsonの差分"
+ FOOTER="[Get diff files from Workflow Page](https://github.com/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID})"
+ DIFF_BYTES="$(stat ./api.json.diff -c '%s' | tr -d '\n')"
+
+ echo "$HEADER" > ./output.md
+
+ if (( "$DIFF_BYTES" <= 1 )); then
+ echo '差分はありません。' >> ./output.md
+ else
+ cat <<- EOF >> ./output.md
+
+ 差分はこちら
+
+ \`\`\`diff
+ $(cat ./api.json.diff)
+ \`\`\`
+
+ EOF
+ fi
+
+ echo "$FOOTER" >> ./output.md
- uses: thollander/actions-comment-pull-request@v2
with:
pr_number: ${{ steps.load-pr-num.outputs.pr-number }}