@@ -51,18 +51,38 @@ jobs:
51
51
git commit -m "Clean posts directory and remove workflows for theme sync"
52
52
fi
53
53
54
- - name : Add target repository as remote
55
- run : |
56
- git remote add theme-repo https://github.com/fishcpy/astro-theme-fishcpy.git
57
-
58
- - name : Push to target repository
54
+ - name : Check if target repository exists and push
59
55
env :
60
- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
56
+ PAT_TOKEN : ${{ secrets.PAT_TOKEN }}
61
57
run : |
62
- # 使用token进行认证推送
63
- git remote set-url theme-repo https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/fishcpy/astro-theme-fishcpy.git
58
+ # 检查是否设置了PAT_TOKEN
59
+ if [ -z "$PAT_TOKEN" ]; then
60
+ echo "❌ PAT_TOKEN secret not found!"
61
+ echo "Please create a Personal Access Token and add it as PAT_TOKEN secret"
62
+ echo "Token needs 'repo' permissions to push to the target repository"
63
+ exit 1
64
+ fi
65
+
66
+ # 设置目标仓库URL
67
+ TARGET_REPO="https://github.com/fishcpy/astro-theme-fishcpy.git"
68
+
69
+ # 检查目标仓库是否存在
70
+ echo "🔍 Checking if target repository exists..."
71
+ if curl -s -H "Authorization: token $PAT_TOKEN" \
72
+ "https://api.github.com/repos/fishcpy/astro-theme-fishcpy" | grep -q '"name"'; then
73
+ echo "✅ Target repository exists"
74
+ else
75
+ echo "❌ Target repository does not exist!"
76
+ echo "Please create the repository: https://github.com/fishcpy/astro-theme-fishcpy"
77
+ echo "Or check if the repository name is correct"
78
+ exit 1
79
+ fi
80
+
81
+ # 添加远程仓库
82
+ git remote add theme-repo https://x-access-token:$PAT_TOKEN@github.com/fishcpy/astro-theme-fishcpy.git
64
83
65
- # 推送到目标仓库的main分支
84
+ # 推送到目标仓库
85
+ echo "🚀 Pushing to target repository..."
66
86
git push theme-repo main --force-with-lease
67
87
68
88
- name : Summary
71
91
echo "🗑️ Cleaned posts directory (kept only markdown.md)"
72
92
echo "🗑️ Removed all workflow files (.github directory)"
73
93
echo "📝 Updated banner.enable to true"
74
- echo "🔄 Pushed with commit history to https://github.com/fishcpy/astro-theme-fishcpy.git"
94
+ echo "🔄 Pushed with commit history to https://github.com/fishcpy/astro-theme-fishcpy.git"
95
+ echo ""
96
+ echo "📋 Setup Instructions (if this was your first run):"
97
+ echo "1. Create Personal Access Token: https://github.com/settings/tokens"
98
+ echo "2. Add token as PAT_TOKEN secret in repository settings"
99
+ echo "3. Ensure target repository exists: https://github.com/fishcpy/astro-theme-fishcpy"
0 commit comments