GitHub Actions triggers: on push, pull_request, schedule and workflow_dispatch
Every common GitHub Actions trigger: push and pull_request with branch, path and tag filters, activity types, schedule cron, and workflow_dispatch inputs.
In this series26 guides, you're on Triggers
Triggers, set with the on: key, decide when a workflow runs. The four you’ll use most are push, pull_request, schedule and workflow_dispatch. This page shows each one with the filters that keep a workflow from running when it has nothing to do.
What are triggers in GitHub Actions?#
Triggers, or “events”, are specific activities in your GitHub repository that can start a workflow. These can range from code pushes, pull request actions, tag pushes, to even external events calling your GitHub Actions workflows.
The full list of events can be found at GitHub’s documentation ↗.
The on: syntax#
on: takes one of three forms:
- One event:
on: pushruns the workflow on every push, to any branch or tag. - A list:
on: [push, pull_request]runs it when any of the listed events happens. A list takes no filters. - A map, with one key per event. Filters (
branches,tags,paths),typesandinputsonly work in this form, and an event without settings keeps its colon:
on: push: branches: [main] pull_request: workflow_dispatch:This page covers push, pull_request, schedule and workflow_dispatch in detail. These other events come up often:
| Event | Runs when |
|---|---|
pull_request_target | A pull request event, like pull_request, but it runs the default branch’s workflow with secrets and a write token, even for forks. Blocked by default in public repositories from December 2, 2026, unless a policy allows it. See pull_request vs pull_request_target. |
merge_group | A pull request is added to a merge queue. Workflows that report a required check need it; see below. |
release | Release activity. Use types: [published] to run when a release or pre-release is published. See GitHub’s docs ↗. |
workflow_call | Another workflow calls this one as a reusable workflow. |
workflow_run | Another workflow is requested or completes (after another workflow). |
repository_dispatch | A call to the REST API, from a script, another system or another workflow. |
issue_comment | A comment on an issue or pull request is created, edited or deleted (comment commands such as /deploy). It runs the default branch’s workflow. See GitHub’s docs ↗. |
Common GitHub Actions triggers#
-
Push and pull requests: probably the most used triggers, they can automate testing, linting, or deployments based on code changes or proposed merges.
-
Scheduled events: want to run a cleanup script every week or send out a report every day? Scheduled events let you run workflows at predefined times using cron syntax.
-
Manual triggers: sometimes, you need to run a workflow on-demand, not automatically. GitHub Actions allows for manual workflow runs with the
workflow_dispatchevent.
Let’s explore how to implement each of these triggers in your workflows.
Setting up triggers: examples#
1. On push or pull request#
name: CI on Push and PR
on: push: branches: [main] pull_request: branches: [main]
jobs: build: runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v7 - name: Run a script run: echo "Running on push or pull request to main!"This workflow triggers on push events or pull requests targeting the main branch. It’s perfect for running tests or builds to ensure your main branch stays healthy.
Note that for pull_request, the branches filter matches the base branch (the branch the PR wants to merge into), not the contributor’s source branch. So branches: [main] means “run for any PR opened against main”, regardless of where the changes come from.
Without a branches filter on push, a PR from a branch of the same repository runs CI twice for each push: once for push and once for pull_request. Limiting push to main, as above, makes feature branches run only through their pull request.
Pull request activity types#
By default pull_request runs on three activity types: opened, synchronize (new commits pushed to the PR) and reopened. Pick others with types. It replaces the default list for the whole workflow, so keep the defaults you still want:
on: pull_request: types: [opened, synchronize, reopened, ready_for_review]Draft pull requests run CI under the default types too, so ready_for_review only re-runs the same commit, unless your jobs skip drafts with if: github.event.pull_request.draft == false (see conditions).
Don’t add labeled to your CI workflow: every label would re-run all of CI, and with a concurrency group that cancels in progress, it would cancel the running CI. Put a label-gated suite in its own workflow:
name: E2E
on: pull_request: types: [labeled, synchronize]
jobs: e2e: if: >- contains(github.event.pull_request.labels.*.name, 'run-e2e') && (github.event.action != 'labeled' || github.event.label.name == 'run-e2e') runs-on: ubuntu-latest steps: - uses: actions/checkout@v7 - run: npm ci - run: npm run test:e2eIt runs when run-e2e is added and on every push while the label stays on, and skips other labels. Don’t give it a workflow-level cancel-in-progress group, or any other label would cancel a running suite.
Run a workflow on pull requests: which types to use#
Pick the activity types from what the workflow does:
| The workflow | types |
|---|---|
| Tests every commit of a pull request (CI) | None: the defaults, opened, synchronize and reopened |
| Skips drafts, then runs when one is marked ready | The defaults plus ready_for_review, with the draft if: above |
| Checks the title or description | opened, edited and reopened, plus synchronize if the check is required, so that each new commit gets it |
| Runs a suite when a label is added | labeled and synchronize, in its own workflow, like the E2E example above |
| Runs after the pull request is merged | closed, with if: github.event.pull_request.merged == true on the job |
| Cleans up when the pull request closes, merged or not (a preview environment, for example) | closed |
edited fires when the title, the description or the base branch changes. On a merged pull request’s closed run, GITHUB_REF is the branch it was merged into. To run on every commit that lands on main, whatever put it there, use push with branches: [main] instead.
A pull request with a merge conflict doesn’t trigger pull_request workflows until the conflict is resolved. For workflows that need secrets on pull requests from forks, read pull_request vs pull_request_target first.
Path and tag filters#
Skip a workflow when only unrelated files changed:
on: push: branches: [main] paths: - "src/**" - "package-lock.json" pull_request: paths-ignore: - "docs/**" - "**.md"paths runs the workflow when any changed file matches; paths-ignore skips it only when every changed file matches. You can’t set both on one event: use paths with a later ! pattern instead (- "src/**", then - "!src/**/*.md"). Path filters are ignored for tag pushes, and if the matching files aren’t among the first 3,000 changed files, the workflow doesn’t run.
And run release workflows on tags only:
on: push: tags: ["v*"]Push release tags one at a time: when more than three tags are pushed at once, for example with git push --tags, GitHub creates no event for them.
Commit messages can skip runs too. A push or pull request whose head commit message contains [skip ci] (or [ci skip], [no ci], [skip actions], [actions skip], or a skip-checks: true trailer) starts no push or pull_request workflows.
One catch: a workflow skipped by a path or branch filter, or by a [skip ci] commit message, reports no status at all, so if it’s a required check in branch protection, the pull request waits forever. Either don’t make path-filtered workflows required, or filter inside the workflow with a job that checks the changed files and an if: on the others. If a [skip ci] commit blocks a pull request, push a new commit without the skip instruction.
If the branch uses a merge queue, every workflow that reports a required check also needs the merge_group event. Otherwise the queue waits for a check that never runs, and the merge fails:
on: pull_request: branches: [main] merge_group: types: [checks_requested] branches: [main]2. Scheduled workflows#
name: Weekly Cleanup
on: schedule: - cron: "17 2 * * 0" # 02:17 UTC every Sunday
jobs: cleanup: runs-on: ubuntu-latest steps: - name: Run cleanup script run: echo "Performing weekly cleanup!"The schedule trigger uses cron syntax ↗ to schedule when the workflow runs. This example triggers a workflow at 02:17 UTC every Sunday, great for regular maintenance tasks.
A few important caveats about scheduled workflows:
-
The cron time is in UTC unless you add a
timezone(an IANA name such asEurope/Paris), supported since March 2026:.github/workflows/report.yml on:schedule:- cron: "30 5 * * 1-5"timezone: "America/New_York"On the day clocks jump forward, a schedule that falls in the skipped hour runs at the next valid time (2:30 becomes 3:00).
-
Scheduled runs only execute on the workflow file as it exists on the repository’s default branch.
-
The shortest interval GitHub allows is once every 5 minutes, and runs can be delayed or skipped entirely during periods of high load, so never rely on
schedulefor precise, time-critical jobs. Pick a minute other than 0, like the 17 in the example: the start of every hour is one of the busiest times. -
In a public repository, scheduled workflows are disabled automatically after 60 days without repository activity. Re-enable them from the Actions tab.
workflow_dispatch: run a workflow manually#
workflow_dispatch starts a workflow on demand: from a Run workflow button in the Actions tab, from the gh CLI or from the REST API. Use it for workflows that shouldn’t run on their own, like a deploy to production:
name: Deploy on Demand
on: workflow_dispatch:
jobs: deploy: runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v7 - name: Deploy script run: echo "Deploying application!"The button sits above the list of the workflow’s runs, and asks which branch to run on:

The Run workflow button only appears once the workflow file is on the default branch, and the same rule applies when you start the workflow from the command line or another workflow.
Inputs#
inputs declares the values a run asks for. Each input has a type: string, boolean, number, choice (one of its options) or environment. description, required and default are optional:
name: Deploy on Demand
on: workflow_dispatch: inputs: environment: description: "Target environment" required: true default: staging type: choice options: - staging - production dry_run: description: "Run without deploying" type: boolean default: false
jobs: deploy: runs-on: ubuntu-latest steps: - uses: actions/checkout@v7 - name: Deploy if: ${{ !inputs.dry_run }} env: TARGET: ${{ inputs.environment }} run: echo "Deploying to $TARGET"Read the values from the inputs context, which keeps booleans as booleans. github.event.inputs holds the same values, but turns booleans into strings, which breaks if: checks on them. A choice input is a string in both.
On GitHub.com, a workflow takes at most 25 inputs (10 on GitHub Enterprise Server), and the inputs payload of a run is limited to 65,535 characters.
Run it with gh workflow run or the REST API#
gh workflow run starts a run. Without flags it prompts for the inputs; -f key=value sets them instead, and inputs you leave out take their default. --ref runs the workflow on another branch or tag:
gh workflow run deploy.yml -f environment=production -f dry_run=truegh workflow run deploy.yml --ref release/2.4 -f environment=staginggh 2.87.0 and later print the URL of the run they start, which a workflow can watch to wait for the result: see Triggering a workflow from another workflow, which also covers the actions: write permission the job needs.
Any other script or system can call the REST API. ref is required, and the workflow is named by its file name or ID:
curl -X POST \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer $GITHUB_TOKEN" \ https://api.github.com/repos/OWNER/REPO/actions/workflows/deploy.yml/dispatches \ -d '{"ref": "main", "inputs": {"environment": "production"}}'By default the call answers 204 No Content. Add "return_run_details": true to the body to get the new run’s ID and its API and web URLs instead (since February 2026). A classic personal access token needs the repo scope.
Seeing triggers in action#
Commit the workflows and watch them in the Actions tab. Start manual workflows from the Actions tab, the command line or the API. To start a workflow from another workflow, see Triggering a workflow from another workflow.
If a workflow doesn’t start#
- The workflow file isn’t on the default branch.
schedule,workflow_dispatch,workflow_run,repository_dispatchandissue_commentonly start workflows whose file is there. - A filter or the commit message skipped it: a branch, tag or path filter that doesn’t match, or
[skip ci]in the commit message (see path and tag filters). - The pull request has a merge conflict.
pull_requestworkflows don’t run until it’s resolved. - The event came from
GITHUB_TOKEN. A push, tag or label made by a workflow withGITHUB_TOKENstarts no workflow. Onlyworkflow_dispatchandrepository_dispatchevents sent with it do. Since June 2026, a pull request opened or updated with it createspull_requestruns that wait until someone with write access clicks Approve workflows to run. For events that should start workflows on their own, use a GitHub App token instead ofGITHUB_TOKEN. - More than three tags were pushed at once. GitHub creates no event for them.
- The workflow is disabled, by hand or, for a schedule in a public repository, after 60 days without activity. Enable it again from the Actions tab.
- An Actions policy blocks the event or the actor. Admins can restrict both with workflow execution protections ↗, generally available since September 2026. A blocked run fails at once with an error such as
Event 'workflow_dispatch' is not allowed to trigger Actions workflows.
Wrap-up#
Triggers are the heartbeat of GitHub Actions, determining when and why your workflows run. Be careful to be specific with your triggers, as they can end up triggering a lot of GitHub Actions runners, which are costly.
Branch, tag and path filters (pattern syntax ↗) are the cheapest way to avoid runs that have nothing to do. To stop redundant runs from piling up when you push to a PR several times in a row, reach for the concurrency keyword.
Jobs, steps and needs covers what happens once a trigger fires.