Merge pull request '修改初始配置文件 适配gitea[AC-INIT]' (#10) from setup-gate into main

Reviewed-on: MerCry/ai-robot#10
This commit is contained in:
MerCry 2026-02-24 02:51:08 +00:00
commit 9e24731400
2 changed files with 16 additions and 9 deletions

View File

@ -22,18 +22,25 @@ jobs:
REPO_NAME="${GITHUB_REPOSITORY:-${GITEA_REPOSITORY:-}}"
COMMIT_SHA="${GITHUB_SHA:-${GITEA_SHA:-}}"
# Try to get URL from git remote if env vars are missing
if [ -z "$SERVER_URL" ] || [ -z "$REPO_NAME" ]; then
echo "Warning: Env vars missing, attempting to detect from remote..."
fi
: "${SERVER_URL:?Could not determine SERVER_URL}"
: "${REPO_NAME:?Could not determine REPO_NAME}"
: "${COMMIT_SHA:?Could not determine COMMIT_SHA}"
echo "Using SERVER_URL=$SERVER_URL"
echo "Using REPO_NAME=$REPO_NAME"
echo "Using COMMIT_SHA=$COMMIT_SHA"
if [ -d ".git" ]; then
echo "Repo already initialized in workspace; using fetch"
git remote set-url origin "$SERVER_URL/$REPO_NAME.git"
else
git clone "$SERVER_URL/$REPO_NAME.git" .
git fetch origin main:main
git checkout "$COMMIT_SHA"
fi
# 关键:不要把 main fetch 到本地分支 main会冲突
git fetch origin main:refs/remotes/origin/main
git fetch --depth=1 origin "$COMMIT_SHA"
git checkout -f "$COMMIT_SHA"
- name: 1. OpenAPI Contract Level Check
env:

View File

@ -7,7 +7,7 @@ set -eu
# 3. Fail if breaking changes are found without explicit developer acknowledgement.
# Base branch to compare against
BASE_BRANCH="main"
BASE_BRANCH="refs/remotes/origin/main"
die() {
echo "ERROR: $*" >&2