Skip to main content
This guide covers all the ways to publish codemods to the Codemod Registry, from local development to automated CI/CD pipelines.

Authentication Methods

Codemod supports three authentication methods for publishing: * Verifying an organization scope is only part of setup. Some packages also require adding a Trusted Publisher entry in the UI (for example, unscoped packages or when the GitHub org doesn’t match the package scope). See Organization Scopes and Individual Packages (Manual Configuration).

Interactive Login

The simplest way to authenticate for local development. Opens a browser for OAuth authentication.
After logging in, you can publish packages:

When to Use

  • Local development and testing
  • Quick one-off publishes
  • When you prefer browser-based authentication

Trusted Publishers

Trusted publishers enable passwordless publishing from GitHub Actions using OpenID Connect (OIDC). No secrets to manage or rotate.

How OIDC Works

GitHub Actions can request short-lived tokens that cryptographically prove the workflow’s identity. Codemod verifies these tokens against your configured trusted publishers.

Benefits

  • No secrets to manage: No API keys to create, rotate, or accidentally leak
  • Cryptographically secure: Tokens are signed by GitHub and verified by Codemod
  • Fine-grained control: Restrict publishing by repository, workflow, environment, or git ref
  • Short-lived tokens: Tokens expire in ~5 minutes, limiting exposure

Organization Scopes

Before anyone can publish a package such as @my-org/my-codemod, Codemod must verify that the matching GitHub organization owns the @my-org scope. GitHub Actions OIDC authenticates later publishes, but it does not skip this initial verification.
Choose one of these setup methods:
  • Connect GitHub (recommended): Install the Codemod GitHub App for the complete platform experience, including repositories, campaigns, and automations.
  • Verify a public repository: Prove ownership without granting the GitHub App access. This creates a registry-only organization for publishing packages.
Create organization page showing Connect GitHub and public repository verification options

Linking Your GitHub Organization

For full access to Codemod, connect the GitHub organization that matches your package scope:
1

Install the Codemod GitHub App

Install the Codemod GitHub App, select your GitHub organization, and grant access to at least one repository. This requires GitHub organization admin permissions.
2

Sign in to Codemod

Go to the Codemod platform, sign in with GitHub, and select Connect GitHub on the organization creation page. Your organization will be linked after GitHub confirms the installation.
Once linked, anyone who can trigger a GitHub Actions workflow in the organization can publish packages under the matching scope using OIDC.

Verifying With a Public Repository

Use repository verification when you only need the Codemod Registry and do not want to install the GitHub App yet.
1

Choose a public repository

Choose a public, non-fork, active repository whose GitHub owner exactly matches your package scope. For example, the repository owner must be nodejs to claim @nodejs. You must specify the repository; Codemod does not scan the organization’s repositories.We recommend hosting your codemod source code in this same repository so it serves both as the ownership proof and the source repository.
2

Request a verification code

On the organization creation page, enter the GitHub organization name and repository name, then select Verify with a public repository.
3

Add the verification file

Add the displayed code to .codemod/verification on the repository’s default branch. Commit and push the file publicly.
4

Complete verification

Return to Codemod and select Verify now. Codemod checks the specified repository, creates the registry-only organization, switches to it, and refreshes the page.
Repository verification instructions with the verification file path and code The requesting Codemod user becomes the owner of the registry-only organization. Registry and API key features remain available, while repository-backed features ask you to install the GitHub App. You can install it later to unlock the full platform for the same organization. For publishes authenticated with an API key or interactive login, Codemod checks that the verification file is still present and valid. A publish authenticated by GitHub Actions OIDC does not repeat that file check, because the OIDC token proves the workflow belongs to the matching GitHub organization. The initial scope verification is always required.

Complete GitHub Actions Workflow

Here’s a complete workflow file for publishing. You can create this manually or use codemod init to generate it automatically: For a single codemod repository:
For a monorepo with multiple codemods: If you have multiple codemods in a single repository (e.g., in a codemods/ directory), use tags like codemod-name@v1.0.0:
You can also run npx codemod init to generate this workflow automatically. It creates the single-codemod or monorepo format based on your project structure.

Individual Packages (Manual Configuration)

For unscoped packages or cases where the GitHub org doesn’t match the package scope, configure a trusted publisher manually:
1

Configure Trusted Publisher in UI

  1. Go to codemod.com/api-keys
  2. Scroll to Trusted Publishers
  3. Click Add Trusted Publisher
  4. Select your package and enter the GitHub repository details
  5. (Optional) Add restrictions for extra security
2

Configure Your Workflow

Once configured, any workflow in that repository can publish to the specified package.

Optional Restrictions

Add restrictions for additional security: Example with restrictions:

Manual OIDC Setup

If you prefer not to use the action, you can manually obtain and use the OIDC token:

Troubleshooting

Verify your trusted publisher configuration matches:
  • Repository owner (case-insensitive)
  • Repository name (exact match)
  • Any configured restrictions (workflow path, environment, ref pattern)
For organization scopes: Ensure the scope was initially verified either through the GitHub App or a public repository. If you used repository verification, confirm .codemod/verification remains on the specified repository’s default branch for publishes that do not use GitHub Actions OIDC.
Ensure your workflow has the required permissions:
The OIDC token audience must be https://codemod.com. If using a custom registry, configure GITHUB_OIDC_AUDIENCE on the server.

API Keys

API keys allow non-interactive authentication, perfect for CI/CD pipelines and automation.

Creating an API Key

  1. Go to codemod.com/api-keys
  2. Click Create API Key
  3. Give it a descriptive name (e.g., “GitHub Actions - my-repo”)
  4. Select the permissions (typically “Publish Packages”)
  5. Copy the key (it won’t be shown again)

Using API Keys

Option 1: Login with API key
Option 2: Environment variable

GitHub Actions Example

Store your API key as a repository secret. Never commit API keys to your repository.

When to Use

  • CI/CD pipelines without GitHub Actions OIDC
  • GitLab CI, CircleCI, Jenkins, etc.
  • Automated publishing from any environment
  • When you need explicit control over credentials

Comparison

* Trusted publishers can publish new packages when using a matching organization scope. ** Organization scopes must first be verified through the GitHub App or a public repository. Individual packages require adding a trusted publisher in the UI.

Best Practices

Use Trusted Publishers

For GitHub Actions, prefer trusted publishers over API keys. No secrets to leak or rotate.

Restrict Access

When using trusted publishers, add restrictions like environment protection for sensitive packages.

Rotate API Keys

If using API keys, rotate them periodically and use the minimum required permissions.

Tag Releases

Use git tags and GitHub releases to trigger publish workflows for clear version history.

Next Steps

Registry

Learn about package access levels and discovery.

Package Structure

Create and configure Codemod packages.

CLI Reference

Complete publish command options.

API Keys

Manage your API keys and trusted publishers.