Skip to content

Commit

Permalink
[FIX]: Update PR Comment, with github-script (#445)
Browse files Browse the repository at this point in the history
  • Loading branch information
demetribu authored Aug 26, 2023
1 parent dfe7ca6 commit df1eea2
Showing 1 changed file with 25 additions and 9 deletions.
34 changes: 25 additions & 9 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,32 @@ jobs:
path: benchmark-reports.tgz
retention-days: 30

- name: PR Comment
uses: github-actions-up-and-running/[email protected]
if: ${{ github.event_name == 'pull_request' }}
- name: Comment PR
if: github.event_name == 'pull_request'
uses: actions/github-script@v6
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
message: |
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const issue_number = context.issue.number;
const owner = context.repo.owner;
const repo = context.repo.repo;
const contentWithLineNumbers = `${process.env.BENCHMARK_REPORT}`
.split('\n')
.map((line, idx) => `${idx + 1}. ${line}`)
.join('\n');
const body = `
<details>
<summary>BENCHMARK_REPORT</summary>
```
${{ env.BENCHMARK_REPORT }}
```
<pre style="display:block; white-space:pre-wrap; background-color: #f5f5f5; padding: 10px; border: 1px solid #ccc; border-radius: 4px; font-family: monospace;">
${contentWithLineNumbers}
</pre>
</details>
`;
github.rest.issues.createComment({
issue_number,
owner,
repo,
body
});

0 comments on commit df1eea2

Please sign in to comment.