修改初始配置文件 适配gitea[AC-INIT]
PR Check (SDD Full Gate) / sdd-full-gate (pull_request) Successful in 3s
Details
PR Check (SDD Full Gate) / sdd-full-gate (pull_request) Successful in 3s
Details
This commit is contained in:
parent
5133d574a4
commit
d929f952cf
|
|
@ -22,18 +22,25 @@ jobs:
|
||||||
REPO_NAME="${GITHUB_REPOSITORY:-${GITEA_REPOSITORY:-}}"
|
REPO_NAME="${GITHUB_REPOSITORY:-${GITEA_REPOSITORY:-}}"
|
||||||
COMMIT_SHA="${GITHUB_SHA:-${GITEA_SHA:-}}"
|
COMMIT_SHA="${GITHUB_SHA:-${GITEA_SHA:-}}"
|
||||||
|
|
||||||
# Try to get URL from git remote if env vars are missing
|
: "${SERVER_URL:?Could not determine SERVER_URL}"
|
||||||
if [ -z "$SERVER_URL" ] || [ -z "$REPO_NAME" ]; then
|
: "${REPO_NAME:?Could not determine REPO_NAME}"
|
||||||
echo "Warning: Env vars missing, attempting to detect from remote..."
|
: "${COMMIT_SHA:?Could not determine COMMIT_SHA}"
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Using SERVER_URL=$SERVER_URL"
|
echo "Using SERVER_URL=$SERVER_URL"
|
||||||
echo "Using REPO_NAME=$REPO_NAME"
|
echo "Using REPO_NAME=$REPO_NAME"
|
||||||
echo "Using COMMIT_SHA=$COMMIT_SHA"
|
echo "Using COMMIT_SHA=$COMMIT_SHA"
|
||||||
|
|
||||||
git clone "$SERVER_URL/$REPO_NAME.git" .
|
if [ -d ".git" ]; then
|
||||||
git fetch origin main:main
|
echo "Repo already initialized in workspace; using fetch"
|
||||||
git checkout "$COMMIT_SHA"
|
git remote set-url origin "$SERVER_URL/$REPO_NAME.git"
|
||||||
|
else
|
||||||
|
git clone "$SERVER_URL/$REPO_NAME.git" .
|
||||||
|
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
|
- name: 1. OpenAPI Contract Level Check
|
||||||
env:
|
env:
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ set -eu
|
||||||
# 3. Fail if breaking changes are found without explicit developer acknowledgement.
|
# 3. Fail if breaking changes are found without explicit developer acknowledgement.
|
||||||
|
|
||||||
# Base branch to compare against
|
# Base branch to compare against
|
||||||
BASE_BRANCH="main"
|
BASE_BRANCH="refs/remotes/origin/main"
|
||||||
|
|
||||||
die() {
|
die() {
|
||||||
echo "ERROR: $*" >&2
|
echo "ERROR: $*" >&2
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue