Skip to content

Comment on pull request #627

Comment on pull request

Comment on pull request #627

Workflow file for this run

name: Comment on pull request
on:
workflow_run:
workflows:
- Check type sizes
types:
- completed
jobs:
run:
runs-on: ubuntu-latest
steps:
- name: Download artifact
uses: dawidd6/action-download-artifact@v3
with:
workflow: .github/workflows/check-type-sizes.yml
run_id: ${{ github.event.workflow_run.id }}
name: comment-info.json
- name: Format comment
id: format
run: |
set -ex
echo 'body<<EOF' >>$GITHUB_OUTPUT
jq --raw-output .comment comment-info.json >>$GITHUB_OUTPUT
echo 'EOF' >>$GITHUB_OUTPUT
echo "COMMENT_SEARCH=$(jq --raw-output .comment_search comment-info.json)" >>$GITHUB_ENV
echo "COMMENT_PR_NUMBER=$(jq --raw-output .pr_number comment-info.json)" >>$GITHUB_ENV
echo "COMMENT_UPDATE_ONLY=$(jq --raw-output 'if .update_only then 1 else 0 end' comment-info.json)" >>$GITHUB_ENV
- name: Find existing comment
id: find_comment
uses: peter-evans/find-comment@v3
with:
issue-number: ${{ env.COMMENT_PR_NUMBER }}
comment-author: github-actions[bot]
body-includes: ${{ env.COMMENT_SEARCH }}
- name: Post comment
if: ${{ env.COMMENT_UPDATE_ONLY != 1 || steps.find_comment.outputs.comment-id != '' }}
uses: peter-evans/create-or-update-comment@v4
with:
issue-number: ${{ env.COMMENT_PR_NUMBER }}
comment-id: ${{ steps.find_comment.outputs.comment-id }}
body: ${{ steps.format.outputs.body }}
edit-mode: replace