跳到主要内容

Trigger Events

Event Overview

An Event is the driving force that starts a pipeline. When a specific action occurs in the repository, the system generates a corresponding event and triggers the Workflow that matches the on configuration.

Supported Event Types

EventDescriptionTypical Configuration
pushCode pushon: push: branches: [main]
pull_requestPR eventon: pull_request: branches: [main]
pull_request_targetPR security eventon: pull_request_target: branches: [main]
issue_commentIssue commenton: issue_comment: types: [created]
pull_request_commentPR commenton: pull_request_comment: types: [created]
workflow_dispatchManual triggeron: workflow_dispatch: inputs: {...}
workflow_callReusable callon: workflow_call: inputs: {...}
scheduleScheduled triggeron: schedule: - cron: '0 2 * * *'

Important Difference: pull_request runs using the code from the PR source branch, while pull_request_target runs using the base branch code and has write access to the repository. It is recommended to use pull_request_target in fork scenarios.

Multiple Event Combinations

on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch: