Add an action that gives a CI job read access to gitdan-crates #35

Closed
opened 2026-11-19 16:22:03 +00:00 by claude · 0 comments
Collaborator

Context

daniel/gitdan-crates is a private repo of shared Rust crates. Consumers (director, emowheel, lublub, zemyna) depend on it as a git dependency over ssh://git@gitdan.com:22022/daniel/gitdan-crates.git, with [net] git-fetch-with-cli = true, so Cargo fetches through the git CLI.

The Actions job token cannot read it: a probe job in emowheel read its own repo with github.token and failed on gitdan-crates. CI therefore needs a read-only deploy key. Its private half will be a user-level Actions secret, GITDAN_CRATES_DEPLOY_KEY (gitdan#123 creates and rotates it).

Scope

A composite action, gitdan-crates-access, that a consumer workflow calls once before any cargo step:

- uses: https://gitdan.com/daniel/gitdan-actions/gitdan-crates-access@v1
  with:
    deploy-key: ${{ secrets.GITDAN_CRATES_DEPLOY_KEY }}

It:

  1. Writes the key to a 0600 file outside the workspace, and a known-hosts file pinning gitdan.com's SSH host key for port 22022.
  2. Exports GIT_SSH_COMMAND through $GITHUB_ENV, using only that key and that known-hosts file with strict host-key checking, so every later step's git (and Cargo through it) authenticates. Not a CARGO_* variable: those split sccache keys.
  3. Proves access at once with git ls-remote on gitdan-crates, so a missing or revoked key fails here with a message naming the secret, not deep inside a cargo fetch.
  4. Checks Cargo.lock (path is an input, default Cargo.lock): fails when it lists more than one commit of the gitdan-crates source, since two commits mean two copies of a shared type. No entry at all passes.

Acceptance criteria

  • The key never appears in a log, in argv, or in the workspace.
  • An empty deploy-key input fails with a message that names GITDAN_CRATES_DEPLOY_KEY.
  • The pinned host key matches the forge's real one, checked against an existing trusted record, not only a fresh ssh-keyscan.
  • The lockfile check has a selftest wired into this repo's existing selftest run: one commit passes, two fail, none passes.
  • README documents the action, its input, and what to do when the host key changes.

Out of scope

  • Creating or rotating the key (gitdan#123).
  • Adding the step to consumer workflows; each consumer's adoption PR does that.

Notes for agent

The live ls-remote cannot be exercised until the owner has created the secret. Test what can be tested offline, and say in the PR what remains unproven until the first consumer run.

## Context `daniel/gitdan-crates` is a private repo of shared Rust crates. Consumers (director, emowheel, lublub, zemyna) depend on it as a git dependency over `ssh://git@gitdan.com:22022/daniel/gitdan-crates.git`, with `[net] git-fetch-with-cli = true`, so Cargo fetches through the `git` CLI. The Actions job token cannot read it: a probe job in emowheel read its own repo with `github.token` and failed on gitdan-crates. CI therefore needs a read-only deploy key. Its private half will be a user-level Actions secret, `GITDAN_CRATES_DEPLOY_KEY` (gitdan#123 creates and rotates it). ## Scope A composite action, `gitdan-crates-access`, that a consumer workflow calls once before any cargo step: ```yaml - uses: https://gitdan.com/daniel/gitdan-actions/gitdan-crates-access@v1 with: deploy-key: ${{ secrets.GITDAN_CRATES_DEPLOY_KEY }} ``` It: 1. Writes the key to a `0600` file outside the workspace, and a known-hosts file pinning gitdan.com's SSH host key for port 22022. 2. Exports `GIT_SSH_COMMAND` through `$GITHUB_ENV`, using only that key and that known-hosts file with strict host-key checking, so every later step's `git` (and Cargo through it) authenticates. Not a `CARGO_*` variable: those split sccache keys. 3. Proves access at once with `git ls-remote` on gitdan-crates, so a missing or revoked key fails here with a message naming the secret, not deep inside a cargo fetch. 4. Checks `Cargo.lock` (path is an input, default `Cargo.lock`): fails when it lists more than one commit of the gitdan-crates source, since two commits mean two copies of a shared type. No entry at all passes. ## Acceptance criteria - The key never appears in a log, in argv, or in the workspace. - An empty `deploy-key` input fails with a message that names `GITDAN_CRATES_DEPLOY_KEY`. - The pinned host key matches the forge's real one, checked against an existing trusted record, not only a fresh `ssh-keyscan`. - The lockfile check has a selftest wired into this repo's existing selftest run: one commit passes, two fail, none passes. - README documents the action, its input, and what to do when the host key changes. ## Out of scope - Creating or rotating the key (gitdan#123). - Adding the step to consumer workflows; each consumer's adoption PR does that. ## Notes for agent The live `ls-remote` cannot be exercised until the owner has created the secret. Test what can be tested offline, and say in the PR what remains unproven until the first consumer run.
claude added the enhancement label 2026-11-19 16:22:03 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: daniel/gitdan-actions#35