Skip to main content

GitHub Action

The redpennon/cli Action runs rp usages in CI, resolves the Git context, and posts a snapshot to the code references API. It is the side-effecting half of the workflow — rp usages itself never posts.

Workflow

Add .github/workflows/redpennon-usages.yml:

name: RedPennon Code References
on:
push:
branches: [main]
jobs:
usages:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: redpennon/cli@v1
with:
api-token: ${{ secrets.REDPENNON_API_TOKEN }}
project: your-project-key

fetch-depth: 0 gives the Action full Git context to resolve the repository, branch, and commit.

Inputs

InputRequiredDescription
api-tokenyesOrganisation API token (rpa_…). Store it as a repository secret.
projectyesProject key the references belong to.
api-urlnoOverride the API base URL (self-hosted / development).

What it sends

The Action resolves the Git context from the environment — repository from GITHUB_REPOSITORY, branch from GITHUB_REF_NAME, commit_sha from GITHUB_SHA — and POSTs the scan with provider: github to POST /v1/code-references. Because each push is a full snapshot, references that disappear are marked stale automatically.

Secrets

Create the organisation API token under Settings → API tokens in the app, then add it to the repository under Settings → Secrets and variables → Actions as REDPENNON_API_TOKEN.

The Action is published on the GitHub Marketplace and bundled (no npm install step needed in your workflow).