跳到主要内容

Quick Start

Prerequisites

  • Have an AtomGit/GitCode account and created at least one repository
  • The repository has basic code content (at least one branch)
  • Basic understanding of YAML syntax

Create Workflow File

Create a .gitcode/workflows/ directory at the root of the repository and add a YAML file:

mkdir -p .gitcode/workflows
touch .gitcode/workflows/first-pipeline.yml

Note: The workflow file for AtomGit Action should be placed in .gitcode/workflows/, not ./workflows/. An incorrect directory path will cause the pipeline to not be recognized or triggered.

Minimal YAML Example

name: First Pipeline

on:
push:
branches:
- main

jobs:
hello:
runs-on: ubuntu-latest
steps:
- name: Print hello message
run: echo "Hello GitCode Action"

Example Explanation:

FieldDescription
nameWorkflow name, displayed in the pipeline list
onTrigger event, here it is the push event on the main branch
jobsCollection of jobs
runs-onRunner tag, default uses the default resource pool
runExecute shell command

Commonly Used Variables in AtomGit Context:

VariableDescription
ATOMGIT_REFTriggered branch or tag reference (e.g., refs/heads/main)
ATOMGIT_SHASHA value of the triggered commit
ATOMGIT_REPOSITORYFull name of the repository (e.g., owner/repo)
ATOMGIT_EVENT_NAMEType of trigger event (e.g., push, pull_request)
ATOMGIT_WORKFLOWCurrent workflow name

Submit to Trigger

Submit the workflow file to the repository to trigger the pipeline:

git add .gitcode/workflows/first-pipeline.yml
git commit -m "Add first GitCode Action pipeline"
git push origin main

Verify Success Result

  1. Go to the AtomGit repository page and click on "Pipeline" or "Actions" tab
  2. Find the "First Pipeline" entry in the pipeline list
  3. Click to enter the details page and check the execution status
  4. Confirm that the Job status is ✅ (Success)