Generate changelog

From eclipse-glsp/glsp · View interactive version

Generate changelog is an AI agent skill from the GitHub repository eclipse-glsp/glsp. Generate the changelog entries of a GLSP repository for the PRs merged since its changelog was last generated.

How to use this skill

Skill file

Generate changelog

Write the CHANGELOG.md entries of one GLSP repository for the PRs merged since the changelog was last generated, review them with the user, and open a PR if they ask for one.

Setup

Phase 1: Gather

Step 1.1: List the pending commits

List the commits since the changelog marker (<!-- changelog-generated-up-to: <sha> --> below the title of CHANGELOG.md), or since the last release tag if there is no marker yet:

BASE=$(grep -oP 'changelog-generated-up-to: \K[0-9a-f]+' CHANGELOG.md || git tag --list 'v*' --sort=-v:refname | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+$' | head -1)
HEAD_SHA=$(git rev-parse HEAD)
git log --first-parent --format='%H%x09%an%x09%s' $BASE..$HEAD_SHA

Record HEAD_SHA: Phase 2 moves the marker to it. Sort every commit into one of three groups; a squash-merged PR ends its subject with (#<n>):

Step 1.2: Decide each pending PR

Fetch each PR with gh pr view <n> --repo <slug> --json title,body,labels; judge a commit without a PR number from git show <sha>. Then decide:

Flag every decision you are unsure of; Phase 3 puts the flags to the user.

Step 1.3: Write the entries

- [tag] Description [#N](https://github.com/eclipse-glsp/<repo>/pull/N)
- [tag] Description of a change spread over two PRs [#N](https://github.com/eclipse-glsp/<repo>/pull/N) [#M](https://github.com/eclipse-glsp/<repo>/pull/M)
- [tag] Description of a breaking change [#N](https://github.com/eclipse-glsp/<repo>/pull/N)
    - How to migrate

Phase 2: Update CHANGELOG.md

  1. Add the entries to the ## v<x.y.z> - active section, under ### Changes or ### Potentially Breaking Changes, creating a missing subsection. If the topmost section is a released version, first insert a new section for the next minor version (v2.6.0 becomes v2.7.0) between the title and the first ## heading:

```markdown

## v2.7.0 - active

### Changes

### Potentially Breaking Changes

```

Drop ### Potentially Breaking Changes from a new section without breaking entries.

  1. Set the marker directly below the # title line to HEAD_SHA, replacing an existing one: <!-- changelog-generated-up-to: HEAD_SHA -->. Move it even if no PR got an entry: it records that every commit up to HEAD_SHA was decided on, and a release starts only once no commit after the marker is pending.
  2. If the root package.json has a format script, run pnpm install && pnpm format.

Phase 3: Review

Show git diff CHANGELOG.md and the flagged decisions, and ask the user to resolve the flags and approve. Apply their edits and show the new diff until they approve.

Phase 4: PR

Open a PR only when the user asks for one, in the prompt or when you ask after approval.

git ls-remote --heads origin 'changelog-update*'
git checkout -b <branch>
git commit -m "Update changelog" CHANGELOG.md
git push -u origin <branch>

<branch> is changelog-update, or changelog-update-<n> with the first <n> not on the remote. Fill the repository's .github/PULL_REQUEST_TEMPLATE.md if it has one, open the PR with gh pr create --repo <slug> --title "Update changelog" --body-file <file>, and report its URL.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.