push, workflow_dispatch, and schedule. To avoid unnecessary builds, you can fine-tune which events—and which parts of those events—actually invoke your jobs.
First, review GitHub’s list of available event activity types. For example, Pull Request events support activities like assigned, opened, and closed:



Key Filter Options
| Filter Key | Description | Applies To |
|---|---|---|
branches | Only run on listed branches | push, pull_request |
branches-ignore | Skip listed branches | push, pull_request |
paths-ignore | Exclude specific files or directories | push, pull_request |
types | Limit to certain activity types | pull_request |
Using these filters reduces unexpected workflow runs and speeds up your CI/CD pipeline.
Example Workflow: Combining Filters and Activity Types
Add the file at.github/workflows/filters-and-activities.yml:
Reviewing the Push Filter
branches: [main]ensures only pushes tomaintrigger the workflow.branches-ignore: ['feature/*', 'test/**']skips any branch matching those patterns.
Live Example 1: Push to main
Pushing to main queues and runs the workflow:

Live Example 2: Push to Ignored Branch
feature/* is ignored, no workflow runs:

Pull Request Filters and Activity Types
Example 1: Only README.md Changed
Opening a PR from feature/event-testing to main with only README.md modified will not trigger the workflow due to paths-ignore:


Example 2: Other Files Changed
Modify any file besidesREADME.md, push, and open a new PR. The workflow now triggers:

hello job:

Conclusion
By combiningbranches, branches-ignore, paths-ignore, and types, you gain precise control over which push and pull_request events trigger your workflows. This leads to faster feedback cycles and cleaner CI build history.