Skip to content

Commit f894fa3

Browse files
vorporealoz-agent
andauthored
Add ssh_key secret parameter to support sync setup_command. (#22)
## Description The `setup_command` workflow parameter (added in #16) allows consuming repos to run commands like `cargo fetch` before sync begins. However, if the source repo has private dependencies that require SSH credentials (e.g. private crates), there's no way to provide them — the reusable workflow runs in a separate job, so the embedding workflow can't set up the SSH agent beforehand. This adds an optional `ssh_key` secret to the sync workflow. When provided, it populates the SSH agent (via `webfactory/ssh-agent`) before the setup command runs, allowing commands like `cargo fetch` to access private repositories. ## Testing Verified the workflow YAML is syntactically valid. The new step is conditional on `secrets.ssh_key != ''`, so existing consumers that don't pass the secret are unaffected. Co-Authored-By: Oz <[email protected]>
1 parent bcabfb7 commit f894fa3

2 files changed

Lines changed: 11 additions & 0 deletions

File tree

.github/workflows/sync.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ on:
5656
warp_api_key:
5757
description: "Warp API key."
5858
required: true
59+
ssh_key:
60+
description: "Optional SSH private key for accessing private dependencies (e.g. private crates) during the setup command."
61+
required: false
5962

6063
concurrency:
6164
group: repo-sync-${{ github.repository == inputs.private_repo && 'private-to-public' || 'public-to-private' }}-${{ github.repository }}-${{ github.repository == inputs.private_repo && inputs.public_repo || inputs.private_repo }}
@@ -117,6 +120,12 @@ jobs:
117120
- name: Build conflict resolution agent image
118121
run: docker build -f .repo-sync/docker/conflict-resolution/Dockerfile -t repo-sync-conflict-resolution .repo-sync
119122

123+
- name: Setup SSH keys
124+
if: secrets.ssh_key != ''
125+
uses: webfactory/[email protected]
126+
with:
127+
ssh-private-key: ${{ secrets.ssh_key }}
128+
120129
- name: Run setup command
121130
if: inputs.setup_command != ''
122131
run: ${{ inputs.setup_command }}

examples/consuming-repo-sync.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ jobs:
6060
# public_to_private_fixup_script: scripts/post-cherry-pick-fixup.sh
6161
secrets:
6262
app_private_key: ${{ secrets.REPO_SYNC_APP_PRIVATE_KEY }}
63+
# Optional SSH key for fetching private dependencies during setup.
64+
# ssh_key: ${{ secrets.REPO_SYNC_SSH_KEY }}
6365

6466
# -----------------------------------------------------------------------
6567
# Restack: triggered when a sync PR is merged.

0 commit comments

Comments
 (0)