1
1
mirror of https://github.com/kokonect-link/cherrypick synced 2024-12-05 02:08:56 +09:00

ci: api.jsonの差分がない時は折りたたみを生成しないようにする (#14598)

This commit is contained in:
Kisaragi 2024-09-21 18:19:09 +09:00 committed by GitHub
parent d4d15f338e
commit 9cd784cdee
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -70,18 +70,27 @@ jobs:
- id: out-diff - id: out-diff
name: Build diff Comment name: Build diff Comment
run: | run: |
cat <<- EOF > ./output.md HEADER="このPRによるapi.jsonの差分"
このPRによるapi.jsonの差分 FOOTER="[Get diff files from Workflow Page](https://github.com/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID})"
<details> DIFF_BYTES="$(stat ./api.json.diff -c '%s' | tr -d '\n')"
<summary>差分はこちら</summary>
\`\`\`diff echo "$HEADER" > ./output.md
$(cat ./api.json.diff)
\`\`\`
</details>
[Get diff files from Workflow Page](https://github.com/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}) if (( "$DIFF_BYTES" <= 1 )); then
EOF echo '差分はありません。' >> ./output.md
else
cat <<- EOF >> ./output.md
<details>
<summary>差分はこちら</summary>
\`\`\`diff
$(cat ./api.json.diff)
\`\`\`
</details>
EOF
fi
echo "$FOOTER" >> ./output.md
- uses: thollander/actions-comment-pull-request@v2 - uses: thollander/actions-comment-pull-request@v2
with: with:
pr_number: ${{ steps.load-pr-num.outputs.pr-number }} pr_number: ${{ steps.load-pr-num.outputs.pr-number }}