From 77a48b6a961145917791d6946f327b7d22c2a9e6 Mon Sep 17 00:00:00 2001 From: Julien Maupetit Date: Wed, 4 Dec 2024 16:36:16 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=91=B7(api)=20fix=20conditional=20steps/j?= =?UTF-8?q?obs=20execution=20to=20update=20bench=20data?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Dealing with conditions can be tricky. Previous conditions failed as github.event.pull_request.merged is null when merging to main. --- .github/workflows/api.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/api.yml b/.github/workflows/api.yml index e015bea8..85aeff05 100644 --- a/.github/workflows/api.yml +++ b/.github/workflows/api.yml @@ -184,9 +184,10 @@ jobs: name: api-admin-benchmark path: ./src/api/bench_admin_stats_stamped.csv - name: Generate markdown table - # Only when in PR, not when merged - if: github.event.pull_request.merged == false + # Only when in PR, not when merged to main + if: ${{ github.event_name == 'pull_request' }} run: | + false echo -e "### Current benchmark\n\n" >> bench_admin_stats.md && \ pipenv run csvlook -I bench_admin_stats_stamped.csv >> bench_admin_stats.md && \ echo -e "\n### Comparison with the latest previous benchmark\n\n" >> bench_admin_stats.md && \ @@ -197,8 +198,8 @@ jobs: csvlook -I >> bench_admin_stats.md cat bench_admin_stats.md - uses: actions/github-script@v7 - # Only when in PR, not when merged - if: github.event.pull_request.merged == false + # Only when in PR, not when merged to main + if: ${{ github.event_name == 'pull_request' }} with: script: | const fs = require('node:fs'); @@ -217,7 +218,7 @@ jobs: # Only when a PR is merged update-bench-db: - if: github.event.pull_request.merged == true + if: ${{ github.event_name == 'push' }} needs: - build-api - bench-api