benchmark-action / benchmark-action/github-action-benchmark

Support commenting on a PR when trigger is "issue_comment" - Action is not creating any comments on PR

Open
#250 8 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
TypeScript
Stars
1.3k
Forks
184
PR merge metrics
No merged PRs in 30d

Description

I was trying to setup a Github action that runs when I open a PR and add a comment with the content `/benchmark`.
Here's my workflow file:
```yaml
name: Benchmark test

on:
issue_comment:
types: [created, edited, deleted]

jobs:
run-benchmark:
if: contains(github.event.comment.html_url, '/pull/') && contains(github.event.comment.body, '/benchmark')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run benchmark
run: |
python3 gen_random_result.py | tee ${GITHUB_WORKSPACE}/output.json
- name: Download previous benchmark data
uses: actions/cache@v4
with:
path: ./cache
key: ${{ runner.os }}-benchmark

- name: Store new result
uses: benchmark-action/github-action-benchmark@v1
with:
tool: customSmallerIsBetter
output-file-path: output.json
external-data-json-path: ./cache/benchmark-data.json
github-token: ${{ secrets.GITHUB_TOKEN }}
summary-always: true
comment-always: true
```

The `gen_random_result.py` script does exactly what its name says, it just generates some random data of the form
```json
[
{
"name": "Test benchmark",
"unit": "Seconds",
"value": "0.4937825918725717"
}
]
```

The action runs as expected but it doesn't generate a comment on the PR with the results.
Is there something I'm missing?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.