chore: improve Git setup and remote verification in sync_to_enterprise.yml for better reliability
This commit is contained in:
1 parent
13e33777bd
commit
9680da7762
1 file changed
+18
-12
@@ -15,24 +15,30 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Configure Git
|
- name: Set up Git
|
||||||
run: |
|
run: |
|
||||||
git config --global user.name "github-actions[bot]"
|
git config --global user.name "github-actions[bot]"
|
||||||
git config --global user.email "github-actions[bot]@users.noreply.github.com"
|
git config --global user.email "github-actions[bot]@users.noreply.github.com"
|
||||||
|
|
||||||
- name: Add enterprise remote
|
- name: Add enterprise remote
|
||||||
run: |
|
run: |
|
||||||
echo "Token loaded: ${{ secrets.ENTERPRISE_REPO_TOKEN != '' }}"
|
echo "Adding enterprise remote..."
|
||||||
TOKEN="${{ secrets.ENTERPRISE_REPO_TOKEN }}"
|
TOKEN="${{ secrets.ENTERPRISE_REPO_TOKEN }}"
|
||||||
echo "Token first 4 chars: ${TOKEN:0:4}"
|
echo "Token prefix: ${TOKEN:0:10}"
|
||||||
git remote add enterprise https://x-access-token:${{ secrets.ENTERPRISE_REPO_TOKEN }}@github.com/cedar-v/license-manager-enterprise.git
|
git remote add enterprise https://x-access-token:$TOKEN@github.com/cedar-v/license-manager-enterprise.git
|
||||||
|
echo "Remote added successfully"
|
||||||
|
|
||||||
- name: Test remote connection
|
- name: Verify remote and push
|
||||||
|
env:
|
||||||
|
TOKEN: "${{ secrets.ENTERPRISE_REPO_TOKEN }}"
|
||||||
run: |
|
run: |
|
||||||
echo "=== Testing remote connection ==="
|
echo "Verifying remote exists..."
|
||||||
git ls-remote enterprise
|
# 先测试是否能访问
|
||||||
echo "=== Test complete ==="
|
if git ls-remote enterprise 2>&1; then
|
||||||
|
echo "Remote accessible, pushing..."
|
||||||
- name: Push to enterprise license-manager branch
|
git push enterprise main:license-manager --force
|
||||||
run: |
|
echo "Push completed successfully!"
|
||||||
git push enterprise main:license-manager --force
|
else
|
||||||
|
echo "Failed to access remote"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
Reference in new issue
Block a user