跳转到内容
Try Gitea Cloud ☁️ for 30 days → Accelerate your Development & Deploys!

Using gt in CI

Give gt a token and an instance through the environment, and turn prompts off:

Variable Description
GITEA_TOKEN Access token; gt never stores it
GITEA_CLI_HOST or GITEA_INSTANCE_URL URL of the instance
GITEA_CLI_REPO Repository, like --repo

--no-input makes a command fail instead of prompting, and --yes confirms changes in advance.

Gitea does not allow secret names that start with GITEA_, so store the token as, for example, GT_TOKEN:

on:
push:
branches: [main]
jobs:
staging:
runs-on: ubuntu-latest
env:
GITEA_TOKEN: ${{ secrets.GT_TOKEN }}
GITEA_CLI_HOST: ${{ gitea.server_url }}
GITEA_CLI_REPO: ${{ gitea.repository }}
steps:
- run: curl -fsSL https://gitea.com/gitea/cli/raw/branch/main/scripts/install.sh | sh
- run: gt workflow run deploy.yml --ref main --field env=staging --no-input

gt run watch and gt pr checks --watch wait for runs and checks and fail when one fails.