From ecefd5315b44ac75ab5f84ab022190c5fede0f59 Mon Sep 17 00:00:00 2001 From: Dongdong Tian Date: Sun, 7 Jan 2024 16:12:49 +0800 Subject: [PATCH] CI: Run benchmarks if PR is labeled with "run/benchmark" (#2958) Co-authored-by: Wei Ji <23487320+weiji14@users.noreply.github.com> --- .github/workflows/benchmarks.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/benchmarks.yml b/.github/workflows/benchmarks.yml index 358f0105f63..86a0f0a725a 100644 --- a/.github/workflows/benchmarks.yml +++ b/.github/workflows/benchmarks.yml @@ -12,8 +12,9 @@ on: paths: - 'pygmt/**/*.py' - '.github/workflows/benchmarks.yml' - # Uncomment the 'pull_request' line below to trigger the workflow in PR - # pull_request: + # Run in PRs but only if the PR has the 'run/benchmark' label + pull_request: + types: [ opened, reopened, labeled, synchronize ] # `workflow_dispatch` allows CodSpeed to trigger backtest # performance analysis in order to generate initial data. workflow_dispatch: @@ -28,7 +29,7 @@ concurrency: jobs: benchmarks: runs-on: ubuntu-22.04 - if: github.repository == 'GenericMappingTools/pygmt' + if: github.repository == 'GenericMappingTools/pygmt' && (github.event_name != 'pull_request' || contains(github.event.pull_request.labels.*.name, 'run/benchmark')) defaults: run: shell: bash -l {0}