diff --git a/.gitea/workflows/012_pat.yaml b/.gitea/workflows/012_pat.yaml index fe77631..815e507 100644 --- a/.gitea/workflows/012_pat.yaml +++ b/.gitea/workflows/012_pat.yaml @@ -26,10 +26,14 @@ jobs: - name: Ensure local 'main' tracks origin/main (for Gitea runners) run: | - git fetch origin main --tags - # Force-create/update local main to point at remote - git branch -f main origin/main - git checkout main + # make sure we have everything + git fetch origin main --tags --prune + # be on main (no-op if already there) + git checkout main || git switch main + # hard update the working tree to match origin/main + git reset --hard origin/main + # ensure upstream is set (harmless if already set) + git branch --set-upstream-to=origin/main main git config user.name "hangpersonal" git config user.email "hangcui1201@gmail.com"