diff --git a/.github/workflows/benchmark-comment-trigger.yml b/.github/workflows/benchmark-comment-trigger.yml new file mode 100644 index 00000000000..1259f4faa05 --- /dev/null +++ b/.github/workflows/benchmark-comment-trigger.yml @@ -0,0 +1,51 @@ +# This workflow is used to trigger benchmarks on a PR when a specific comment is added +# to the PR. The workflow runs on all PR comments containing the string 'benchmark' +# and the string '@bench-bot'. The workflow collects some information about the PR +# and then forwards the information to the lance-bench workflow. +# +# The lance-bench repository is a public repository in the lancedb organization which +# runs benchmarks against the Lance repository on a regular basis and stores the results +# in a historical database. + +name: Benchmark Comment Trigger + +on: + issue_comment: + types: [created] + +jobs: + forward-to-bench: + # Only process comments on PRs that mention @bench-bot and contain 'benchmark' + if: | + github.event.issue.pull_request != null && + contains(github.event.comment.body, '@bench-bot') && + contains(github.event.comment.body, 'benchmark') + runs-on: ubuntu-latest + steps: + - name: Get PR details + id: pr + uses: actions/github-script@v7 + with: + script: | + const pr = await github.rest.pulls.get({ + owner: context.repo.owner, + repo: context.repo.repo, + pull_number: context.issue.number + }); + + core.setOutput('head_sha', pr.data.head.sha); + + - name: Forward to lance-bench + uses: peter-evans/repository-dispatch@v2 + with: + token: ${{ secrets.LANCE_BENCH_DISPATCH_TOKEN }} + repository: lancedb/lance-bench + event-type: pr-comment + client-payload: | + { + "comment_body": ${{ toJson(github.event.comment.body) }}, + "comment_user": "${{ github.event.comment.user.login }}", + "pr_number": ${{ github.event.issue.number }}, + "pr_head_sha": "${{ steps.pr.outputs.head_sha }}", + "repository": "${{ github.repository }}" + }