Skip to content

Commit d135b05

Browse files
fix(ci): hoist secrets to job env in mirror-reusable; refresh example SHAs (#416)
## Task A — mirror-reusable.yml (two real bugs) **Bug 1 — duplicate `if:` key.** The "Mirror to GitLab" step had `if: ${{ secrets.GITLAB_SSH_KEY != '' }}` twice (with `continue-on-error: true` between). Removed the duplicate so the step has exactly one `if:`. **Bug 2 — `secrets` context in step `if:`.** The `secrets` context is **not** valid in step-level `if:` — it is an `Unrecognized named-value: 'secrets'` startup failure. Hoisted each forge secret to a job-level `env:` block and changed every step `if:` to gate on `env.<FORGE>_KEY`, matching the already-correct `mirror-radicle` job. Applied to all six forge jobs: gitlab, bitbucket, codeberg, sourcehut, disroot, gitea. Behaviour is identical; only the reference site moved. `actionlint` clean. ## Task B — refresh stale example SHAs The header copy-paste usage examples in `{elixir-ci,deno-ci,rust-ci,changelog}-reusable.yml` pinned `@861b5e9…` (stale, ~70 commits behind, beyond the staleness window). Refreshed to current `main` HEAD `4762ba66441de05bccb36e074ba3d2202219126a`. Comment-only. ## Validation - `actionlint` clean on all 5 files. - No `secrets.*` remains in any step `if:`. - Task B diff is comment-only. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 4762ba6 commit d135b05

5 files changed

Lines changed: 53 additions & 28 deletions

File tree

.github/workflows/changelog-reusable.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
# Caller example (auto-update CHANGELOG.md on every push to main):
1111
# jobs:
1212
# changelog:
13-
# uses: hyperpolymath/standards/.github/workflows/changelog-reusable.yml@861b5e911d9e5dcfb3c0ab3dd2a9a3c8fd0a1613
13+
# uses: hyperpolymath/standards/.github/workflows/changelog-reusable.yml@4762ba66441de05bccb36e074ba3d2202219126a
1414
# permissions:
1515
# contents: write
1616
# pull-requests: write

.github/workflows/deno-ci-reusable.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
#
2424
# jobs:
2525
# deno-ci:
26-
# uses: hyperpolymath/standards/.github/workflows/deno-ci-reusable.yml@861b5e911d9e5dcfb3c0ab3dd2a9a3c8fd0a1613
26+
# uses: hyperpolymath/standards/.github/workflows/deno-ci-reusable.yml@4762ba66441de05bccb36e074ba3d2202219126a
2727

2828
name: Deno CI (reusable)
2929

.github/workflows/elixir-ci-reusable.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,13 @@
3333
#
3434
# jobs:
3535
# elixir-ci:
36-
# uses: hyperpolymath/standards/.github/workflows/elixir-ci-reusable.yml@861b5e911d9e5dcfb3c0ab3dd2a9a3c8fd0a1613
36+
# uses: hyperpolymath/standards/.github/workflows/elixir-ci-reusable.yml@4762ba66441de05bccb36e074ba3d2202219126a
3737
#
3838
# With dialyzer + customised versions:
3939
#
4040
# jobs:
4141
# elixir-ci:
42-
# uses: hyperpolymath/standards/.github/workflows/elixir-ci-reusable.yml@861b5e911d9e5dcfb3c0ab3dd2a9a3c8fd0a1613
42+
# uses: hyperpolymath/standards/.github/workflows/elixir-ci-reusable.yml@4762ba66441de05bccb36e074ba3d2202219126a
4343
# with:
4444
# elixir-version: "1.18"
4545
# enable_dialyzer: true
@@ -49,7 +49,7 @@
4949
#
5050
# jobs:
5151
# elixir-ci:
52-
# uses: hyperpolymath/standards/.github/workflows/elixir-ci-reusable.yml@861b5e911d9e5dcfb3c0ab3dd2a9a3c8fd0a1613
52+
# uses: hyperpolymath/standards/.github/workflows/elixir-ci-reusable.yml@4762ba66441de05bccb36e074ba3d2202219126a
5353
# with:
5454
# working_directory: server
5555

.github/workflows/mirror-reusable.yml

Lines changed: 44 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -51,144 +51,169 @@ jobs:
5151
timeout-minutes: 20
5252
runs-on: ${{ inputs.runs-on }}
5353
if: vars.GITLAB_MIRROR_ENABLED == 'true'
54+
# Map the secret to env so step `if:`s can gate on its presence: the
55+
# `secrets` context is NOT available in `if:` (using it is an
56+
# "Unrecognized named-value: 'secrets'" startup failure). `env` IS
57+
# available in step `if:`, and secrets are valid in job-level `env`.
58+
env:
59+
GITLAB_KEY: ${{ secrets.GITLAB_SSH_KEY }}
5460
steps:
5561
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
5662
with:
5763
fetch-depth: 0
5864
- uses: webfactory/ssh-agent@e83874834305fe9a4a2997156cb26c5de65a8555 # v0.10.0
59-
if: ${{ secrets.GITLAB_SSH_KEY != '' }}
65+
if: ${{ env.GITLAB_KEY != '' }}
6066
with:
6167
ssh-private-key: ${{ secrets.GITLAB_SSH_KEY }}
6268
- name: Mirror to GitLab
63-
if: ${{ secrets.GITLAB_SSH_KEY != '' }}
6469
# continue-on-error: GitLab branch protection on the mirror repo may block
6570
# force-push even for a deploy key. Owner action required: in GitLab go to
6671
# Settings → Repository → Protected branches → main and either allow force-push
6772
# for Maintainers/Developers or remove the protection on the mirror repo.
6873
# Until then this step is advisory-only; failures do not red main.
6974
continue-on-error: true
70-
if: ${{ secrets.GITLAB_SSH_KEY != '' }}
75+
if: ${{ env.GITLAB_KEY != '' }}
7176
run: |
7277
ssh-keyscan -t ed25519 gitlab.com >> ~/.ssh/known_hosts
7378
git remote add gitlab git@gitlab.com:hyperpolymath/${{ github.event.repository.name }}.git || true
7479
git push --force gitlab main
7580
- name: Skipped (GITLAB_SSH_KEY not configured)
76-
if: ${{ secrets.GITLAB_SSH_KEY == '' }}
81+
if: ${{ env.GITLAB_KEY == '' }}
7782
run: |
7883
echo "::notice::GITLAB_MIRROR_ENABLED=true but secrets.GITLAB_SSH_KEY is empty. Skipping GitLab mirror. Configure the GITLAB_SSH_KEY org/repo secret to enable."
7984
8085
mirror-bitbucket:
8186
timeout-minutes: 20
8287
runs-on: ${{ inputs.runs-on }}
8388
if: vars.BITBUCKET_MIRROR_ENABLED == 'true'
89+
# See mirror-gitlab: the `secrets` context is not valid in step `if:`;
90+
# hoist to job-level `env` and gate steps on `env.BITBUCKET_KEY`.
91+
env:
92+
BITBUCKET_KEY: ${{ secrets.BITBUCKET_SSH_KEY }}
8493
steps:
8594
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
8695
with:
8796
fetch-depth: 0
8897
- uses: webfactory/ssh-agent@e83874834305fe9a4a2997156cb26c5de65a8555 # v0.10.0
89-
if: ${{ secrets.BITBUCKET_SSH_KEY != '' }}
98+
if: ${{ env.BITBUCKET_KEY != '' }}
9099
with:
91100
ssh-private-key: ${{ secrets.BITBUCKET_SSH_KEY }}
92101
- name: Mirror to Bitbucket
93-
if: ${{ secrets.BITBUCKET_SSH_KEY != '' }}
102+
if: ${{ env.BITBUCKET_KEY != '' }}
94103
run: |
95104
ssh-keyscan -t ed25519 bitbucket.org >> ~/.ssh/known_hosts
96105
git remote add bitbucket git@bitbucket.org:hyperpolymath/${{ github.event.repository.name }}.git || true
97106
git push --force bitbucket main
98107
- name: Skipped (BITBUCKET_SSH_KEY not configured)
99-
if: ${{ secrets.BITBUCKET_SSH_KEY == '' }}
108+
if: ${{ env.BITBUCKET_KEY == '' }}
100109
run: |
101110
echo "::notice::BITBUCKET_MIRROR_ENABLED=true but secrets.BITBUCKET_SSH_KEY is empty. Skipping Bitbucket mirror. Configure the BITBUCKET_SSH_KEY org/repo secret to enable."
102111
103112
mirror-codeberg:
104113
timeout-minutes: 20
105114
runs-on: ${{ inputs.runs-on }}
106115
if: vars.CODEBERG_MIRROR_ENABLED == 'true'
116+
# See mirror-gitlab: the `secrets` context is not valid in step `if:`;
117+
# hoist to job-level `env` and gate steps on `env.CODEBERG_KEY`.
118+
env:
119+
CODEBERG_KEY: ${{ secrets.CODEBERG_SSH_KEY }}
107120
steps:
108121
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
109122
with:
110123
fetch-depth: 0
111124
- uses: webfactory/ssh-agent@e83874834305fe9a4a2997156cb26c5de65a8555 # v0.10.0
112-
if: ${{ secrets.CODEBERG_SSH_KEY != '' }}
125+
if: ${{ env.CODEBERG_KEY != '' }}
113126
with:
114127
ssh-private-key: ${{ secrets.CODEBERG_SSH_KEY }}
115128
- name: Mirror to Codeberg
116-
if: ${{ secrets.CODEBERG_SSH_KEY != '' }}
129+
if: ${{ env.CODEBERG_KEY != '' }}
117130
run: |
118131
ssh-keyscan -t ed25519 codeberg.org >> ~/.ssh/known_hosts
119132
git remote add codeberg git@codeberg.org:hyperpolymath/${{ github.event.repository.name }}.git || true
120133
git push --force codeberg main
121134
- name: Skipped (CODEBERG_SSH_KEY not configured)
122-
if: ${{ secrets.CODEBERG_SSH_KEY == '' }}
135+
if: ${{ env.CODEBERG_KEY == '' }}
123136
run: |
124137
echo "::notice::CODEBERG_MIRROR_ENABLED=true but secrets.CODEBERG_SSH_KEY is empty. Skipping Codeberg mirror. Configure the CODEBERG_SSH_KEY org/repo secret to enable."
125138
126139
mirror-sourcehut:
127140
timeout-minutes: 20
128141
runs-on: ${{ inputs.runs-on }}
129142
if: vars.SOURCEHUT_MIRROR_ENABLED == 'true'
143+
# See mirror-gitlab: the `secrets` context is not valid in step `if:`;
144+
# hoist to job-level `env` and gate steps on `env.SOURCEHUT_KEY`.
145+
env:
146+
SOURCEHUT_KEY: ${{ secrets.SOURCEHUT_SSH_KEY }}
130147
steps:
131148
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
132149
with:
133150
fetch-depth: 0
134151
- uses: webfactory/ssh-agent@e83874834305fe9a4a2997156cb26c5de65a8555 # v0.10.0
135-
if: ${{ secrets.SOURCEHUT_SSH_KEY != '' }}
152+
if: ${{ env.SOURCEHUT_KEY != '' }}
136153
with:
137154
ssh-private-key: ${{ secrets.SOURCEHUT_SSH_KEY }}
138155
- name: Mirror to SourceHut
139-
if: ${{ secrets.SOURCEHUT_SSH_KEY != '' }}
156+
if: ${{ env.SOURCEHUT_KEY != '' }}
140157
run: |
141158
ssh-keyscan -t ed25519 git.sr.ht >> ~/.ssh/known_hosts
142159
git remote add sourcehut git@git.sr.ht:~hyperpolymath/${{ github.event.repository.name }} || true
143160
git push --force sourcehut main
144161
- name: Skipped (SOURCEHUT_SSH_KEY not configured)
145-
if: ${{ secrets.SOURCEHUT_SSH_KEY == '' }}
162+
if: ${{ env.SOURCEHUT_KEY == '' }}
146163
run: |
147164
echo "::notice::SOURCEHUT_MIRROR_ENABLED=true but secrets.SOURCEHUT_SSH_KEY is empty. Skipping SourceHut mirror. Configure the SOURCEHUT_SSH_KEY org/repo secret to enable."
148165
149166
mirror-disroot:
150167
timeout-minutes: 20
151168
runs-on: ${{ inputs.runs-on }}
152169
if: vars.DISROOT_MIRROR_ENABLED == 'true'
170+
# See mirror-gitlab: the `secrets` context is not valid in step `if:`;
171+
# hoist to job-level `env` and gate steps on `env.DISROOT_KEY`.
172+
env:
173+
DISROOT_KEY: ${{ secrets.DISROOT_SSH_KEY }}
153174
steps:
154175
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
155176
with:
156177
fetch-depth: 0
157178
- uses: webfactory/ssh-agent@e83874834305fe9a4a2997156cb26c5de65a8555 # v0.10.0
158-
if: ${{ secrets.DISROOT_SSH_KEY != '' }}
179+
if: ${{ env.DISROOT_KEY != '' }}
159180
with:
160181
ssh-private-key: ${{ secrets.DISROOT_SSH_KEY }}
161182
- name: Mirror to Disroot
162-
if: ${{ secrets.DISROOT_SSH_KEY != '' }}
183+
if: ${{ env.DISROOT_KEY != '' }}
163184
run: |
164185
ssh-keyscan -t ed25519 git.disroot.org >> ~/.ssh/known_hosts
165186
git remote add disroot git@git.disroot.org:hyperpolymath/${{ github.event.repository.name }}.git || true
166187
git push --force disroot main
167188
- name: Skipped (DISROOT_SSH_KEY not configured)
168-
if: ${{ secrets.DISROOT_SSH_KEY == '' }}
189+
if: ${{ env.DISROOT_KEY == '' }}
169190
run: |
170191
echo "::notice::DISROOT_MIRROR_ENABLED=true but secrets.DISROOT_SSH_KEY is empty. Skipping Disroot mirror. Configure the DISROOT_SSH_KEY org/repo secret to enable."
171192
172193
mirror-gitea:
173194
timeout-minutes: 20
174195
runs-on: ${{ inputs.runs-on }}
175196
if: vars.GITEA_MIRROR_ENABLED == 'true'
197+
# See mirror-gitlab: the `secrets` context is not valid in step `if:`;
198+
# hoist to job-level `env` and gate steps on `env.GITEA_KEY`.
199+
env:
200+
GITEA_KEY: ${{ secrets.GITEA_SSH_KEY }}
176201
steps:
177202
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
178203
with:
179204
fetch-depth: 0
180205
- uses: webfactory/ssh-agent@e83874834305fe9a4a2997156cb26c5de65a8555 # v0.10.0
181-
if: ${{ secrets.GITEA_SSH_KEY != '' }}
206+
if: ${{ env.GITEA_KEY != '' }}
182207
with:
183208
ssh-private-key: ${{ secrets.GITEA_SSH_KEY }}
184209
- name: Mirror to Gitea
185-
if: ${{ secrets.GITEA_SSH_KEY != '' }}
210+
if: ${{ env.GITEA_KEY != '' }}
186211
run: |
187212
ssh-keyscan -t ed25519 ${{ vars.GITEA_HOST }} >> ~/.ssh/known_hosts
188213
git remote add gitea git@${{ vars.GITEA_HOST }}:hyperpolymath/${{ github.event.repository.name }}.git || true
189214
git push --force gitea main
190215
- name: Skipped (GITEA_SSH_KEY not configured)
191-
if: ${{ secrets.GITEA_SSH_KEY == '' }}
216+
if: ${{ env.GITEA_KEY == '' }}
192217
run: |
193218
echo "::notice::GITEA_MIRROR_ENABLED=true but secrets.GITEA_SSH_KEY is empty. Skipping Gitea mirror. Configure the GITEA_SSH_KEY org/repo secret to enable."
194219

.github/workflows/rust-ci-reusable.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@
1919
#
2020
# jobs:
2121
# rust-ci:
22-
# uses: hyperpolymath/standards/.github/workflows/rust-ci-reusable.yml@861b5e911d9e5dcfb3c0ab3dd2a9a3c8fd0a1613
22+
# uses: hyperpolymath/standards/.github/workflows/rust-ci-reusable.yml@4762ba66441de05bccb36e074ba3d2202219126a
2323
#
2424
# With audit + coverage enabled:
2525
#
2626
# jobs:
2727
# rust-ci:
28-
# uses: hyperpolymath/standards/.github/workflows/rust-ci-reusable.yml@861b5e911d9e5dcfb3c0ab3dd2a9a3c8fd0a1613
28+
# uses: hyperpolymath/standards/.github/workflows/rust-ci-reusable.yml@4762ba66441de05bccb36e074ba3d2202219126a
2929
# with:
3030
# enable_audit: true
3131
# enable_coverage: true
@@ -34,11 +34,11 @@
3434
#
3535
# jobs:
3636
# rust-ci-cli:
37-
# uses: hyperpolymath/standards/.github/workflows/rust-ci-reusable.yml@861b5e911d9e5dcfb3c0ab3dd2a9a3c8fd0a1613
37+
# uses: hyperpolymath/standards/.github/workflows/rust-ci-reusable.yml@4762ba66441de05bccb36e074ba3d2202219126a
3838
# with:
3939
# working_directory: crates/cli
4040
# rust-ci-server:
41-
# uses: hyperpolymath/standards/.github/workflows/rust-ci-reusable.yml@861b5e911d9e5dcfb3c0ab3dd2a9a3c8fd0a1613
41+
# uses: hyperpolymath/standards/.github/workflows/rust-ci-reusable.yml@4762ba66441de05bccb36e074ba3d2202219126a
4242
# with:
4343
# working_directory: crates/server
4444
#

0 commit comments

Comments
 (0)