mirror of
https://github.com/peakoss/anti-slop
synced 2026-12-01 13:39:13 +08:00
feat(inputs): add 4 new settings to the action inputs
This commit is contained in:
4 files changed
+45
No files matched your search
+20
@@ -43,6 +43,16 @@ inputs:
|
|||||||
main
|
main
|
||||||
master
|
master
|
||||||
|
|
||||||
|
# PR Quality Checks
|
||||||
|
max-negative-reactions:
|
||||||
|
description: Maximum number of negative reactions (thumbs down + confused) allowed on the PR. 0 disables this check.
|
||||||
|
required: false
|
||||||
|
default: "0"
|
||||||
|
require-maintainer-can-modify:
|
||||||
|
description: Require the PR to allow maintainers to push to the source branch.
|
||||||
|
required: false
|
||||||
|
default: "true"
|
||||||
|
|
||||||
# PR Title Checks
|
# PR Title Checks
|
||||||
require-conventional-title:
|
require-conventional-title:
|
||||||
description: 'Require PR titles to follow Conventional Commits format (e.g. "feat:", "fix:", "feat(scope):").'
|
description: 'Require PR titles to follow Conventional Commits format (e.g. "feat:", "fix:", "feat(scope):").'
|
||||||
@@ -124,6 +134,10 @@ inputs:
|
|||||||
description: Minimum merged/closed PR ratio across all GitHub repositories (1-100%). 0 disables this check.
|
description: Minimum merged/closed PR ratio across all GitHub repositories (1-100%). 0 disables this check.
|
||||||
required: false
|
required: false
|
||||||
default: "30"
|
default: "30"
|
||||||
|
global-merge-ratio-exclude-own:
|
||||||
|
description: Exclude PRs to the author's own repositories from the global merge ratio calculation.
|
||||||
|
required: false
|
||||||
|
default: "false"
|
||||||
min-account-age:
|
min-account-age:
|
||||||
description: Minimum GitHub account age in days (1-365). 0 disables this check.
|
description: Minimum GitHub account age in days (1-365). 0 disables this check.
|
||||||
required: false
|
required: false
|
||||||
@@ -235,6 +249,12 @@ inputs:
|
|||||||
required: false
|
required: false
|
||||||
default: "false"
|
default: "false"
|
||||||
|
|
||||||
|
# PR Success Actions
|
||||||
|
success-add-pr-labels:
|
||||||
|
description: Comma-separated list of labels to add to the PR on success.
|
||||||
|
required: false
|
||||||
|
default: ""
|
||||||
|
|
||||||
# PR Failure Actions
|
# PR Failure Actions
|
||||||
failure-pr-message:
|
failure-pr-message:
|
||||||
description: Comment posted on the PR when the maximum number of failures is reached. Empty posts no comment.
|
description: Comment posted on the PR when the maximum number of failures is reached. Empty posts no comment.
|
||||||
|
|||||||
@@ -13,6 +13,10 @@ export enum Input {
|
|||||||
AllowedSourceBranches = "allowed-source-branches",
|
AllowedSourceBranches = "allowed-source-branches",
|
||||||
BlockedSourceBranches = "blocked-source-branches",
|
BlockedSourceBranches = "blocked-source-branches",
|
||||||
|
|
||||||
|
// PR Quality Checks
|
||||||
|
MaxNegativeReactions = "max-negative-reactions",
|
||||||
|
RequireMaintainerCanModify = "require-maintainer-can-modify",
|
||||||
|
|
||||||
// PR Title Checks
|
// PR Title Checks
|
||||||
RequireConventionalTitle = "require-conventional-title",
|
RequireConventionalTitle = "require-conventional-title",
|
||||||
|
|
||||||
@@ -39,6 +43,7 @@ export enum Input {
|
|||||||
MinRepoMergedPrs = "min-repo-merged-prs",
|
MinRepoMergedPrs = "min-repo-merged-prs",
|
||||||
MinRepoMergeRatio = "min-repo-merge-ratio",
|
MinRepoMergeRatio = "min-repo-merge-ratio",
|
||||||
MinGlobalMergeRatio = "min-global-merge-ratio",
|
MinGlobalMergeRatio = "min-global-merge-ratio",
|
||||||
|
GlobalMergeRatioExcludeOwn = "global-merge-ratio-exclude-own",
|
||||||
MinAccountAge = "min-account-age",
|
MinAccountAge = "min-account-age",
|
||||||
|
|
||||||
// Filters
|
// Filters
|
||||||
@@ -71,6 +76,9 @@ export enum Input {
|
|||||||
LockPr = "lock-pr",
|
LockPr = "lock-pr",
|
||||||
DeleteBranch = "delete-branch",
|
DeleteBranch = "delete-branch",
|
||||||
|
|
||||||
|
// PR Success Actions
|
||||||
|
SuccessAddPrLabels = "success-add-pr-labels",
|
||||||
|
|
||||||
// PR Failure Actions
|
// PR Failure Actions
|
||||||
FailurePrMessage = "failure-pr-message",
|
FailurePrMessage = "failure-pr-message",
|
||||||
FailureRemovePrLabels = "failure-remove-pr-labels",
|
FailureRemovePrLabels = "failure-remove-pr-labels",
|
||||||
|
|||||||
@@ -35,6 +35,10 @@ export function getSettings(): Settings {
|
|||||||
allowedSourceBranches: core.getMultilineInput(Input.AllowedSourceBranches),
|
allowedSourceBranches: core.getMultilineInput(Input.AllowedSourceBranches),
|
||||||
blockedSourceBranches: core.getMultilineInput(Input.BlockedSourceBranches),
|
blockedSourceBranches: core.getMultilineInput(Input.BlockedSourceBranches),
|
||||||
|
|
||||||
|
// PR Quality Checks
|
||||||
|
maxNegativeReactions: parseInt(core.getInput(Input.MaxNegativeReactions)),
|
||||||
|
requireMaintainerCanModify: core.getBooleanInput(Input.RequireMaintainerCanModify),
|
||||||
|
|
||||||
// PR Title Checks
|
// PR Title Checks
|
||||||
requireConventionalTitle: core.getBooleanInput(Input.RequireConventionalTitle),
|
requireConventionalTitle: core.getBooleanInput(Input.RequireConventionalTitle),
|
||||||
|
|
||||||
@@ -61,6 +65,7 @@ export function getSettings(): Settings {
|
|||||||
minRepoMergedPrs: parseInt(core.getInput(Input.MinRepoMergedPrs)),
|
minRepoMergedPrs: parseInt(core.getInput(Input.MinRepoMergedPrs)),
|
||||||
minRepoMergeRatio: parseInt(core.getInput(Input.MinRepoMergeRatio)),
|
minRepoMergeRatio: parseInt(core.getInput(Input.MinRepoMergeRatio)),
|
||||||
minGlobalMergeRatio: parseInt(core.getInput(Input.MinGlobalMergeRatio)),
|
minGlobalMergeRatio: parseInt(core.getInput(Input.MinGlobalMergeRatio)),
|
||||||
|
globalMergeRatioExcludeOwn: core.getBooleanInput(Input.GlobalMergeRatioExcludeOwn),
|
||||||
minAccountAge: parseInt(core.getInput(Input.MinAccountAge)),
|
minAccountAge: parseInt(core.getInput(Input.MinAccountAge)),
|
||||||
|
|
||||||
// Filters
|
// Filters
|
||||||
@@ -93,6 +98,9 @@ export function getSettings(): Settings {
|
|||||||
lockPr: core.getBooleanInput(Input.LockPr),
|
lockPr: core.getBooleanInput(Input.LockPr),
|
||||||
deleteBranch: core.getBooleanInput(Input.DeleteBranch),
|
deleteBranch: core.getBooleanInput(Input.DeleteBranch),
|
||||||
|
|
||||||
|
// PR Success Actions
|
||||||
|
successAddPrLabels: parseList(core.getInput(Input.SuccessAddPrLabels)),
|
||||||
|
|
||||||
// PR Failure Actions
|
// PR Failure Actions
|
||||||
failurePrMessage: core.getInput(Input.FailurePrMessage),
|
failurePrMessage: core.getInput(Input.FailurePrMessage),
|
||||||
failureRemovePrLabels: parseList(core.getInput(Input.FailureRemovePrLabels)),
|
failureRemovePrLabels: parseList(core.getInput(Input.FailureRemovePrLabels)),
|
||||||
@@ -131,6 +139,7 @@ function validateNumber(value: number, name: string, min: number, max: number):
|
|||||||
|
|
||||||
function validateSettings(settings: Settings): void {
|
function validateSettings(settings: Settings): void {
|
||||||
validateNumber(settings.maxFailures, "max-failures", 1, 30);
|
validateNumber(settings.maxFailures, "max-failures", 1, 30);
|
||||||
|
validateNumber(settings.maxNegativeReactions, "max-negative-reactions", 0, 500);
|
||||||
validateNumber(settings.maxDescriptionLength, "max-description-length", 0, 100000);
|
validateNumber(settings.maxDescriptionLength, "max-description-length", 0, 100000);
|
||||||
validateNumber(settings.maxEmojiCount, "max-emoji-count", 0, 50);
|
validateNumber(settings.maxEmojiCount, "max-emoji-count", 0, 50);
|
||||||
validateNumber(settings.minRepoMergedPrs, "min-repo-merged-prs", 0, 20);
|
validateNumber(settings.minRepoMergedPrs, "min-repo-merged-prs", 0, 20);
|
||||||
|
|||||||
@@ -12,6 +12,10 @@ export interface Settings {
|
|||||||
allowedSourceBranches: string[];
|
allowedSourceBranches: string[];
|
||||||
blockedSourceBranches: string[];
|
blockedSourceBranches: string[];
|
||||||
|
|
||||||
|
// PR Quality Checks
|
||||||
|
maxNegativeReactions: number;
|
||||||
|
requireMaintainerCanModify: boolean;
|
||||||
|
|
||||||
// PR Title Checks
|
// PR Title Checks
|
||||||
requireConventionalTitle: boolean;
|
requireConventionalTitle: boolean;
|
||||||
|
|
||||||
@@ -38,6 +42,7 @@ export interface Settings {
|
|||||||
minRepoMergedPrs: number;
|
minRepoMergedPrs: number;
|
||||||
minRepoMergeRatio: number;
|
minRepoMergeRatio: number;
|
||||||
minGlobalMergeRatio: number;
|
minGlobalMergeRatio: number;
|
||||||
|
globalMergeRatioExcludeOwn: boolean;
|
||||||
minAccountAge: number;
|
minAccountAge: number;
|
||||||
|
|
||||||
// Filters
|
// Filters
|
||||||
@@ -70,6 +75,9 @@ export interface Settings {
|
|||||||
lockPr: boolean;
|
lockPr: boolean;
|
||||||
deleteBranch: boolean;
|
deleteBranch: boolean;
|
||||||
|
|
||||||
|
// PR Success Actions
|
||||||
|
successAddPrLabels: string[];
|
||||||
|
|
||||||
// PR Failure Actions
|
// PR Failure Actions
|
||||||
failurePrMessage: string;
|
failurePrMessage: string;
|
||||||
failureRemovePrLabels: string[];
|
failureRemovePrLabels: string[];
|
||||||
|
|||||||
Reference in new issue
Block a user