Trigger Events
This document is the complete reference for AtomGit Action trigger events, covering the configuration syntax and filter field descriptions for all events such as push, pull_request, workflow_dispatch, schedule, and more.
Workflows define their trigger conditions using the on keyword. AtomGit Action supports the following trigger events. Workflow files are stored in the .gitcode/workflows/ directory of the repository.
1.1 push
Triggered when a push operation occurs, including branch pushes and tag pushes.
on:
push:
branches:
- main
- 'releases/**'
tags:
- v1.*
- v2.*
paths:
- 'src/**'
- 'package.json'
Filter Fields:
| Field | Description | Example |
|---|---|---|
branches | Branch name patterns to match | main, releases/** |
branches-ignore | Branch name patterns to exclude | experimental/** |
tags | Tag name patterns to match | v1.* |
tags-ignore | Tag name patterns to exclude | v1.0.* |
paths | File path patterns to match | src/** |
paths-ignore | File path patterns to exclude | docs/** |
Note:
branchesandbranches-ignorecannot be used simultaneously;tagsandtags-ignorecannot be used simultaneously.pathsandpaths-ignorecan be combined with branch/tag filters.
Special Usage:
on:
push:
branches:
- '**' # All branches
- '!main' # Exclude main (exclude mode starts with !)
1.2 pull_request
Triggered when a Pull Request is opened, updated, or merged.
on:
pull_request:
types:
- open
- reopen
- update
- merge
branches:
- main
- 'feature/**'
paths:
- 'src/**'
paths-ignore:
- 'docs/**'
Event Types (types):
| Type | Description |
|---|---|
open | PR opened |
reopen | PR reopened |
update | New commits pushed to the PR source branch (most common trigger scenario) |
merge | PR merged |
Default: When
typesis not specified, the default is[open, reopen, update], triggering on PR creation, re-opening, and updates, excluding merge events.
Filter Fields: Same as push, supporting branches, branches-ignore, paths, paths-ignore.
1.3 pull_request_target
Similar to pull_request, but the workflow runs in the context of the target branch (base branch), allowing read/write access to the target repository. Suitable for scenarios requiring access to repository Secrets or performing write operations (e.g., auto-labeling, commenting).
on:
pull_request_target:
types:
- open
- update
- merge
branches:
- main
Security Tip:
pull_request_targetuses the workflow file and permissions of the target branch. PRs from forked repositories will also trigger it. Exercise caution when executing code from fork PRs to avoid security risks.
Default: When
typesis not specified, the default is[open, reopen, update], consistent withpull_request.
1.4 issue_comment
Triggered when an Issue comment is created, edited, or deleted.
on:
issue_comment:
types:
- created
- edited
- deleted
Event Types:
| Type | Description |
|---|---|
created | Comment created |
edited | Comment edited |
deleted | Comment deleted |
1.5 pull_request_comment
Distinct from issue_comment, this triggers only for Pull Request comments.
on:
pull_request_comment:
types:
- created
- edited
- deleted
branches:
- main
comments:
- '/deploy'
- '/test'
Event Types:
| Type | Description |
|---|---|
created | Comment created |
edited | Comment edited |
deleted | Comment deleted |
Filter Fields:
| Field | Description | Example |
|---|---|---|
branches | Branch name patterns to match for the PR target | main, feature/** |
comments | Filter based on regex matching of comment content | /deploy, /test |
Comments Filter Explanation: The
commentsfield supports conditional filtering based on regular expressions applied to the comment content. Only comments matching the specified regex pattern will trigger the workflow. For example, configuringcomments: ['/deploy']will only trigger the workflow if the comment contains the/deploycommand.
1.6 workflow_dispatch
Manually trigger a workflow, supporting custom input parameters.
on:
workflow_dispatch:
inputs:
environment:
description: 'Target deployment environment'
required: true
default: 'staging'
type: string
deploy_count:
description: 'Number of parallel deployments'
required: false
default: "1"
type: number
dry_run:
description: 'Validation only without deployment'
required: false
default: "false"
type: boolean
log_level:
description: 'Log level'
required: false
default: 'info'
type: choice
options:
- 'info'
- 'error'
- 'warning'
inputs Property Fields:
| Field | Description | Example Value |
|---|---|---|
type | Input type | string, boolean, choice, number |
required | Whether it is mandatory | true, false |
description | Description | env_type, port_number |
default | Default value | true, false |
options | Single-choice options, applies only to choice type | info, warning, error |
AtomGit Action's inputs support string, boolean, choice, and number types.
| Type | Description | Example Value |
|---|---|---|
string | String input | test, prod, dev |
boolean | Boolean input | true, false |
choice | Single-choice input, configured via the options field | info, warning, error |
number | Numeric input | 8080, 50 |
Access input values via the
inputscontext within workflows, e.g.,${{ inputs.environment }}. If numeric or boolean semantics are needed, you can perform type conversion via expressions in the workflow.
1.8 workflow_call
Allows one workflow to be called by another (reusable workflow).
on:
workflow_call:
inputs:
config-path:
description: 'Configuration file path'
required: false
default: 'config/default.json'
type: string
environment:
description: 'Deployment environment'
required: true
type: string
secrets:
deploy-token:
description: 'Deployment authentication token'
required: true
db-password:
description: 'Database password'
required: false
Caller Workflow Example:
jobs:
deploy:
name: Deploy
uses: ./.gitcode/workflows/deploy.yml
with:
config-path: 'config/production.json'
environment: production
secrets:
deploy-token: ${{ secrets.DEPLOY_TOKEN }}
db-password: ${{ secrets.DB_PASSWORD }}
1.9 schedule
Trigger workflows on a schedule using POSIX cron syntax.
on:
schedule:
- cron: '30 5 * * 1,3' # 05:30 UTC+8 every Monday & Wednesday
- cron: '0 2 * * *' # 02:00 UTC+8 daily
- cron: '15 0 1 1 *' # 00:15 UTC+8 on Jan 1st annually
Cron Syntax Format: minute hour day month weekday
| Position | Range | Description |
|---|---|---|
| minute | 0-59 | Minute of the hour |
| hour | 0-23 | Hour (UTC+8) |
| day | 1-31 | Day of the month |
| month | 1-12 | Month |
| weekday | 0-6 | 0=Sunday, 1=Monday, ..., 6=Saturday |
Special Symbols:
| Symbol | Description | Example |
|---|---|---|
* | Any value | * * * * * — Every minute |
, | List separator | 1,3,5 — 1st, 3rd, 5th |
- | Range | 1-5 — 1 to 5 |
/ | Step | */15 — Every 15 units |
Note: The minimum interval for
scheduleis 5 minutes. Cron uses UTC+8 time; please convert to your local time zone accordingly.