Skip to content

Commit

Permalink
👷(api) fix conditional steps/jobs execution to update bench data
Browse files Browse the repository at this point in the history
Dealing with conditions can be tricky. Previous conditions failed as
github.event.pull_request.merged is null when merging to main.
  • Loading branch information
jmaupetit committed Dec 4, 2024
1 parent 87df5e5 commit d4f7992
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,8 @@ 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: |
echo -e "### Current benchmark\n\n" >> bench_admin_stats.md && \
pipenv run csvlook -I bench_admin_stats_stamped.csv >> bench_admin_stats.md && \
Expand All @@ -197,8 +197,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');
Expand All @@ -217,7 +217,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
Expand Down

0 comments on commit d4f7992

Please sign in to comment.