feature: add only-draft-pr option to only process draft pull requests#1314
Open
katbyte wants to merge 3 commits intoactions:mainfrom
Open
feature: add only-draft-pr option to only process draft pull requests#1314katbyte wants to merge 3 commits intoactions:mainfrom
only-draft-pr option to only process draft pull requests#1314katbyte wants to merge 3 commits intoactions:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
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
onlyDraftPrflag to the processor options, wiring it throughaction.yml, argument parsing, and the runtimeIssuesProcessor. - Adds an
OnlyDraftPullRequesthelper that skips non-draft PRs whenonly-draft-pris enabled, and integrates it into the processing flow after the existing draft exemption logic. - Updates documentation and tests (including a dedicated
only-draft-prspec) plus the compileddistand 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.
11 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description:
Adds a new
only-draft-proption that is the inverse of the existingexempt-draft-proption.When
only-draft-pr: trueis 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: