GitHub Actions Certification
GitHub Actions Core Concepts
Workflow Event Filters and Activity Types
GitHub Actions workflows can trigger on events such as 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:

For details on Pull Request types, see the official docs:

Push events don’t have activity types, but you can filter by branches, tags, and paths:

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 |
Note
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:
name: Workflow Filters and Activities
on:
workflow_dispatch:
push:
branches:
- main
branches-ignore:
- 'feature/*'
- 'test/**'
pull_request:
types:
- opened
- closed
paths-ignore:
- README.md
branches:
- main
jobs:
hello:
runs-on: ubuntu-latest
steps:
- name: Show Event
run: echo "This workflow ran for event: ${{ github.event_name }}"
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
git checkout -b feature/event-testing
# Edit README.md
git add README.md
git commit -m "Update README for testing"
git push -u origin feature/event-testing
Since 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:

Even after opening or closing, nothing runs:

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

Click into the run to view the hello job:

Conclusion
By combining branches, 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.
Watch Video
Watch video content