Reputation: 243
I have some very expensive benchmarks/tests which I'd only like to run on some PRs, not all. Is there a way to do this with github actions?
Upvotes: 19
Views: 18799
Reputation: 915
Yes, there are several ways. Most of the workflow triggers can be further specified through "Activity Types". For Pull Requests, they are:
- assigned
- unassigned
- labeled
- unlabeled
- opened
- edited
- closed
- reopened
- synchronize
- ready_for_review
- locked
- unlocked
- review_requested
- review_request_removed
Now, you could run the workflow only for PRs matching a certain pattern:
on:
pull_request:
branches:
- 'benchmark/**'
You could also do it with labels:
on:
pull_request: labeled
...
jobs:
check-label:
if: ${{ github.event.label.name == 'benchmark' }}
...
And of course you can also always use manual triggers only:
on: workflow_dispatch
Upvotes: 27