feat: add gitdan-crates-access, a deploy-key action for the private crates repo
CI / shellcheck + selftests (pull_request) Successful in 1m18s
CI / move v1 to main (pull_request) Skipped

The job token cannot read daniel/gitdan-crates, so CI authenticates with a
read-only deploy key. The action writes it 0600 outside the workspace, pins
the forge's host key (RSA, the only type offered, confirmed against the
trusted known_hosts record and a fresh keyscan), exports GIT_SSH_COMMAND,
proves access with ls-remote, and fails on a Cargo.lock with two commits of
the crates repo. The selftest is wired into selftest.sh.

Existing actions and scripts are untouched.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MfBCVNDv3y5gm2djeZSAk4
This commit is contained in:
2026-11-19 10:26:36 -06:00
co-authored by Claude Fable 5.2
parent 2cada26957
commit ea5b60ae94
7 changed files with 386 additions and 2 deletions
+43
View File
@@ -0,0 +1,43 @@
name: 'gitdan-crates access'
description: >-
Gives the job read access to the private daniel/gitdan-crates repo over SSH
with a read-only deploy key: pins the forge's host key, exports
GIT_SSH_COMMAND so every later git (and Cargo, with
net.git-fetch-with-cli) authenticates, proves access with git ls-remote, and
checks that Cargo.lock holds one commit of the crates.
author: 'gitdan'
inputs:
deploy-key:
description: >-
Private half of the read-only deploy key: pass
${{ secrets.GITDAN_CRATES_DEPLOY_KEY }}. Never echoed, never in argv.
required: true
lockfile:
description: >-
Path to the Cargo.lock to check, relative to the workspace. Fails when it
lists more than one commit of the gitdan-crates source; no entry passes.
A missing file fails; set to an empty string to skip the check.
required: false
default: 'Cargo.lock'
runs:
using: 'composite'
steps:
# The key reaches the script through the environment, never as an argument
# or interpolated into the script text, so it cannot show up in argv or in
# the step's echoed command.
- shell: bash
env:
DEPLOY_KEY: ${{ inputs.deploy-key }}
run: |
set -euo pipefail
bash "$(cd "${{ github.action_path }}/.." && pwd)/scripts/crates-access.sh"
- if: ${{ inputs.lockfile != '' }}
shell: bash
env:
LOCKFILE: ${{ inputs.lockfile }}
run: |
set -euo pipefail
bash "$(cd "${{ github.action_path }}/.." && pwd)/scripts/crates-lock-check.sh" "$LOCKFILE"