mirror of
https://github.com/peakoss/anti-slop
synced 2026-12-01 13:39:13 +08:00
feat(input): add maxChangedFiles and maxChangedLines options
This commit is contained in:
4 files changed
+25
No files matched your search
+10
@@ -39,6 +39,16 @@ inputs:
|
||||
main
|
||||
master
|
||||
|
||||
# PR Size Checks
|
||||
max-changed-files:
|
||||
description: Maximum number of changed files allowed in the PR. 0 disables this check.
|
||||
required: false
|
||||
default: "50"
|
||||
max-changed-lines:
|
||||
description: Maximum number of changed lines (additions + deletions) allowed in the PR. 0 disables this check.
|
||||
required: false
|
||||
default: "10000"
|
||||
|
||||
# PR Quality Checks
|
||||
max-negative-reactions:
|
||||
description: Maximum number of negative reactions (thumbs down + confused) allowed on the PR. 0 disables this check.
|
||||
|
||||
@@ -12,6 +12,10 @@ export const Input = {
|
||||
AllowedSourceBranches: "allowed-source-branches",
|
||||
BlockedSourceBranches: "blocked-source-branches",
|
||||
|
||||
// PR Size Checks
|
||||
MaxChangedFiles: "max-changed-files",
|
||||
MaxChangedLines: "max-changed-lines",
|
||||
|
||||
// PR Quality Checks
|
||||
MaxNegativeReactions: "max-negative-reactions",
|
||||
RequireMaintainerCanModify: "require-maintainer-can-modify",
|
||||
|
||||
@@ -34,6 +34,10 @@ export function getSettings(): Settings {
|
||||
allowedSourceBranches: core.getMultilineInput(Input.AllowedSourceBranches),
|
||||
blockedSourceBranches: core.getMultilineInput(Input.BlockedSourceBranches),
|
||||
|
||||
// PR Size Checks
|
||||
maxChangedFiles: parseInt(core.getInput(Input.MaxChangedFiles)),
|
||||
maxChangedLines: parseInt(core.getInput(Input.MaxChangedLines)),
|
||||
|
||||
// PR Quality Checks
|
||||
maxNegativeReactions: parseInt(core.getInput(Input.MaxNegativeReactions)),
|
||||
requireMaintainerCanModify: core.getBooleanInput(Input.RequireMaintainerCanModify),
|
||||
@@ -154,6 +158,9 @@ function validateNumber(value: number, name: string, min: number, max: number):
|
||||
function validateSettings(settings: Settings): void {
|
||||
validateNumber(settings.maxFailures, "max-failures", 1, 25);
|
||||
|
||||
validateNumber(settings.maxChangedFiles, "max-changed-files", 0, 500);
|
||||
validateNumber(settings.maxChangedLines, "max-changed-lines", 0, 100000);
|
||||
|
||||
validateNumber(settings.maxNegativeReactions, "max-negative-reactions", 0, 200);
|
||||
validateNumber(settings.maxDescriptionLength, "max-description-length", 0, 50000);
|
||||
validateNumber(settings.maxEmojiCount, "max-emoji-count", 0, 30);
|
||||
|
||||
@@ -11,6 +11,10 @@ export interface Settings {
|
||||
allowedSourceBranches: string[];
|
||||
blockedSourceBranches: string[];
|
||||
|
||||
// PR Size Checks
|
||||
maxChangedFiles: number;
|
||||
maxChangedLines: number;
|
||||
|
||||
// PR Quality Checks
|
||||
maxNegativeReactions: number;
|
||||
requireMaintainerCanModify: boolean;
|
||||
|
||||
Reference in new issue
Block a user