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}