Skip to content

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

@nilsfriess

Description

@nilsfriess

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:

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

[
 {
    "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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions