diff options
| author | Kisaragi <48310258+KisaragiEffective@users.noreply.github.com> | 2024-09-21 18:19:09 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-09-21 18:19:09 +0900 |
| commit | 9cd784cdee670054d642e646eccbc7a043055180 (patch) | |
| tree | 4af282a22b53789fb70402833120b27ce258eb85 /.github/workflows | |
| parent | fix: EmailServiceでインラインスタイルを適用するように (#14600) (diff) | |
| download | sharkey-9cd784cdee670054d642e646eccbc7a043055180.tar.gz sharkey-9cd784cdee670054d642e646eccbc7a043055180.tar.bz2 sharkey-9cd784cdee670054d642e646eccbc7a043055180.zip | |
ci: api.jsonの差分がない時は折りたたみを生成しないようにする (#14598)
Diffstat (limited to '.github/workflows')
| -rw-r--r-- | .github/workflows/report-api-diff.yml | 33 |
1 files changed, 21 insertions, 12 deletions
diff --git a/.github/workflows/report-api-diff.yml b/.github/workflows/report-api-diff.yml index df9cc279e8..9fd1e28f01 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の差分 - <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 }} |