Skip to content
This repository was archived by the owner on Sep 30, 2026. It is now read-only.

ci: skip ssh-agent step when DEPLOY_KEY secret is absent - #15

Closed
yjuyjuy wants to merge 1 commit into
masterfrom
fm/jcode-fork-ci-ssh-step-conditional
Closed

yjuyjuy wants to merge 1 commit into
masterfrom
fm/jcode-fork-ci-ssh-step-conditional

Conversation

@yjuyjuy

@yjuyjuy yjuyjuy commented Aug 13, 2026

Copy link
Copy Markdown
Owner

On forks GitHub does not copy repo secrets, so secrets.DEPLOY_KEY is empty and every webfactory/[email protected] step hard-fails in seconds with ssh-private-key argument is empty, dying before any real build.

Change

Add if: ${{ secrets.DEPLOY_KEY != '' }} to every "Configure SSH for cargo git dependencies" step so it is skipped when the secret is absent (forks) and still runs when present (upstream). Covers all 5 occurrences: ci.yml x4 (jobs at lines ~29/179/418/672) and release.yml x1 (line ~94).

The actions/checkout ssh-key: inputs are left as-is; an empty ssh-key is harmless (checkout falls back to the token).

Cargo git deps

Both git dependencies resolve over https to public repos, so they fetch without the SSH rewrite:

  • agentgrep = { git = "https://github.com/1jehuang/agentgrep.git", tag = "v0.1.6" }
  • mermaid-rs-renderer = { git = "https://github.com/1jehuang/mermaid-rs-renderer.git", tag = "v0.3.1" }

No insteadOf ssh rewrite exists in the repo, confirming nothing depends on the SSH agent to fetch.

Result

Fork CI/release jobs no longer hard-fail on empty DEPLOY_KEY; real build/test jobs run to a genuine result. Upstream (secret present) is unaffected.

On forks, GitHub does not copy repo secrets, so secrets.DEPLOY_KEY is empty
and the webfactory/ssh-agent step hard-fails with 'ssh-private-key argument
is empty'. Guard every occurrence with if: DEPLOY_KEY != '' so the step is
skipped on forks and still runs upstream. The two cargo git deps (agentgrep,
mermaid-rs-renderer) are public 1jehuang repos referenced over https, so they
resolve without the SSH rewrite.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant