Skip to content

GitHub

Terminal window
npm i -D @unirelman/plugin-github
unirelman.config.ts
import { createGitHubPlugin } from "@unirelman/plugin-github";
createGitHubPlugin();
Option Type Default Description
repository string GITHUB_REPOSITORY environment variable Repository, as owner/name.
token string GITHUB_TOKEN environment variable, then GH_TOKEN environment variable Token allowed to create releases.
apiUrl string GITHUB_API_URL environment variable, then "https://api.github.com" GitHub API URL, for GitHub Enterprise Server.
tagFormat GitTagFormat The Git plugin’s default Function that names the tag of a version, the same as the Git plugin’s.
draft boolean | ({ scopeName, version }) => boolean false Whether a release is created as a draft.
makeLatest boolean | string | ({ scopeName, version }) => boolean true Whether a release becomes the latest release. A string names the only scope that does. Prereleases and drafts never do.

An empty environment variable counts as unset. The createReleases phase reads the repository and the token.

Phase Behavior
createReleases Creates a GitHub release for each scope’s current version whose release is missing.

Each release:

  • Uses the tag name of the version as tag and title.
  • Targets the current commit. GitHub creates the tag when it’s missing.
  • Has the release notes of the version as body, or an empty body.
  • Is marked as a prerelease for prerelease versions.

Existing releases, drafts included, stay unchanged.

Field Value
type github-release
name The tag name.
status existing when a release exists for the tag.
meta.github { id, url, uploadUrl } of the created or existing release. Absent from a release a dry run would create.
Error Cause
GitHubMissingOptionError The repository or the token is missing from both the options and the environment variables.
GitHubInvalidRepositoryError The repository has another format than owner/name.
GitHubUnknownLatestScopeError makeLatest names a scope the plugin is not registered for.