ci: api.jsonの差分がない時は折りたたみを生成しないようにする (#14598)
This commit is contained in:
parent
d4d15f338e
commit
9cd784cdee
1 changed files with 21 additions and 12 deletions
17
.github/workflows/report-api-diff.yml
vendored
17
.github/workflows/report-api-diff.yml
vendored
|
@ -70,8 +70,16 @@ 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})"
|
||||||
|
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
|
||||||
<details>
|
<details>
|
||||||
<summary>差分はこちら</summary>
|
<summary>差分はこちら</summary>
|
||||||
|
|
||||||
|
@ -79,9 +87,10 @@ jobs:
|
||||||
$(cat ./api.json.diff)
|
$(cat ./api.json.diff)
|
||||||
\`\`\`
|
\`\`\`
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
[Get diff files from Workflow Page](https://github.com/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID})
|
|
||||||
EOF
|
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 }}
|
||||||
|
|
Loading…
Reference in a new issue