From ca19bae72f5f8bf77f15fc4912c23cf894d0e063 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Renault?= Date: Mon, 9 Oct 2023 14:56:41 +0200 Subject: [PATCH] Prefer using a action to manage commands --- .../trigger-benchmarks-on-message.yml | 21 ++++++++++++------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/.github/workflows/trigger-benchmarks-on-message.yml b/.github/workflows/trigger-benchmarks-on-message.yml index ef90ae851..d41490d2a 100644 --- a/.github/workflows/trigger-benchmarks-on-message.yml +++ b/.github/workflows/trigger-benchmarks-on-message.yml @@ -1,15 +1,13 @@ name: Benchmarks (PR) -on: - issue_comment: - types: [created, edited] +on: issue_comment +permissions: + issues: write env: - BENCH_NAME: search_geo GH_TOKEN: ${{ secrets.MEILI_BOT_GH_PAT }} jobs: run-benchmarks-on-comment: - if: contains(github.event.comment.body, '@meilisearch run benchmarks') name: Run and upload benchmarks runs-on: benchmarks timeout-minutes: 4320 # 72h @@ -21,6 +19,13 @@ jobs: toolchain: stable override: true + - name: Check for Command + id: command + uses: xt0rted/slash-command-action@v2 + with: + command: benchmark + reaction-type: "eyes" + # Set variables - name: Set current branch name shell: bash @@ -36,14 +41,14 @@ jobs: id: commit_sha - name: Set file basename with format "dataset_branch_commitSHA" shell: bash - run: echo "basename=$(echo ${BENCH_NAME}_${{ steps.normalized_current_branch.outputs.name }}_${{ steps.commit_sha.outputs.short }})" >> $GITHUB_OUTPUT + run: echo "basename=$(echo ${{ steps.command.outputs.command-arguments }}_${{ steps.normalized_current_branch.outputs.name }}_${{ steps.commit_sha.outputs.short }})" >> $GITHUB_OUTPUT id: file # Run benchmarks - - name: Run benchmarks - Dataset ${BENCH_NAME} - Branch ${{ steps.current_branch.outputs.name }} - Commit ${{ steps.commit_sha.outputs.short }} + - name: Run benchmarks - Dataset ${{ steps.command.outputs.command-arguments }} - Branch ${{ steps.current_branch.outputs.name }} - Commit ${{ steps.commit_sha.outputs.short }} run: | cd benchmarks - cargo bench --bench ${BENCH_NAME} -- --save-baseline ${{ steps.file.outputs.basename }} + cargo bench --bench ${{ steps.command.outputs.command-arguments }} -- --save-baseline ${{ steps.file.outputs.basename }} # Generate critcmp files - name: Install critcmp