feat: add gitdan-crates-access, a deploy-key action for the private crates repo
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:
@@ -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"
|
||||
Reference in New Issue
Block a user