瀏覽代碼

fix(workflows): improve wiki branch detection for new wikis

- Add fallback to current branch if symbolic ref doesn't exist
- Prevents 'invalid refspec' error on newly created wikis
xcad 4 月之前
父節點
當前提交
86580e6fc6
共有 1 個文件被更改,包括 2 次插入1 次删除
  1. 2 1
      .github/workflows/docs-update-wiki.yaml

+ 2 - 1
.github/workflows/docs-update-wiki.yaml

@@ -37,7 +37,8 @@ jobs:
         id: wiki_branch
         run: |
           cd wiki
-          BRANCH=$(git symbolic-ref refs/remotes/origin/HEAD | sed 's@^refs/remotes/origin/@@')
+          # Try to get default branch from symbolic ref, fallback to current branch
+          BRANCH=$(git symbolic-ref refs/remotes/origin/HEAD 2>/dev/null | sed 's@^refs/remotes/origin/@@' || git rev-parse --abbrev-ref HEAD)
           echo "branch=$BRANCH" >> $GITHUB_OUTPUT
           echo "Wiki default branch: $BRANCH"