From f2c11a2a5bc6ed27ea139536fe506dee0662ca96 Mon Sep 17 00:00:00 2001 From: pooneyy <85266337+pooneyy@users.noreply.github.com> Date: Sun, 1 Mar 2026 22:18:46 +0800 Subject: [PATCH] ci(sync): add SSH port configuration support - rename sync job to ssh-sync for clarity - add SSH_PORT variable support for ssh-keyscan command - implement conditional logic for SSH port configuration - update known_hosts setting to support non-standard SSH ports --- .github/workflows/sync.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/sync.yml b/.github/workflows/sync.yml index ded15f95c..c06b5fafd 100644 --- a/.github/workflows/sync.yml +++ b/.github/workflows/sync.yml @@ -16,7 +16,7 @@ permissions: contents: read jobs: - sync: + ssh-sync: name: 同步到 ${{ matrix.remote.name }} runs-on: ubuntu-latest strategy: @@ -51,7 +51,13 @@ jobs: - name: 添加目标主机的公钥 run: | mkdir -p ~/.ssh - ssh-keyscan ${{ matrix.remote.ssh-host }} >> ~/.ssh/known_hosts + SSH_HOST=${{ matrix.remote.ssh-host }} + SSH_PORT=${{ matrix.remote.ssh-port }} + if [ -n "$SSH_PORT" ]; then + ssh-keyscan -p $SSH_PORT $SSH_HOST >> ~/.ssh/known_hosts + else + ssh-keyscan $SSH_HOST >> ~/.ssh/known_hosts + fi - name: 配置本地仓库 run: |