Skip to main content

Extract release notes from markdown changelog

Project description

Hed

Extract release notes from markdown changelog that follow keep a changelog or common changelog format.

Hed, pronounced "head" (/hɛd/), is journalistic shorthand referring to the "headline" of a news story.

Installation

pip install hed

With uv:

uv tool install hed

How it works

  1. Extract --changelog lines between --capture-start (included) and --capture-end (not included).
  2. Normalize the extracted headings so the topmost heading becomes h1, e.g., ## Title becomes # Title.

Depending on how it was configured, hed can apply some transformations to the extracted release notes:

  • If --title is provided, update the h1.
  • If --diff-url is provided, adds a link to compare between tags at the end. If --previous-tag is also provided, this tag is used to build the comparison link, otherwise, hed will try to find the closest reachable tag from --tag.

Configuration

Some command-line options can be configured via hed.toml or pyproject.toml, under the tool.hed namespace. See https://toml.io/ for how to write TOML.

[tool.hed]
changelog = "CHANGELOG.md"
capture-end = '^## {tag}'
capture-start = '^## '
diff-url = "https://github.com/owner/repo/compare/{prev}...{tag}"
softbreak = true
title = "{tag}"

Usage

Given a CHANGELOG.md file similar to this:

# Changelog

## [1.0.1](https://github.com/owner/repo/releases/tag/1.0.1) - 2026-01-10

### Bug fixes

- Fixed a thing! (#1235)

## [1.0.0](https://github.com/owner/repo/releases/tag/1.0.0) - 2026-01-9

### Breaking changes

- Removed a deprecated feature. (#1234)

Extract and normalize release notes:

$ hed --tag 1.0.1
# [1.0.1](https://github.com/owner/repo/releases/tag/1.0.1) - 2026-01-10

## Bug fixes

- Fixed a thing! (#1235)

Change the title:

$ hed --tag 1.0.1 --title "{tag} Release Notes"
# 1.0.1 Release Notes

## Bug fixes

- Fixed a thing! (#1235)

Add a link to compare between releases:

$ hed --tag 1.0.1 --previous-tag 1.0.0 --diff-url "https://github.com/owner/repo/compare/{prev}...{tag}"
# [1.0.1](https://github.com/owner/repo/releases/tag/1.0.1) - 2026-01-10

## Bug fixes

- Fixed a thing! (#1235)

**Full Changelog:** [1.0.0...1.0.1](https://github.com/owner/repo/compare/1.0.0...1.0.1)

CI Integration

GitLab

Create a GitLab release using the release keyword.

gitlab-release:
  stage: deploy
  image: registry.gitlab.com/gitlab-org/cli:latest
  rules:
    - if: $CI_COMMIT_TAG
  script:
    - apk update && apk add curl
    - curl -LsSf https://astral.sh/uv/install.sh | sh
    - source $HOME/.local/bin/env
    - uvx hed
      --tag $CI_COMMIT_TAG
      --diff-url "$CI_PROJECT_URL/-/compare/{prev}...{tag}"
      > RELEASE_NOTES.md
  release:
    tag_name: '$CI_COMMIT_TAG'
    name: '$CI_COMMIT_TAG'
    description: 'RELEASE_NOTES.md'

GitHub

Create a GitHub release using softprops/action-gh-release.

jobs:
  draft-release:
    name: Create Release
    runs-on: ubuntu-latest
    if: github.ref_type == 'tag'
    permissions:
      contents: write
    steps:
      - uses: astral-sh/setup-uv@v7
      - run: >
          uvx hed
          --tag "${{ github.ref_name }}"
          --diff-url "$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/compare/{prev}...{tag}"
          > RELEASE_NOTES.md
      - uses: softprops/action-gh-release@v2
        with:
          body_path: 'RELEASE_NOTES.md'

Contributing

For guidance on setting up a development environment and contributing, see CONTRIBUTING.md.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hed-1.2.0.tar.gz (49.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

hed-1.2.0-py3-none-any.whl (10.0 kB view details)

Uploaded Python 3

File details

Details for the file hed-1.2.0.tar.gz.

File metadata

  • Download URL: hed-1.2.0.tar.gz
  • Upload date:
  • Size: 49.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for hed-1.2.0.tar.gz
Algorithm Hash digest
SHA256 da28470e006161d0c9ea55f2f1666a9bae97e48d19f9898742d17fbb8ca0c258
MD5 45e660266bfd050fdc161251cbd0bd07
BLAKE2b-256 0cc0575904ae1e485a001615c2f40112134bcaa06a24d93863a4a23d270241e7

See more details on using hashes here.

Provenance

The following attestation bundles were made for hed-1.2.0.tar.gz:

Publisher: release.yml on tahv/hed

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file hed-1.2.0-py3-none-any.whl.

File metadata

  • Download URL: hed-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 10.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for hed-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cbfce5ff7f10de1ac997f63449673d37eeffd05672286245b3aa6777e954d278
MD5 8ed9e1d03b14e13a37004292c428bbc5
BLAKE2b-256 5b609a4f207d7973f008f82c447a3d7da29a0e503dd54cf5a1b0ade8814d2290

See more details on using hashes here.

Provenance

The following attestation bundles were made for hed-1.2.0-py3-none-any.whl:

Publisher: release.yml on tahv/hed

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page