Compare commits

..

No commits in common. "9e247314002499ef9a9da30a47f35f35452ff55d" and "6ad817f1906486f584b07c5097982ec0fc334eff" have entirely different histories.

2 changed files with 9 additions and 16 deletions

View File

@ -22,25 +22,18 @@ 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:-}}"
: "${SERVER_URL:?Could not determine SERVER_URL}" # Try to get URL from git remote if env vars are missing
: "${REPO_NAME:?Could not determine REPO_NAME}" if [ -z "$SERVER_URL" ] || [ -z "$REPO_NAME" ]; then
: "${COMMIT_SHA:?Could not determine COMMIT_SHA}" echo "Warning: Env vars missing, attempting to detect from remote..."
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"
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 clone "$SERVER_URL/$REPO_NAME.git" .
fi git fetch origin main:main
git checkout "$COMMIT_SHA"
# 关键:不要把 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:

View File

@ -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="refs/remotes/origin/main" BASE_BRANCH="main"
die() { die() {
echo "ERROR: $*" >&2 echo "ERROR: $*" >&2