Skip to content

Commit c56e237

Browse files
committed
ci: make CI fork-friendly when DEPLOY_KEY secret is absent
The fork's CI has never run (`gh api repos/quangdang46/jcode/actions/runs` returns total_count=0 for both pull_request and push events) because upstream's workflows assume a `DEPLOY_KEY` SSH secret that the fork does not have. Two changes: 1. Gate every `webfactory/ssh-agent@v0.9.0` step on `if: ${{ secrets.DEPLOY_KEY != '' }}` so the SSH agent setup is simply skipped when the secret is absent. This is safe here because none of this fork's Cargo git dependencies use SSH URLs: - `agentgrep` -> https://github.com/1jehuang/agentgrep.git - `mermaid-rs-renderer` -> https://github.com/1jehuang/mermaid-rs-renderer.git So the `actions/checkout@v4` step's empty `ssh-key` falls back to the GITHUB_TOKEN HTTPS path automatically. Applies to 5 jobs in ci.yml + 1 step in release.yml. 2. Add `workflow_dispatch:` to ci.yml so maintainers can trigger CI manually from the Actions tab while debugging without having to force-push a no-op commit. Note for the fork owner: GitHub disables Actions on a freshly-forked repo until you visit the Actions tab once and click 'I understand my workflows, go ahead and enable them'. After this PR is merged AND the fork's Actions are enabled, future PRs will automatically run CI. Refs the absence of CI runs blocking PRs quangdang46#174-quangdang46#195.
1 parent c3f63b3 commit c56e237

2 files changed

Lines changed: 7 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ on:
55
branches: [main, master]
66
pull_request:
77
branches: [main, master]
8+
workflow_dispatch:
89

910
concurrency:
1011
group: ci-${{ github.workflow }}-${{ github.ref }}
@@ -26,6 +27,7 @@ jobs:
2627
submodules: recursive
2728

2829
- name: Configure SSH for cargo git dependencies
30+
if: ${{ secrets.DEPLOY_KEY != '' }}
2931
uses: webfactory/ssh-agent@v0.9.0
3032
with:
3133
ssh-private-key: ${{ secrets.DEPLOY_KEY }}
@@ -79,6 +81,7 @@ jobs:
7981
submodules: recursive
8082

8183
- name: Configure SSH for cargo git dependencies
84+
if: ${{ secrets.DEPLOY_KEY != '' }}
8285
uses: webfactory/ssh-agent@v0.9.0
8386
with:
8487
ssh-private-key: ${{ secrets.DEPLOY_KEY }}
@@ -120,6 +123,7 @@ jobs:
120123
submodules: recursive
121124

122125
- name: Configure SSH for cargo git dependencies
126+
if: ${{ secrets.DEPLOY_KEY != '' }}
123127
uses: webfactory/ssh-agent@v0.9.0
124128
with:
125129
ssh-private-key: ${{ secrets.DEPLOY_KEY }}
@@ -209,6 +213,7 @@ jobs:
209213
submodules: recursive
210214

211215
- name: Configure SSH for cargo git dependencies
216+
if: ${{ secrets.DEPLOY_KEY != '' }}
212217
uses: webfactory/ssh-agent@v0.9.0
213218
with:
214219
ssh-private-key: ${{ secrets.DEPLOY_KEY }}
@@ -380,6 +385,7 @@ jobs:
380385
submodules: recursive
381386

382387
- name: Configure SSH for cargo git dependencies
388+
if: ${{ secrets.DEPLOY_KEY != '' }}
383389
uses: webfactory/ssh-agent@v0.9.0
384390
with:
385391
ssh-private-key: ${{ secrets.DEPLOY_KEY }}

.github/workflows/release.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ jobs:
5151
fetch-depth: 0
5252

5353
- name: Configure SSH for cargo git dependencies
54+
if: ${{ secrets.DEPLOY_KEY != '' }}
5455
uses: webfactory/ssh-agent@v0.9.0
5556
with:
5657
ssh-private-key: ${{ secrets.DEPLOY_KEY }}

0 commit comments

Comments
 (0)