MCPcopy Index your code
hub / github.com/release-drafter/release-drafter

github.com/release-drafter/release-drafter @v7.5.1 sqlite

repository ↗ · DeepWiki ↗ · release v7.5.1 ↗
159 symbols 545 edges 111 files 4 documented · 3%
README

Release Drafter Logo

Drafts your next release notes as pull requests are merged into master.

CI CodeQL

Usage

You can use the Release Drafter GitHub Action in a GitHub Actions Workflow by configuring a YAML-based workflow file, e.g. .github/workflows/release-drafter.yml, with the following:

name: Release Drafter

on:
  push:
    branches:
      - main
      - master

# Permissions for default token (secrets.GITHUB_TOKEN)
permissions:
  contents: write
  pull-requests: read

jobs:
  update_release_draft:
    runs-on: ubuntu-latest
    steps:
      - uses: release-drafter/release-drafter@v7
        with:
          config-name: release-drafter.yml # the default, loads '.github/release-drafter.yml'

Configuration

The action requires a configuration file. Default location is .github/release-drafter.yml, and will be fetched using octokit behind the scenes. You do not need to checkout your repository beforehand.

[!note]
For advanced scenarios, please read dedicated Configuration Loading article. (ex: dynamic config, extending other files, fetch from another repo, etc...)

Example

For example, take the following .github/release-drafter.yml file in a repository:

template: |
  ## What’s Changed

  $CHANGES

As pull requests are merged, a draft release is kept up-to-date listing the changes, ready to publish when you’re ready:

Screenshot of generated draft release

The following is a more complicated configuration, which categorises the changes into headings, and automatically suggests the next version number:

name-template: "v$RESOLVED_VERSION 🌈"
tag-template: "v$RESOLVED_VERSION"
categories:
  - title: "🚀 Features"
    semver-increment: minor
    when:
      labels:
        - "feature"
        - "enhancement"
  - title: "🐛 Bug Fixes"
    when:
      labels:
        - "fix"
        - "bugfix"
        - "bug"
  - title: "🧰 Maintenance"
    when:
      label: "chore"
  - type: "pre-exclude"
    when:
      label: "skip-changelog"
  - type: "version-resolver"
    semver-increment: "major"
    when:
      label: "major"
  - type: "version-resolver"
    semver-increment: "patch"
change-template: "- $TITLE @$AUTHOR (#$NUMBER)"
change-title-escapes: '\<*_&' # You can add # and @ to disable mentions, and add ` to disable code blocks.
template: |
  ## Changes

  $CHANGES

Configuration Options

You can configure Release Drafter using the following key in your .github/release-drafter.yml file:

Key Required Description
template Required The template for the body of the draft release. Use template variables to insert values.
header Optional Will be prepended to template. Use template variables to insert values.
footer Optional Will be appended to template. Use template variables to insert values.
category-template Optional The template to use for each category. Use category template variables to insert values. Default: "## $TITLE".
name-template Optional The template for the name of the draft release. For example: "v$NEXT_PATCH_VERSION".
tag-template Optional The template for the tag of the draft release. For example: "v$NEXT_PATCH_VERSION".
tag-prefix Optional A known prefix used to filter release tags. For matching tags, this prefix is stripped before attempting to parse the version. Default: ""
version-template Optional The template to use when calculating the next version number for the release. Useful for projects that don't use semantic versioning. Default: "$MAJOR.$MINOR.$PATCH$PRERELEASE"
change-template Optional The template to use for each merged pull request. Use change template variables to insert values. Default: "* $TITLE (#$NUMBER) @$AUTHOR".
change-title-escapes Optional Characters to escape in $TITLE when inserting into change-template so that they are not interpreted as Markdown format characters. Default: ""
no-changes-template Optional The template to use for when there’s no changes. Default: "* No changes".
references Optional The references to listen for configuration updates to .github/release-drafter.yml. Refer to References to learn more about this
categories Optional Define how changes are filtered, grouped, and versioned. Categories support type, when, exclusive, collapse-after, and semver-increment. Refer to Categorize Changes.
exclude-contributors Optional Exclude specific usernames from the generated $CONTRIBUTORS variable. Refer to Exclude Contributors to learn more about this option.
no-contributors-template Optional The template to use for $CONTRIBUTORS when there's no contributors to list. Default: "No contributors".
replacers Optional Search and replace content in the generated changelog body. Refer to Replacers to learn more about this option.
sort-by Optional Sort changelog by merged_at or title. Can be one of: merged_at, title. Default: merged_at.
sort-direction Optional Sort changelog in ascending or descending order. Can be one of: ascending, descending. Default: descending.
prerelease Optional Whether to draft a prerelease, with changes since another prerelease (if applicable). Default false.
prerelease-identifier Optional A string indicating an identifier (alpha, beta, rc, etc), to increment the prerelease version. This automatically enables prerelease when both options come from the same config location; explicit action inputs still take precedence. Default ''.
include-pre-releases Optional When looking for the last published release to scan changes up-to, include pre-releases. Has no effect if using prerelease: true (already enabled). Default false.
latest Optional Mark the release as latest. Only works for published releases. Can be one of: true, false, legacy. Default true.
commitish Optional The release target, i.e. branch or commit it should point to. Default: the ref that release-drafter runs for, e.g. refs/heads/master if configured to run on pushes to master.
filter-by-range Optional Filter releases that satisfies a semver range. Evaluates the tag name againts node's semver.satisfies(). Default : "*".
filter-by-commitish Optional Filter previous releases to consider only those with the target matching commitish. Default: false.
pull-request-limit Optional Limit for associatedPullRequests API call. Use this when working with long-lived non-default branches. See #1354. Default: 5
history-limit Optional Size of the pagination window when walking the repo. Can avoid erratic 502s from Github. Default: 15

Template Variables

You can use any of the following variables in your template, header and footer:

Variable Description
$CHANGES The markdown list of pull requests that have been merged.
$CONTRIBUTORS A comma separated list of contributors to this release (pull request authors, commit authors, and commit committers).
$PREVIOUS_TAG The previous releases’s tag.
$REPOSITORY Current Repository
$OWNER Current Repository Owner

Category Template Variables

You can use any of the following variables in category-template:

Variable Description
$TITLE The category title, e.g. Features.

Next Version Variables

You can use any of the following variables in your template, header, footer, name-template and tag-template:

Variable Description
$NEXT_PATCH_VERSION The next patch version number. For example, if the last tag or release was v1.2.3, the value would be v1.2.4. This is the most commonly used value.
$NEXT_MINOR_VERSION The next minor version number. For example, if the last tag or release was v1.2.3, the value would be v1.3.0.

Extension points exported contracts — how you extend this code

GithubActionEnvironment (Interface)
(no doc)
src/types/env.ts
PullRequest (Interface)
(no doc)
src/tests/drafter/paginate-graphql.test.ts
GraphQLResponse (Interface)
(no doc)
src/tests/drafter/paginate-graphql.test.ts

Core symbols most depended-on inside this repo

mockContext
called by 107
src/tests/mocks/context.ts
runDrafter
called by 96
src/tests/helpers/runners.ts
mockGraphqlQuery
called by 92
src/tests/mocks/graphql.ts
nockGetAndPostReleases
called by 89
src/tests/mocks/releases.ts
mergeInputAndConfig
called by 49
src/actions/drafter/config/merge-input-and-config.ts
mockInput
called by 28
src/tests/mocks/input.ts
composeConfigGet
called by 26
src/common/config/index.ts
renderTemplate
called by 25
src/actions/drafter/lib/build-release-payload/render-template/render-template.ts

Shape

Function 118
Method 24
Class 12
Interface 3
Enum 2

Languages

TypeScript100%

Modules by API surface

src/actions/drafter/lib/build-release-payload/render-template/util/replacePattern.ts29 symbols
src/actions/drafter/common/category-matching.ts10 symbols
src/actions/drafter/lib/build-release-payload/version-descriptor.ts9 symbols
src/actions/drafter/config/merge-input-and-config.ts9 symbols
src/tests/mocks/releases.ts5 symbols
src/common/paginate-graphql.ts5 symbols
src/actions/drafter/lib/build-release-payload/sort-pull-requests.ts5 symbols
src/tests/mocks/pull_requests.ts4 symbols
src/actions/drafter/lib/build-release-payload/render-template/util/search.ts4 symbols
src/actions/drafter/lib/build-release-payload/render-template/render-template.ts4 symbols
src/tests/drafter/find-pull-requests.test.ts3 symbols
vite.config.ts2 symbols

Dependencies from manifests, versioned

@actions/core3.0.1 · 1×
@actions/github9.1.1 · 1×
@biomejs/biome2.4.15 · 1×
@graphql-codegen/cli7.0.0 · 1×
@graphql-codegen/near-operation-file-preset5.2.1 · 1×
@graphql-codegen/typed-document-node7.0.0 · 1×
@graphql-typed-document-node/core3.2.0 · 1×
@octokit/graphql9.0.3 · 1×
@octokit/plugin-rest-endpoint-methods17.0.0 · 1×
@octokit/request-error7.1.0 · 1×
@octokit/types16.0.0 · 1×
@octokit/webhooks-types7.6.1 · 1×

For agents

$ claude mcp add release-drafter \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact