diff --git a/.github/workflows/codspeed.yml b/.github/workflows/codspeed.yml index c9c2f7b4c1..278c8fa877 100644 --- a/.github/workflows/codspeed.yml +++ b/.github/workflows/codspeed.yml @@ -5,6 +5,7 @@ on: branches: - "main" pull_request: + types: [labeled, synchronize] # `workflow_dispatch` allows CodSpeed to trigger backtest # performance analysis in order to generate initial data. workflow_dispatch: @@ -16,6 +17,11 @@ jobs: benchmarks: name: Run benchmarks runs-on: codspeed-macro + # Only run benchmarks for: pushes to main, manual triggers, or PRs with 'benchmark' label + if: | + github.event_name == 'push' || + github.event_name == 'workflow_dispatch' || + (github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'benchmark')) steps: - uses: actions/checkout@v6 with: diff --git a/changes/3673.misc.md b/changes/3673.misc.md new file mode 100644 index 0000000000..83643f5d3c --- /dev/null +++ b/changes/3673.misc.md @@ -0,0 +1 @@ +Benchmark CI now only runs for PRs with the `benchmark` label, reducing CodSpeed credit usage.