跳到主要内容

Product Overview

What is AtomGit Action

AtomGit Action is the native automation pipeline engine of the AtomGit platform, adopting the Pipeline as Code philosophy, allowing you to define, trigger, and execute software delivery processes by writing YAML configuration files in your code repository. Pipeline configurations are stored alongside business code, versioned together, following the GitOps practice of Everything as Code.

Core Concepts

ConceptDescription
Pipeline as CodePipeline definitions are stored in the .gitcode/workflows/ directory, shared with business code for submission, review, and audit processes, all changes are traceable
Declarative ConfigurationDefine pipeline structure using concise YAML syntax, no need to write orchestration scripts, reducing the learning curve
Reusable OrchestrationAction plugins and reusable workflows (workflow_call) support cross-repository references and nested calls, avoiding repetitive maintenance
Security IsolationBuilt-in pull_request / pull_request_target dual-event model, Secret encryption storage, Token minimum permission control, ensuring pipeline security in Fork scenarios

Platform Capabilities Overview

Event-Driven: Multiple Trigger Methods

AtomGit Action supports a rich set of event triggers, covering the full range of code collaboration scenarios:

Trigger MethodDescriptionTypical Scenario
pushTriggered by code pushAutomatically build and deploy after merging into the main branch
pull_requestTriggered on PR creation, update, or mergePR code check, build validation
pull_request_targetSecure mode PR trigger (target branch context)Automatic tagging, comments for Fork PRs (can access Secrets)
issue_commentTriggered by issue comment/deploy command-based deployment
pull_request_commentTriggered by PR comment (supports regular expression filtering)Execute specific actions within PR comments
workflow_dispatchManual trigger (supports input parameters)Release specific versions, emergency hotfixes
workflow_callReusable workflow callOrganization-level standardized process orchestration
scheduleScheduled trigger (cron expression)Daily builds, regular inspections

Each event supports branches, paths, tags, and other filtering rules, precisely controlling the scope of triggers. A single workflow can combine multiple trigger events.

Execution Orchestration: Stages + Jobs + Steps

AtomGit Action provides a two-tier orchestration mechanism, balancing flexibility and controllability:

Event → Workflow → Stages (serial) → Jobs (parallel within stage) → Steps (serial)
├─ run (Shell command)
└─ uses (Action plugin)
  • Stages Mechanism: Unique to AtomGit Action, stages are executed serially, jobs within a stage are parallel by default, supports fail_fast fast-fail strategy, suitable for delivery processes requiring strict gatekeeping
  • Needs Dependency Mechanism: DAG dependency orchestration at the job level, enabling flexible topological relationships
  • Post Processing: A unique post-processing stage in AtomGit Action, used for notifications, cleanup, reporting, etc.
  • Matrix Strategy: Achieve parallel builds and tests for multiple OS, versions, and architectures through strategy.matrix

Runners: Managed + Self-Hosted

Runner TypeDescriptionTag Format
Official ManagedCloud resource pool ready to use, pre-installed with mainstream language toolchainsThree-part format {os},{arch},{flavor}, such as [ubuntu-24, x64, small]
Self-HostedCustom infrastructure, supports GPU, internal network, custom toolchainsself-hosted + custom tags

The official resource pool provides 6 specifications ranging from 1 core 4G (slim) to 32 cores 128G (2xlarge), defaulting to [ubuntu-latest, x64, small] (2 cores 8G). It supports specifying a custom Docker image via the container field.

Variables and Secrets: Four-Level Configuration System

TypeScopeReference MethodApplicable Scenario
envWorkflow / Job / Step three levels$VAR_NAME or ${{ env.VAR }}Temporary environment variables
varsOrganization / Project level${{ vars.VAR }}Shared configuration across pipelines
secretsOrganization / Project${{ secrets.NAME }}Sensitive information (passwords, Tokens) (log auto-redaction)
inputsworkflow_dispatch / workflow_call${{ inputs.NAME }}Workflow input parameters (only supports string type)

Context and Expressions

AtomGit Action provides 12 contexts, using the ${{ context.property }} expression syntax to dynamically access runtime information in workflows:

ContextDescriptionTypical Use
atomgitPlatform and event core informationBranch judgment atomgit.ref, event type atomgit.event_name
envCustom environment variablesVariable reference env.APP_NAME
varsConfiguration variablesDeployment target vars.DEPLOY_ENV
secretsEncrypted keysCredential reference secrets.DEPLOY_TOKEN
inputsInput parametersManual trigger parameters inputs.environment
job / jobsCurrent / called job informationStatus judgment job.status
stepsStep information and outputsCross-step value transfer steps.id.outputs.result
runnerRunner environment informationSystem runner.os, temporary directory runner.temp
matrix / strategyMatrix variables and strategy informationMatrix parameters matrix.version

Expressions support comparison operations, logical operations, status functions (always()), and string functions (contains/startsWith/format, etc.).

Security and Permissions

Security CapabilityDescription
Secret Encryption StorageKeys are encrypted when created in the interface, logs automatically redact to ***, Fork PRs cannot access project secrets by default
Minimum Token PermissionsThe scope of ATOMGIT_TOKEN permissions is precisely controlled by the permissions field (read/write/none), supports permissions: {} minimum permission mode
PR Security IsolationIn the pull_request event, workflows in Fork repositories have only read permissions and cannot access Secrets; pull_request_target uses the workflow file from the target branch, preventing malicious PRs from tampering with execution logic
Concurrency ControlLimit the number of concurrent runs of the same workflow through concurrency, supporting IGNORE (ignore) and QUEUE (queue) strategies

Artifacts and Cache

CapabilityDescription
ArtifactsPass build artifacts across Jobs, supports upload/download, can set retention days
CacheFile-based dependency caching mechanism, accelerates dependency installation for npm, Maven, pip, Gradle, etc., via key + restore-keys prefix matching

Overview of Workflow File Structure

A complete AtomGit Action workflow file includes the following core fields:

name: Example Pipeline                   # Workflow name

on: # Trigger events
push:
branches: [main]
workflow_dispatch:
inputs:
environment:
type: string

env: # Workflow-level environment variables
APP_NAME: my-app

defaults: # Default settings
run:
shell: bash

concurrency: # Concurrency control
enable: true
max: 3
exceed-action: QUEUE

permissions: # Permission declaration
repository: read
pr: write

stages: # Stage definition (optional)
build-stage:
name: Build Stage
fail_fast: true
jobs:
build:
runs-on: [ubuntu-latest, x64, small]
steps:
- uses: checkout
- run: make build

deploy-stage:
name: Deploy Stage
jobs:
deploy:
runs-on: [ubuntu-latest, x64, small]
steps:
- run: make deploy

post: # Post-processing stage
jobs:
post-process:
runs-on: [ubuntu-latest, x64, small]
steps:
- run: echo "notification"