Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Sep 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 21 additions & 12 deletions .github/workflows/report-api-diff.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,18 +70,27 @@ jobs:
- id: out-diff
name: Build diff Comment
run: |
cat <<- EOF > ./output.md
このPRによるapi.jsonの差分
<details>
<summary>差分はこちら</summary>

\`\`\`diff
$(cat ./api.json.diff)
\`\`\`
</details>

[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
<details>
<summary>差分はこちら</summary>

\`\`\`diff
$(cat ./api.json.diff)
\`\`\`
</details>
EOF
fi

echo "$FOOTER" >> ./output.md
- uses: thollander/actions-comment-pull-request@v2
with:
pr_number: ${{ steps.load-pr-num.outputs.pr-number }}
Expand Down