relnote docs · CI · GitHub Action · Single-file install · CHANGELOG.md · Compare

Release notes for Gitea and Forgejo

relnote reads conventional commits in the local clone and prints a release body. It does not call Gitea, Forgejo, or Codeberg. You paste that body, or the job publishes it with their releases API or with tea.

Notes from the commits after the last tag

Two commits after v1.2.0, in a clone whose origin is https://codeberg.org/you/demo.git (a Gitea remote such as https://gitea.com/you/demo.git behaves the same):

git log --oneline v1.2.0..HEAD
fix: return a sentinel error from Open
feat(api): add paging (#41)

--next-version prints the next tag and does not create it. A breaking change bumps major, a feat bumps minor, anything else bumps patch (while the major is 0, a breaking change bumps minor):

python3 -m relnote --next-version
v1.3.0

Tag that commit. HEAD is now v1.3.0, so relnote starts the range at the tag before it and names the end v1.3.0:

git tag -a v1.3.0 -m v1.3.0
python3 -m relnote
## What's changed

### Features

- **api:** add paging (#41) (`62fd860`) — Ada Lovelace

### Fixes

- return a sentinel error from Open (`c0615d6`) — Ada Lovelace

---

Range: `v1.2.0` → `v1.3.0`.

There is no Full changelog line. relnote adds https://github.com/<owner>/<repo>/compare/<since>...<until> only when origin matches one of these:

The same history with origin set to https://github.com/you/demo.git keeps the groups and adds the link:

## What's changed

### Features

- **api:** add paging (#41) (`62fd860`) — Ada Lovelace

### Fixes

- return a sentinel error from Open (`c0615d6`) — Ada Lovelace

---

Range: `v1.2.0` → `v1.3.0`.

**Full changelog:** https://github.com/you/demo/compare/v1.2.0...v1.3.0

Output from a test repository in relnote's CI (tests/test_gitea_forgejo_docs.py); your hashes differ. --format github (the default) is Markdown: headings, bold scopes, and backtick hashes. --format plain is the same groups without that emphasis. Neither format calls GitHub, Gitea, or Forgejo. A Gitea or Forgejo release description renders the Markdown.

The same notes, written to a file and kept out of the log:

python3 -m relnote --since v1.2.0 --until v1.3.0
python3 -m relnote --output notes.md --quiet

(#41) stays text in that file. GitHub's release form autolinks it; relnote does not rewrite it for Gitea or Forgejo, and it does not rewrite it on stdout for GitHub either.

CHANGELOG.md

--changelog prepends one Keep a Changelog section. On a Codeberg, Gitea, or Forgejo origin the bullet keeps (#41), and there is no compare link to copy into the section:

python3 -m relnote --since v1.2.0 --until v1.3.0 --changelog CHANGELOG.md --changelog-title v1.3.0 --date 2026-11-26 --quiet
# Changelog

All notable changes to this project are documented in this file.

## [v1.3.0] - 2026-11-26

### Features

- **api:** add paging (#41) (`62fd860`) — Ada Lovelace

### Fixes

- return a sentinel error from Open (`c0615d6`) — Ada Lovelace

With a github.com origin, from v0.3.5, that same command links the pull request and keeps the compare URL. The release body above does not change:

# Changelog

All notable changes to this project are documented in this file.

## [v1.3.0] - 2026-11-26

### Features

- **api:** add paging ([#41](https://github.com/you/demo/pull/41)) (`62fd860`) — Ada Lovelace

### Fixes

- return a sentinel error from Open (`c0615d6`) — Ada Lovelace

**Full changelog:** https://github.com/you/demo/compare/v1.2.0...v1.3.0

A second run with the same title exits 1 and leaves the file as it was. Older sections stay. Details: CHANGELOG.md from conventional commits.

Paste, or tea

Forgejo's releases page says a release (notes and attachments, as opposed to a git tag alone) is created in the web interface or through the API. The description field is the release body. Paste notes.md there. Gitea's create-release operation is the same idea: tag_name is required, and body is the notes.

tea releases create sends that file. These flags are the ones in current tea (gitea.dev/tea): --tag (if the tag does not exist yet, Gitea creates it), --title (-t), --note-file (-f; when set, --note is ignored), --draft (-d), and --repo (-r, owner/name). --login (-l) selects the saved login:

tea releases create --tag v1.3.0 --title v1.3.0 --note-file notes.md --draft --repo you/demo

The tea repository says tea is replaced by gt. The command above is tea. This page does not document gt flags.

Gitea Actions

The Gitea Actions quickstart puts a .yaml file in .gitea/workflows/, uses on: [push], runs-on: ubuntu-latest, and actions/checkout@v4. Repository Actions start disabled; the repository settings page turns them on. The label ubuntu-latest has to be one a runner registered. The image for that label needs Python 3.11+, git, and curl, because the job runs the zipapp, not a composite action.

actions/checkout@v4 fetches one commit unless fetch-depth is 0, which the checkout readme describes as all history for all branches and tags. relnote needs the previous tag. The quickstart also says actions/checkout may not work in a SHA256 repository or when Gitea is served from a subpath. A shallow clone can be completed with the two git lines on the CI page (git fetch --unshallow when the clone is shallow, then git fetch --tags --force).

Gitea's variables page sets gitea.ref_type to branch or tag, gitea.ref_name to the short name, gitea.repository to owner/name, and gitea.api_url to the REST API (the example is https://gitea.com/api/v1). github.* is an alias of gitea.*. The job token is secrets.GITEA_TOKEN (gitea.token / github.token in an expression). API calls use the header from Gitea's API authentication: Authorization: token and the token. Token permissions apply to that token: contents: read lets checkout read the code, and releases: write is the scope that covers releases. The quickstart trigger is every push, so the script returns before it creates a release unless gitea.ref_type is tag.

name: Release notes

on: [push]

jobs:
  release:
    runs-on: ubuntu-latest
    permissions:
      contents: read
      releases: write
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0
      - name: Draft a release from the notes
        env:
          TOKEN: ${{ secrets.GITEA_TOKEN }}
          TAG: ${{ gitea.ref_name }}
          REF_TYPE: ${{ gitea.ref_type }}
          API: ${{ gitea.api_url }}
          REPO: ${{ gitea.repository }}
        run: |
          if [ "$REF_TYPE" != "tag" ]; then
            echo "Not a tag push."
            exit 0
          fi
          curl -fsSL -o relnote https://github.com/loki-inu/relnote/releases/download/v0.3.8/relnote
          chmod +x relnote
          ./relnote --no-bots --output notes.md --quiet
          python3 -c 'import json, os, pathlib; pathlib.Path("release.json").write_text(json.dumps({"tag_name": os.environ["TAG"], "target_commitish": os.environ["TAG"], "name": os.environ["TAG"], "body": pathlib.Path("notes.md").read_text(encoding="utf-8"), "draft": True}), encoding="utf-8")'
          curl -fsS -X POST \
            -H "Authorization: token $TOKEN" \
            -H "Content-Type: application/json" \
            --data-binary @release.json \
            "$API/repos/$REPO/releases"

Save that as .gitea/workflows/release-notes.yaml. Because HEAD is the pushed tag, the notes run from the previous tag to that tag, as in the sample above. The JSON fields are the create-release body: tag_name (required), target_commitish, name, body, and draft. draft: true leaves the release unpublished. The operation responds 201 when the release is created and 409 when a release for that tag already exists, so a second run of the same tag fails the job. Set "draft": False in the JSON to publish immediately. The notes go through notes.md and a JSON file so commit subjects are not expanded by the shell.

uses: loki-inu/relnote@v0.3.8 is the GitHub composite action. Gitea downloads short uses: names from gitea.gitea_default_actions_url (the variables page example is https://github.com, and an administrator can change it). This job does not depend on that. It downloads the zipapp from the single-file install. The CLI exits 1 when the range is empty (relnote: no commits in range SINCE..UNTIL). has-changes is a GitHub Action output, not a CLI flag. See the GitHub Action guide.

Forgejo Actions, including Codeberg

Forgejo reads workflows from .forgejo/workflows. The workflow reference triggers on a pushed tag with on.push.tags (the documented example is 'v1.*'; 'v*' is the same kind of list). runs-on: docker is the label in the basic concepts example; it has to match a runner. A short uses: name is prefixed with DEFAULT_ACTIONS_URL, https://data.forgejo.org by default, and the docs recommend a full URL. uses: loki-inu/relnote@v0.3.8 would look on that host, not on GitHub. Checkout is the Forgejo mirror of actions/checkout, whose readme uses fetch-depth: 0 for all history for all branches and tags:

name: Release notes

on:
  push:
    tags:
      - 'v*'

jobs:
  release:
    runs-on: docker
    steps:
      - uses: https://data.forgejo.org/actions/checkout@v7
        with:
          fetch-depth: 0
      - name: Draft a release from the notes
        env:
          TOKEN: ${{ secrets.FORGEJO_TOKEN }}
          TAG: ${{ forgejo.ref_name }}
          API: ${{ forgejo.api_url }}
          REPO: ${{ forgejo.repository }}
        run: |
          curl -fsSL -o relnote https://github.com/loki-inu/relnote/releases/download/v0.3.8/relnote
          chmod +x relnote
          ./relnote --no-bots --output notes.md --quiet
          python3 -c 'import json, os, pathlib; pathlib.Path("release.json").write_text(json.dumps({"tag_name": os.environ["TAG"], "target_commitish": os.environ["TAG"], "name": os.environ["TAG"], "body": pathlib.Path("notes.md").read_text(encoding="utf-8"), "draft": True}), encoding="utf-8")'
          curl -fsS -X POST \
            -H "Authorization: token $TOKEN" \
            -H "Content-Type: application/json" \
            --data-binary @release.json \
            "$API/repos/$REPO/releases"

Save that as .forgejo/workflows/release-notes.yaml. secrets.FORGEJO_TOKEN is the automatic token; secrets.GITHUB_TOKEN, forgejo.token, and github.token are the same value. The basic-concepts page says that token can write to the repository of the workflow, and that a pull_request from a fork does not get write permission. A tag push is not that case. forgejo.api_url is the instance API (for example https://codeberg.org/api/v1), so the URL is POST /repos/{owner}/{repo}/releases, the endpoint on Forgejo's releases page. The Authorization: token header is the one Gitea documents for this API, which Forgejo serves.

Codeberg runs Forgejo. Its CI docs describe Forgejo Actions with your own runner, and a limited hosted offering, and they point at Forgejo's documentation. The workflow file and the API call above are that path. forgejo.server_url on Codeberg is the Codeberg host. Codeberg also documents Woodpecker; this page does not.

The image on the docker label needs Python 3.11+, git, and curl. If the checkout is shallow, finish it with the CI page fetch before ./relnote. An empty range exits 1, same as on Gitea.

FAQ

Does relnote call the Gitea or Forgejo API?

No. relnote reads the local git history and writes a file or stdout. Creating the release is a separate step: the web form, tea, or POST /repos/{owner}/{repo}/releases.

Why is there no Full changelog link?

The compare URL is built only when origin matches a github.com remote (https://github.com/owner/repo, git@github.com:owner/repo, or ssh://git@github.com/owner/repo). A codeberg.org, gitea.com, or other Gitea or Forgejo origin produces the range line and no compare link.

Can Forgejo Actions use the relnote GitHub Action?

No. uses: loki-inu/relnote@v0.3.8 is the composite action for GitHub Actions. Forgejo prefixes a short uses name with DEFAULT_ACTIONS_URL, https://data.forgejo.org by default, so that line does not load this repository. Download the zipapp and run the CLI. The CLI exits 1 when the range is empty. has-changes exists only on the GitHub Action.

Does (#41) become a pull request link?

In the release body, no. Stdout and --output keep (#41) as text on every remote. --changelog rewrites (#41) into a https://github.com/owner/repo/pull/41 link only when origin is github.com. On Gitea or Forgejo the changelog bullet keeps (#41).

What happens when there is nothing to release?

The CLI exits 1 and prints relnote: no commits in range SINCE..UNTIL. A Gitea Actions or Forgejo Actions step that runs the zipapp fails on that status. The GitHub Action turns the same line into has-changes false unless fail-on-empty is true.