Skip to content

Comment on pull request #270

Comment on pull request

Comment on pull request #270

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@v2
with:
workflow: .github/workflows/check-type-sizes.yml
run_id: ${{ github.event.workflow_run.id }}
name: comment-info.json
path: downloads
- name: Extract artifact
id: extract
run: |
set -ex
body="$(jq --raw-output .comment downloads/comment-info.json)"
body="${body//'%'/'%25'}"
body="${body//$'\n'/'%0A'}"
body="${body//$'\r'/'%0D'}"
echo "::set-output name=body::$body"
echo "COMMENT_SEARCH=$(jq --raw-output .comment_search downloads/comment-info.json)" >> $GITHUB_ENV
echo "COMMENT_PR_NUMBER=$(jq --raw-output .pr_number downloads/comment-info.json)" >> $GITHUB_ENV
echo "COMMENT_UPDATE_ONLY=$(jq --raw-output 'if .update_only then 1 else 0 end' downloads/comment-info.json)" >> $GITHUB_ENV
- name: Find existing comment
id: find_comment
uses: peter-evans/find-comment@v1
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@v1
with:
issue-number: ${{ env.COMMENT_PR_NUMBER }}
comment-id: ${{ steps.find_comment.outputs.comment-id }}
body: ${{ steps.extract.outputs.body }}
edit-mode: replace