﻿---
title: changelog validate cli command
description: Validate changelog entry files that a PR added or modified. Checks YAML validity, required fields, config-value membership, PR-number existence, and entry...
url: https://docs-v3-preview.elastic.dev/elastic/docs-builder/pull/5113/cli/changelog/validate
products:
  - Elastic Docs Builder
---

# changelog validate cli command
```bash
docs-builder changelog validate <pr-number> [options]
```

Validate changelog entry files that a PR added or modified. Checks YAML validity, required fields, config-value membership, PR-number existence, and entry hygiene. Exits non-zero on any error-level finding; warnings do not block.
```sh
# Simplest local usage — owner/repo inferred from git remote, config from docs/changelog.yml
docs-builder changelog validate 4009
```

Pass `--require` to also fail when no entry file references this PR number, combining file-presence and content validation in a single command.
When running under GitHub Actions and `--head-sha` is provided, writes decision metadata to `.artifacts/changelog-decision/metadata.json` for the downstream `changelog github-comment` step. Pass `--comment-on-success` as well, so the release-note outcome recorded by `validate-labels` is kept. See [Comment on success](/elastic/docs-builder/pull/5113/cli/changelog/evaluate-pr#comment-on-success).

## Arguments

<definitions>
  <definition term="<pr-number> int required">
    Pull request number to validate.
  </definition>
</definitions>


## Options

<definitions>
  <definition term="--config string">
    Path to the changelog configuration file. Defaults to docs/changelog.yml.
    **Constraints:** symbolic links not allowed, must exist, extensions: yml, yaml
  </definition>
  <definition term="--owner string">
    GitHub repository owner. Defaults to the owner inferred from the git remote origin.
  </definition>
  <definition term="--repo string">
    GitHub repository name. Defaults to the repo inferred from the git remote origin.
  </definition>
  <definition term="--pr-labels string">
    Comma-separated list of PR labels. When supplied, validates that type: matches the label-derived type (use ${{ join(github.event.pull_request.labels.*.name, ',') }} in Actions). When omitted, the check that a PR with only notes or amends has a skip label reads the labels from GitHub.
  </definition>
  <definition term="--files string[]">
    Explicit file list; bypasses GitHub API discovery. Useful for local runs without a token.
    **Repeatable:** pass `--files` multiple times to supply more than one value
  </definition>
  <definition term="--require">
    Also fail when no changelog entry file references this PR number.
    **Default:** `false`
  </definition>
  <definition term="--head-ref string">
    PR head branch ref — written to decision metadata when on CI.
  </definition>
  <definition term="--head-sha string">
    PR head commit SHA — written to decision metadata when on CI.
  </definition>
  <definition term="--is-fork">
    Whether the PR is from a fork.
    **Default:** `false`
  </definition>
  <definition term="--can-commit">
    Whether the commit strategy allows committing.
    **Default:** `false`
  </definition>
  <definition term="--maintainer-can-modify">
    Whether the fork PR allows maintainer edits.
    **Default:** `false`
  </definition>
  <definition term="--head-repo string">
    Fork repository full name (owner/repo).
  </definition>
  <definition term="--comment-on-success">
    Keep the release-note outcome comment when entry validation passes.
    **Default:** `false`
  </definition>
  <definition term="-l --log-level enum">
    Minimum log level.
    **Values:** trace, debug, information, warning, error, critical, none
    **Default:** `information`
  </definition>
  <definition term="-c --config-source enum">
    Override the configuration source: local, remote
    **Values:** local, remote, embedded
  </definition>
  <definition term="--skip-private-repositories">
    Skip cloning private repositories
  </definition>
</definitions>


## Global Options

<definitions>
  <definition term="-l --log-level enum">
    Minimum log level.
    **Values:** trace, debug, information, warning, error, critical, none
    **Default:** `information`
  </definition>
  <definition term="-c --config-source enum">
    Override the configuration source: local, remote
    **Values:** local, remote, embedded
  </definition>
  <definition term="--skip-private-repositories">
    Skip cloning private repositories
  </definition>
</definitions>


## Owner, repo, and config resolution


| Value      | Precedence                                      |
|------------|-------------------------------------------------|
| `--owner`  | CLI flag → git remote origin                    |
| `--repo`   | CLI flag → git remote origin                    |
| `--config` | CLI flag → `docs/changelog.yml` in the git root |

For local use you rarely need to supply any of these. For CI the runner's checkout has no git remote, so pass them explicitly.

## File discovery

Without `--files`, the command calls the GitHub API (`GET /repos/{owner}/{repo}/pulls/{pr}/files`) to list changed files. A file that the PR renames or copies is listed under its new path, so a file renamed into an entry, note or amend name is validated. A removed file is not listed. A `GITHUB_TOKEN` is needed for this. Supply `--files` to bypass API discovery entirely. Three kinds of file are validated:
- **Entry files**: top-level `.yaml`/`.yml` files under the changelog directory. The file name must start with the PR number.
- **Note files**: `note-*.yml` files in the same directory. A note has no PR number in its name, and every product must list `versions`.
- **Amend files**: files directly in a bundle directory (`bundle.output_directory`, its product folders, or the folders from the profiles) whose name has the form `{name}.amend-{suffix}.yaml`. A file is either an amend or an entry, never both: when the bundle and changelog directories are the same, an amend is not checked against the entry rules. A suffix that is not a number, such as `9.3.0.amend-one.yaml`, is reported as a malformed amend name, unless the file is in the changelog directory and its name already follows the entry convention (`{PR number}[-{name}]`, for example `42-fix.amend-api.yaml`) or the note convention (`note-*`): such a file stays an entry or a note. Elsewhere those conventions mean nothing, so a bundle file such as `serverless/2026-07-07.amend-one.yaml` is an amend even though its date starts with digits. A well-formed `.amend-{N}` or `.amend-notes` name is always an amend. The configured directory `.` is the repository root.


## Notes and amends

A note is valid when it passes the same field checks as an entry (title, type, products, lifecycle) and lists the release `versions` for each product. A note is not tied to the PR that adds it, so the type label of the PR does not apply to it. For each version, the comment says whether that release is already published (the scrubber attaches the note after upload) or not yet (the note ships with that release). An unreadable bundle registry only changes that message; it does not fail the check. The registry of a product is read once, however many notes and versions the PR holds, and not at all when no note gives that product a version.
An amend is valid when:
- its name is `{parent}.amend-{N}` with N of 1 or more. The scrubber-owned `.amend-notes` sidecar is an error;
- its parent bundle is listed in the published bundle registry of at least one of its products. A bundle that is not released yet cannot be amended. The amend is uploaded to every product it declares, so the command reads each product's registry: one that cannot be read is an error, and a product that does not list the parent gives a warning. A product tree that lacks the parent can still hold an amend of the same name (an orphaned amend), which the upload would overwrite, so the next check covers it too;
- every added entry has a title, a type and a product that the amend declares, and every exclusion names a file;
- in each product tree that already holds an amend of the same name, with or without the parent, the published amend is the same amend. A published amend is immutable, so the error names the next free number. The two are compared by the products, the entries and exclusions they name (by file name and checksum), the fields of the added entries that the changelog scrubber keeps (type, title, subtype, areas, feature ID, highlight and products) and whether the amend sets the intro. Private references and the text of the descriptions, impact, action and intro are not compared, because the scrubber rewrites them in the published copy, so a change that is only in that text is not detected. The registry says whether an amend of that name exists, so an unrelated published amend that cannot be downloaded does not block the check;
- every exclusion names an entry that the bundle has when the amend applies, in every product tree that lists the parent: the parent, the published numbered amends before this one, and the lower-numbered amends that the same PR adds or changes, so an entry added in `amend-1` can be excluded in `amend-2`. An amend of the PR applies only to the products it declares: an `amend-1` for Elasticsearch alone does not add its entries to Kibana's bundle. Only those files are downloaded. An exclusion that names no entry in any tree gives a warning and counts as removing nothing; one that is a no-op in some trees warns for those trees, whatever the order of the products. The comment counts the distinct entries that the amend removes, so two exclusions of one entry count once. When a needed file cannot be read, the exclusions are not checked and the comment says what the file requests.

The comment lists each note and amend with its effect, and links to the files at the head commit of the PR, in the fork for a PR from a fork. A check that passes with warnings only is not reported as a failure: the comment says the files are valid, lists the warnings, and keeps the note and amend summary. With the opt-in release-note comment on (`--comment-on-success`), the summary goes below the release-note outcome. See [changelog bundle-amend cli command](https://docs-v3-preview.elastic.dev/elastic/docs-builder/pull/5113/cli/changelog/bundle-amend) for creating amends and [changelog note cli command](https://docs-v3-preview.elastic.dev/elastic/docs-builder/pull/5113/cli/changelog/note) for notes.
<note>
  `--require` counts only entry files. A PR that adds only a note or an amend still needs an entry file that references the PR when the check requires one.
</note>


## Notes and amends need the skip label

The command validates every note and amend file that a PR touches, whatever labels the PR carries. A skip label never turns that validation off.
A PR whose changed files are only notes or numbered amends (at least one, and no other file) changes the release notes through those files, but it should not also get an entry of its own. That PR needs one of the skip labels that `rules.create.exclude` in `changelog.yml` configures. Without one, the command reports this error:
```text
This PR only adds notes or amends. To keep it out of the release notes as a change of its own, add one of these labels: `changelog:skip`.
```

The message lists every configured skip label. A type label such as `feature` does not satisfy the rule. The error shows in the PR comment like any other validation error. The rule applies to the full list of changed files, whether it comes from the GitHub API or from `--files`. From the API, a removed file and the old path of a renamed file are classified too: a PR that removes or renames something other than a note or a numbered amend is not a notes-only PR, and renaming a note still needs the label. Without `--pr-labels`, the command reads the labels of the PR from GitHub for this rule. It does not apply to a PR that adds an entry file or changes any other file, and it reports nothing when `changelog.yml` configures no skip label, because the PR could not meet it.

## Examples

```sh
# Local: everything inferred
docs-builder changelog validate 4009

# Local: also assert an entry file references this PR
docs-builder changelog validate 4009 --require

# Local: validate a specific file without a GitHub token
docs-builder changelog validate 4009 --files docs/changelog/4009.yaml

# CI: explicit owner/repo/labels (git remote not available in the runner)
docs-builder changelog validate "$PR_NUMBER" \
  --config "$CONFIG" \
  --owner "$REPO_OWNER" \
  --repo "$REPO_NAME" \
  --pr-labels "$PR_LABELS"
```