publish_comment.yml
1 name: Publish a PR comment 2 3 on: 4 workflow_run: 5 workflows: [Core Benchmarks] 6 types: 7 - completed 8 9 jobs: 10 benchmark-summary: 11 runs-on: ubuntu-latest 12 if: ${{ github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.event == 'pull_request' }} 13 permissions: 14 pull-requests: write 15 steps: 16 - uses: actions/download-artifact@v4 17 with: 18 run-id: ${{ github.event.workflow_run.id }} 19 github-token: ${{ github.token }} 20 name: benchmark-summary 21 path: summary 22 23 - name: 'Comment on PR' 24 uses: actions/github-script@v6 25 with: 26 script: | 27 let fs = require('fs'); 28 let issue_number = Number(fs.readFileSync('./summary/pr_number')); 29 let body = fs.readFileSync('./summary/comment.md', "utf-8"); 30 await github.rest.issues.createComment({ 31 owner: context.repo.owner, 32 repo: context.repo.repo, 33 issue_number: issue_number, 34 body: body 35 });