Skip to main content

GitHub

Manage GitHub repository secrets, webhooks, environments, and more.

Resources

GitHubSecret

Resource for managing GitHub repository and environment secrets.
import { GitHubSecret } from "alchemy/github";

const secret = await GitHubSecret("my-secret", {
  owner: "my-github-username",
  repository: "my-repo",
  name: "API_KEY",
  value: alchemy.secret("my-secret-value")
});

Authentication

Authentication is handled in the following order:
  1. token parameter in the resource props (if provided)
  2. GITHUB_TOKEN environment variable
The token must have the following permissions:
  • ‘repo’ scope for private repositories
  • ‘public_repo’ scope for public repositories

Props

owner
string
required
Repository owner (user or organization)
repository
string
required
Repository name
name
string
required
Secret name
value
Secret
required
Secret value (will be stored securely on GitHub)
environment
string
Optional environment name to create an environment secret. If set, the secret will be created in the specified environment instead of at the repository level.
token
Secret
Optional GitHub API token (overrides environment variable). If not provided, will use GITHUB_TOKEN environment variable. Token must have ‘repo’ scope for private repositories or ‘public_repo’ scope for public repositories.

Returns

id
string
The ID of the resource
owner
string
Repository owner
repository
string
Repository name
name
string
Secret name
environment
string
Environment name (if this is an environment secret)
updatedAt
string
Time at which the object was created/updated

Build docs developers (and LLMs) love