mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-12 21:53:00 -06:00
refactor: consolidate coercion ownership (#122692)
* refactor: consolidate coercion ownership * test: align shard check with weighted planning * chore: refresh plugin SDK API baseline
This commit is contained in:
committed by
GitHub
parent
7c58151445
commit
c23d66e3b5
@@ -12,6 +12,7 @@ import {
|
||||
createIssueMutationHelpers,
|
||||
guardTrustedActorCandidates,
|
||||
isCommentNewerThan,
|
||||
normalizeGuardLoginSet,
|
||||
readBoundedGitHubErrorText,
|
||||
readBoundedGitHubJson,
|
||||
} from "./guard-shared.mjs";
|
||||
@@ -264,21 +265,11 @@ export function isDependencyGuardTrustedForHead(comment, currentHeadSha) {
|
||||
}
|
||||
|
||||
export function securityApproverSet(value) {
|
||||
return new Set(
|
||||
String(value ?? "")
|
||||
.split(/[\s,]+/u)
|
||||
.map((login) => login.trim().toLowerCase())
|
||||
.filter(Boolean),
|
||||
);
|
||||
return normalizeGuardLoginSet(value);
|
||||
}
|
||||
|
||||
export function dependencyGuardCommentAuthors(value) {
|
||||
return new Set(
|
||||
String(value ?? "github-actions[bot]")
|
||||
.split(/[\s,]+/u)
|
||||
.map((login) => login.trim().toLowerCase())
|
||||
.filter(Boolean),
|
||||
);
|
||||
return normalizeGuardLoginSet(value, "github-actions[bot]");
|
||||
}
|
||||
|
||||
export function isDependencyGuardMarkerComment(comment, marker, trustedAuthors) {
|
||||
|
||||
@@ -8,6 +8,19 @@ export const GITHUB_API_REQUEST_TIMEOUT_MS = 30_000;
|
||||
const githubApiRetryStatuses = new Set([502, 503, 504]);
|
||||
const githubApiRetryDelaysMs = [1_000, 2_000, 4_000];
|
||||
|
||||
/**
|
||||
* @param {string | null | undefined} value
|
||||
* @param {string} [fallback]
|
||||
*/
|
||||
export function normalizeGuardLoginSet(value, fallback = "") {
|
||||
return new Set(
|
||||
(value ?? fallback)
|
||||
.split(/[\s,]+/u)
|
||||
.map((login) => login.trim().toLowerCase())
|
||||
.filter(Boolean),
|
||||
);
|
||||
}
|
||||
|
||||
export function guardTrustedActorCandidates({ pullRequest, event, currentHeadSha }) {
|
||||
const eventHeadSha = event?.pull_request?.head?.sha;
|
||||
const eventAfterSha = event?.after;
|
||||
|
||||
@@ -13,6 +13,7 @@ import {
|
||||
guardCommentHeadSha,
|
||||
guardTrustedActorCandidates,
|
||||
isCommentNewerThan,
|
||||
normalizeGuardLoginSet,
|
||||
readBoundedGitHubErrorText,
|
||||
readBoundedGitHubJson,
|
||||
} from "./guard-shared.mjs";
|
||||
@@ -170,21 +171,11 @@ export function isSecuritySensitiveGuardTrustedForHead(comment, currentHeadSha)
|
||||
}
|
||||
|
||||
export function securityApproverSet(value) {
|
||||
return new Set(
|
||||
String(value ?? "")
|
||||
.split(/[\s,]+/u)
|
||||
.map((login) => login.trim().toLowerCase())
|
||||
.filter(Boolean),
|
||||
);
|
||||
return normalizeGuardLoginSet(value);
|
||||
}
|
||||
|
||||
export function securitySensitiveGuardCommentAuthors(value) {
|
||||
return new Set(
|
||||
String(value ?? "github-actions[bot]")
|
||||
.split(/[\s,]+/u)
|
||||
.map((login) => login.trim().toLowerCase())
|
||||
.filter(Boolean),
|
||||
);
|
||||
return normalizeGuardLoginSet(value, "github-actions[bot]");
|
||||
}
|
||||
|
||||
export function isSecuritySensitiveGuardMarkerComment(comment, trustedAuthors) {
|
||||
|
||||
Reference in New Issue
Block a user