Skip to content

feature: add only-draft-pr option to only process draft pull requests#1314

Open
katbyte wants to merge 3 commits intoactions:mainfrom
katbyte:kt/only-draft-prs
Open

feature: add only-draft-pr option to only process draft pull requests#1314
katbyte wants to merge 3 commits intoactions:mainfrom
katbyte:kt/only-draft-prs

Conversation

@katbyte
Copy link

@katbyte katbyte commented Jan 29, 2026

Description:

Adds a new only-draft-pr option that is the inverse of the existing exempt-draft-pr option.

When only-draft-pr: true is set, the action will only process draft pull requests and skip non-draft PRs. This is useful for workflows that want to apply stale handling specifically to draft PRs (e.g., to remind contributors to finish or close abandoned drafts).

Related issue:
closes #1162

Check list:

  • Mark if documentation changes are required.
  • [x ] Mark if tests were added or updated to cover the changes.

Copilot AI review requested due to automatic review settings January 29, 2026 22:17
@katbyte katbyte requested a review from a team as a code owner January 29, 2026 22:17
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new only-draft-pr option so the stale action can target only draft pull requests, complementing the existing exempt-draft-pr option.

Changes:

  • Introduces the onlyDraftPr flag to the processor options, wiring it through action.yml, argument parsing, and the runtime IssuesProcessor.
  • Adds an OnlyDraftPullRequest helper that skips non-draft PRs when only-draft-pr is enabled, and integrates it into the processing flow after the existing draft exemption logic.
  • Updates documentation and tests (including a dedicated only-draft-pr spec) plus the compiled dist and lockfile to reflect the new option.

Reviewed changes

Copilot reviewed 10 out of 12 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/main.ts Adds onlyDraftPr to the parsed action inputs so the processor receives the new option.
src/interfaces/issues-processor-options.ts Extends IIssuesProcessorOptions with a boolean onlyDraftPr flag.
src/enums/option.ts Adds OnlyDraftPr enum value for consistent option name handling and logging.
src/classes/only-draft-pull-request.ts Implements the OnlyDraftPullRequest helper that skips non-draft PRs when onlyDraftPr is true, logging the decision.
src/classes/issues-processor.ts Hooks OnlyDraftPullRequest into the processing pipeline after ExemptDraftPullRequest, ending processing early for non-draft PRs when configured.
src/classes/issue.spec.ts Updates the test options fixture to include the new onlyDraftPr property.
package-lock.json Regenerates the lockfile, removing several "peer": true markers according to the current npm lockfile format.
dist/index.js Updates the compiled bundle to include the new option, helper class, and processing logic.
action.yml Exposes the only-draft-pr input with default false and a short description.
tests/only-draft-pr.spec.ts Adds tests verifying that non-draft PRs are skipped and draft PRs are processed when only-draft-pr is enabled, and that behavior is unchanged when it is disabled.
tests/constants/default-processor-options.ts Extends test defaults with onlyDraftPr: false to mirror runtime defaults.
README.md Documents the only-draft-pr option in the inputs table and options section, describing its behavior as the inverse of exempt-draft-pr.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

Feature request: Close draft PRs only

1 participant