跳到主要内容

Manually Triggering a Pipeline

This document introduces how to manually trigger a workflow through the workflow_dispatch event on the AtomGit interface and pass input parameters.

When you need to actively execute a pipeline in non-automatic scenarios — for example, debugging a branch, verifying temporary parameters, or releasing a specific version — you can manually trigger it using the workflow_dispatch event.

Configuration Instructions

Define a workflow_dispatch workflow

Create or edit a workflow file in the .gitcode/workflows/ directory and add the workflow_dispatch trigger event:

# .gitcode/workflows/manual-deploy.yml
name: Manual Deploy

on:
workflow_dispatch:
inputs:
environment:
description: 'Deployment target environment'
required: true
default: 'staging'
type: string
version:
description: 'Deployment version number'
required: true
type: string
dry-run:
description: 'Simulate only, do not actually deploy'
required: false
type: string
default: "false"
tags:
description: 'Test tags (comma separated)'
required: false
type: string

stages:
validate:
name: Validation
jobs:
Check:
name: check-version
runs-on: [ubuntu-24, x64, small]
steps:
- name: Run deploy
run: echo "Deploy version ${{ inputs.version }} to ${{ inputs.environment }}"
- name: Run dry
run: echo "Dry run mode = ${{ inputs.dry-run }}"
deploy:
name: Deployment
jobs:
Deploy:
name: push-to-env
runs-on: [ubuntu-24, x64, medium]
steps:
- name: Run deploy
run: make deploy ENV=${{ inputs.environment }} VERSION=${{ inputs.version }}

Detailed Explanation of Inputs Field Types

The inputs of AtomGit Action supports string, enum, and increment types. All input values are strings.

typeDescriptionExample
stringText inputVersion number, image name, environment name
enumOption inputEnvironment name
incrementIncrementVersion number

Each input field property:

  • description: Description text for the input item, displayed in the trigger form
  • required: Whether it is required (true/false)
  • default: Default value
  • type: Input type, currently only string is supported

Trigger Operation

  1. Go to the Actions tab of the project.
  2. Select the target workflow name on the left.
  3. Click the Run workflow button on the right.
  4. A form pops up, select or enter each inputs parameter, and choose the target branch.
  5. Click Run to submit the trigger.

Note: Only workflows with workflow_dispatch in the on field will display the Run workflow button.

Referencing inputs within a workflow

steps:
- run: echo "Environment = ${{ inputs.environment }}"
- run: echo "Version = ${{ inputs.version }}"
- if: ${{ inputs.dry-run == 'true' }}
run: echo "This is a dry run"

The inputs context is only available in runs triggered by workflow_dispatch, referencing inputs in other triggering events will result in an error.

Frequently Asked Questions

Q: After clicking Run workflow, it prompts "This workflow does not support manual triggering"?

A: The on field of the workflow does not include the workflow_dispatch event. Please modify the .gitcode/workflows/{file}.yml file and add this trigger type.

Q: Can workflow_dispatch coexist with other triggering events?

A: Yes. The on field supports multiple events:

on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
inputs:
environment:
type: string

Q: How to specify a branch when triggering manually?

A: There is a branch selection dropdown in the trigger form. By default, it is set to the repository's default branch, but you can switch to any branch. The workflow will execute using the version of the .gitcode/workflows/ file on that branch.