Skip to content

Commit 143601b

Browse files
committed
Update GitHub Actions
1 parent c48e734 commit 143601b

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

.github/workflows/tests.yml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,16 @@ jobs:
6161
git remote set-url origin https://x-access-token:${{ github.token }}@github.com/${{ github.repository }}.wiki.git
6262
6363
git fetch origin
64-
git checkout -b temp-branch origin/${{ github.head_ref || github.ref_name }}
65-
git pull origin ${{ github.head_ref || github.ref_name }} --rebase
64+
BRANCH_NAME="${{ github.head_ref || github.ref_name }}"
65+
66+
if [ "$BRANCH_NAME" = "main" ]; then
67+
if ! git ls-remote --exit-code --heads origin main > /dev/null; then
68+
BRANCH_NAME="master"
69+
fi
70+
fi
71+
72+
git checkout -b temp-branch origin/$BRANCH_NAME
73+
git pull origin $BRANCH_NAME --rebase
6674
6775
git add .
6876
if git diff --cached --quiet; then
@@ -71,7 +79,7 @@ jobs:
7179
fi
7280
7381
git commit -m "Update wiki content"
74-
git push origin HEAD:refs/heads/${{ github.head_ref || github.ref_name }}
82+
git push origin HEAD:refs/heads/$BRANCH_NAME
7583
7684
cd ../..
7785

0 commit comments

Comments
 (0)