Install kam in your GitHub Actions runner with optional caching and template import.
Important
- By default the
private-keyinput is optional. If it is not provided the action will continue but will print a warning. To make the key mandatory setrequire-private-key: 'true'. When provided the key will be imported into thekamkeyring (secret namemain) and a random passphrase will be exported toKAM_SIGN_PASSPHRASE(masked). - The action will attempt to install Commitizen (
python-commitizen) viauvwheninstall-commitizenis'true'(default). Verification prefers module invocation (python -m commitizen) and falls back to theczCLI if present. If Commitizen cannot be verified andrequire-commitizenis'true', the action will fail; otherwise it will continue and emit a warning. - The action performs preflight checks for required tools (such as
curlandopenssl) and will fail fast with guidance if missing. - To avoid unnecessary recompilation when a later step in the job fails after a successful build, this action saves the compiled
kamartifacts to the GitHub Actions cache immediately after installation. The cache save is guarded so it only runs when a workingkambinary is present, and it is executed with analways()-style guard so that it will still attempt to save the build even if later steps fail. Keepenable-cache: 'true'(the default) and ensure files used in the cache key (for exampleCargo.lock) are present so the cache can be reliably restored on subsequent runs.
Usage
Basic example:
name: CI with kam
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup kam
uses: MemDeco-WG/setup-kam@v1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
private-key: ${{ secrets.KAM_PRIVATE_KEY }} # required
- run: kam --versionWith template import and caching:
- name: Setup kam (with template)
uses: MemDeco-WG/setup-kam@v1
with:
github-token: ${{ secrets.GITHUB_TOKEN }} # optional (recommended)
enable-cache: 'true' # optional, default true
template-url: https://example.com/template.zip # optional
kam-version: '0.3.1' # optional, pin version
private-key: ${{ secrets.KAM_PRIVATE_KEY }} # optional (see 'require-private-key' to enforce)
require-private-key: 'true' # optional (fail if private-key not provided)Inputs
github-token(optional): Default${{ github.token }}. Use this if you need authenticated access to private releases/assets.enable-cache(optional):'true'(default) or'false'to disable caching.kam-version(optional): Pin a specific kam version to install (e.g.,'0.1.2'). When set, network lookup for the latest version is skipped and the pinned version will be used for installation and cache keys.template-url(optional): URL to a template archive (e.g.,.zip,.tgz,.tar.gz). The URL must include a filename and extension; if you download manually, preserve the extension or provide the extracted directory path tokam tmpl import.private-key(optional): The KAM private key contents (PEM). Provide it through a repository secret, for example:private-key: ${{ secrets.KAM_PRIVATE_KEY }}. If provided, the action will import it into the kam keyring (using secret namemain) and export an auto-generated passphrase asKAM_SIGN_PASSPHRASE(masked).require-private-key(optional):'false'(default) or'true'. When'true'the action will fail early ifprivate-keyis not provided.install-commitizen(optional):'true'(default) or'false'. Attempt to install commitizen viauv. If you prefer not to install commitizen in the runner, set to'false'.require-commitizen(optional):'false'(default) or'true'. When'true'the action will fail if commitizen cannot be verified after attempted installation.
Outputs
latest-version: Resolved kam version (from crates.io/GitHub or pinned).installed-version: Currently installed kam version (string, or empty).should-install:'true'if the action decided to install kam.key-imported:'true'if the private key was successfully imported.
Notes
- The action attempts to install
python-commitizenand verifies it's callable (preferringpython -m commitizenand falling back toczif present). This behavior is controlled byinstall-commitizenandrequire-commitizeninputs; if verification fails andrequire-commitizenis'true', the action will fail, otherwise it will continue with a warning. - The action performs preflight checks for required tools (e.g.,
curl,openssl, and archive utilities iftemplate-urlpoints to an archive) and will fail early with guidance if they are missing. - When a
private-keyis imported the action masks sensitive values and setsKAM_SIGN_PASSPHRASEin the environment for subsequent steps (masked in logs). - Prefer
uses: MemDeco-WG/setup-kam@v1(major alias) rather than pinning patch versions for stable behavior.