Skip to content

Pull Request Comment #371

Pull Request Comment

Pull Request Comment #371

Workflow file for this run

name: Pull Request Comment
on:
workflow_run:
workflows: ["Benchmark Suite"]
types:
- completed
jobs:
pr-comment:
name: "Pull Request Comment"
runs-on: ubuntu-latest
if: >
github.event.workflow_run.event == 'pull_request' &&
github.event.workflow_run.conclusion == 'success'
steps:
- name: Download pull request id artifact
uses: dawidd6/action-download-artifact@v2
with:
workflow: ${{ github.event.workflow_run.workflow_id }}
name: pr
path: ./var/phpbench/pr
- name: Save PR id
id: pr
run: |
echo "id=$(<./var/phpbench/pr/pr-id.txt)" >> $GITHUB_OUTPUT
- name: Download phpbench benchmarks artifact
uses: dawidd6/action-download-artifact@v2
with:
workflow: ${{ github.event.workflow_run.workflow_id }}
name: phpbench
path: ./var/phpbench/summary/
- name: Get benchmarks output
id: get-benchmarks
run: |
echo "content<<EOF" >> $GITHUB_OUTPUT
echo "$(cat ./var/phpbench/summary/summary.txt)" >> $GITHUB_OUTPUT
echo EOF >> $GITHUB_OUTPUT
- name: Find comment
uses: peter-evans/find-comment@v2
id: fc
with:
issue-number: ${{ steps.pr.outputs.id }}
comment-author: 'github-actions[bot]'
body-includes: '# Flow PHP - Benchmarks'
- name: Create or update comment
uses: peter-evans/create-or-update-comment@v3
with:
comment-id: ${{ steps.fc.outputs.comment-id }}
issue-number: ${{ steps.pr.outputs.id }}
body: ${{ steps.get-benchmarks.outputs.content }}
edit-mode: replace