Skip to content

feat: add config-driven check-pr validation - #1706

Merged
jetersen merged 10 commits into
cleanup/root-typesfrom
actions/check-pr-title
Aug 27, 2026
Merged

jetersen merged 10 commits into
cleanup/root-typesfrom
actions/check-pr-title

Conversation

@jetersen

@jetersen jetersen commented Aug 3, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Add a read-only Node 24 check-pr Action that validates the current pull request with the normal Release Drafter configuration.
  • Keep validation in @release-drafter/core instead of creating another package.
  • Add release-drafter check-pr <repository> <number> so the CLI uses the same policy.
  • Add a forge-neutral PullRequestReader contract and implement it for GitHub.
  • Add check-pr/action.yml and generate its inputs through the Action metadata tooling from feat: move GitHub Actions into workspace #1705.

Validation behavior

  • Conditions with conventional validate the title.
  • Conditions with configured labels validate the current labels.
  • A condition that contains both requires both to match.
  • Path predicates do not take part in this check. Autolabeler remains responsible for path-based labeling.
  • Pull requests excluded by title or label pre-categories pass as skipped.
  • Pull requests that select no category, or only an unconditional fallback, fail.

The Action reads the title, labels, and base branch from the pull request event. It does not fetch changed files or modify the pull request, so its example workflow needs only contents: read.

The CLI fetches one pull request, loads configuration from its base branch, and returns 0 for valid or skipped, 1 for invalid, and 2 for command or runtime errors.

Dependency changes

No new package or external runtime dependency. Gitea, Forgejo, and GitLab readers follow in #1707 and #1708.

Validation

  • npm run ci
  • npm run check:clean
  • Action, CLI, configuration inheritance, title, label, exclusion, fallback, metadata, and bundle tests passed.

Stack

Stacked on #1720. Alternate forge readers follow in #1707 and #1708.

Closes #1695.

Review size

  • Reviewable changes: +1,152 -45 across 39 files
  • Generated artifacts: +1,725 -1,567 across 5 files

GitHub's headline total includes both rows. .gitattributes marks generated artifacts and collapses their diffs by default.

@jetersen

Copy link
Copy Markdown
Member Author

@cchanche this is currently only a github action but I wonder if we should introduce it in CLI or support the different forge adapters.

So something like this:

  @release-drafter/core
  └── configuration, category primitives, normalized PR types

  @release-drafter/check-pr-title
  ├── title-validation policy
  ├── PullRequestReader port
  └── forge-neutral validation orchestration

  Forge adapters
  └── implement single PR/MR retrieval

  @release-drafter/gh-actions
  └── current GitHub event → validator

  @release-drafter/cli
  └── selected forge and PRs → validator

@cchanche

cchanche commented Aug 20, 2026 •

Copy link
Copy Markdown
Collaborator

Yeah this sounds good to me.

selected forge and PRs → validator

current GitHub event → validator

Would validator be something like

import {PRTitleValidator} from @release-drafter/check-pr-title

...

const isValid = PRTitleValidator.validate(title)

... ?

Also, I like to think about changes in a more generic way (instead of simple PRs). Maybe this could be a higher level validator for any type of change. We'd omit a body and a footer for PR titles, and include them (sometimes) for commits. On top of doing the PR categorization stuff, we would prepare for whenever we want to implement commits into what we consider as possible changes.

@jetersen

Copy link
Copy Markdown
Member Author

Well ya thinking about it we could prepare it for semantic commit and semantic pr title support 👍

@cchanche

Copy link
Copy Markdown
Collaborator

but then about the gh-action side of things, it would only make sense for the PR-titles I guess. So maybe two pacakges then ? One for the actual action @release-drafter/check-pr-title, and one for the lib @release-drafter/change-validator ? Or maybe @release-drafter/change-validator's content should simply be in @release-drafter/core

@jetersen
jetersen force-pushed the actions/check-pr-title branch from 8749767 to 734d52b Compare August 21, 2026 07:33
@jetersen

Copy link
Copy Markdown
Member Author

I think change-validator could live in core cause cli, gh-actions/check-pr-title and forge adapters may need pr fetching title support

@jetersen
jetersen force-pushed the actions/check-pr-title branch 2 times, most recently from 0af10d4 to 4580d84 Compare August 22, 2026 09:53
@jetersen
jetersen force-pushed the actions/check-pr-title branch from 4580d84 to fdb71b5 Compare August 22, 2026 14:42
@jetersen
jetersen changed the base branch from actions/gh-actions-workspace to cleanup/root-types August 22, 2026 14:47
@jetersen jetersen changed the title feat: add config-driven PR title action feat: add config-driven check-pr validation Aug 22, 2026
@jetersen

Copy link
Copy Markdown
Member Author

Updated the stack around the design discussed here:

The Action uses the GitHub event payload directly, so it remains small and needs no forge request or separate package.

@jetersen
jetersen force-pushed the actions/check-pr-title branch 2 times, most recently from eb5670f to 3afaeaa Compare August 22, 2026 15:13
@jetersen
jetersen force-pushed the actions/check-pr-title branch from 3afaeaa to 7a03e87 Compare August 22, 2026 15:14
@jetersen
jetersen force-pushed the actions/check-pr-title branch 2 times, most recently from 0728393 to dde81c5 Compare August 22, 2026 15:43
@jetersen
jetersen force-pushed the actions/check-pr-title branch from dde81c5 to f9472b0 Compare August 22, 2026 15:57
@jetersen
jetersen force-pushed the actions/check-pr-title branch from f9472b0 to 9e68ab6 Compare August 22, 2026 16:51
@jetersen
jetersen force-pushed the actions/check-pr-title branch from 9e68ab6 to 388f287 Compare August 22, 2026 16:58
@jetersen
jetersen force-pushed the actions/check-pr-title branch 2 times, most recently from 737494d to 557fd89 Compare August 22, 2026 21:41
@jetersen
jetersen force-pushed the actions/check-pr-title branch from 557fd89 to 22a1d5f Compare August 22, 2026 22:02
@jetersen
jetersen force-pushed the actions/check-pr-title branch from 22a1d5f to 59a7176 Compare August 22, 2026 22:36
@jetersen
jetersen force-pushed the actions/check-pr-title branch from 59a7176 to a9b995a Compare August 22, 2026 22:57
@jetersen
jetersen merged commit 5fd49fb into main Aug 27, 2026
5 of 7 checks passed
@jetersen
jetersen deleted the actions/check-pr-title branch August 27, 2026 07:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Actions: consolidate drafter, autolabeler, and check-pr-title entrypoints

2 participants