Skip to content

Commit

Permalink
Update existing benchmarks comment on the PR
Browse files Browse the repository at this point in the history
  • Loading branch information
camposandro committed Oct 9, 2023
1 parent 8ff9456 commit 60b8202
Showing 1 changed file with 14 additions and 20 deletions.
34 changes: 14 additions & 20 deletions .github/workflows/asv-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,24 +84,18 @@ jobs:
env:
STEP_URL: "${{ steps.jobs.outputs.html_url }}#step:8:1"

- name: Publish comment to PR
uses: actions/github-script@v6
- name: Find benchmarks comment
uses: peter-evans/find-comment@v2
id: find-comment
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const fs = require('fs');
const path = require('path');
const workingDir = process.env.WORKING_DIR;
try {
process.chdir(workingDir);
const comment = fs.readFileSync('output', 'utf-8');
const { data } = await github.rest.issues.createComment({
...context.repo,
issue_number: context.issue.number,
body: comment,
});
console.log('Comment published:', data.html_url);
} catch (err) {
console.error(err);
}
issue-number: ${{ github.event.pull_request.number }}
comment-author: 'github-actions[bot]'
body-includes: view all benchmarks

- name: Create or update benchmarks comment
uses: peter-evans/create-or-update-comment@v3
with:
comment-id: ${{ steps.find-comment.outputs.comment-id }}
issue-number: ${{ github.event.pull_request.number }}
body-path: ${{ env.WORKING_DIR }}/output
edit-mode: replace

0 comments on commit 60b8202

Please sign in to comment.