Safeguard
Developer Tools•

Which GitHub Actions trigger should a security automation use?

Compare pull_request, push, schedule, workflow_dispatch and repository_dispatch for security jobs, with what each can see, run from and risk.

Safeguard Security Team
3 min read

Use pull_request to check proposed changes, push to the default branch to record what shipped, schedule to catch new advisories, workflow_dispatch for manual runs and repository_dispatch for events from outside systems. Avoid privileged triggers unless the job truly needs them.

The comparison

TriggerStarts whenRuns fromBest security useMain risk
pull_requestA pull request opens or changesThe merge result of the pull requestGate checks, dependency diffForked pull requests get limited secrets
pushCommits land on a branchThe pushed branchScan after merge, build SBOMRuns after the fact
scheduleA cron timeLatest default branch commitRescan for new advisories, weekly reportDelays and silent disabling
workflow_dispatchA person or API callA chosen branchManual rescan, on demand reportNeeds access control
repository_dispatchAn API call with an event typeDefault branchAdvisory feed or ticket eventsUntrusted payload
pull_request_targetPull request activityThe base branchLabel and comment automationPrivileged, unsafe with untrusted checkout

The "runs from" column comes from GitHub's event reference, which states for example that scheduled workflows run on the latest commit of the default branch and that repository_dispatch needs the workflow file on the default branch.

Match trigger to question

Is this change safe to merge? Use pull_request. The result should be a required status check. See vulnerability scan cadence for the combination of triggers.

Did something we already shipped become vulnerable? Code did not change, so no Git event fires. Use schedule or a repository_dispatch driven by an advisory source. See scheduled or event driven scans.

Can I run this by hand when asked? Use workflow_dispatch with declared inputs, so a person picks a repository from a list instead of typing free text.

Does an outside system need to start this? Use repository_dispatch, and validate the payload. See repository_dispatch for security automation.

Fork pull requests

GitHub's documentation notes that for pull requests from a forked repository, events are sent to the base repository, and that a first-time contributor's workflow may need approval from a maintainer. Secrets are generally not passed to workflows from forks on the pull_request trigger, which is why people reach for pull_request_target. That choice moves risk onto you. The hardening guide says workflows with pull_request_target or workflow_run must not explicitly check out untrusted code. If your job only needs to read the diff and post a label, keep it simple and unprivileged.

A default starter set

  1. pull_request: dependency scan and policy check, required.
  2. push to main: generate and store the SBOM.
  3. schedule: weekly rescan with an off hour minute.
  4. workflow_dispatch: the same scan, runnable by hand.

Add repository_dispatch only when you have a real external event source.

Quick check

Can one workflow use several triggers?

Yes. List them under the on key and use conditions on the event name when behavior differs.

Which trigger finds vulnerabilities published after a merge?

A schedule or an external event through repository_dispatch, since no Git event occurs.

Sources

Safeguard's continuous monitoring and CI policy gates cover both the on change and the after the fact questions. Try the free scan at gold.safeguard.sh/scan.

Last reviewed: 19 October 2026.

Never miss an update

Weekly insights on software supply chain security, delivered to your inbox.

Self-healing security runs on Safeguard.

Your first fix PR is minutes away.

No sales call required, even your agent can complete the purchase over MCP.