mirror of
https://github.com/github/awesome-copilot.git
synced 2026-08-01 23:12:29 +00:00
Harden external plugin PR quality gate rendering and name validation (#2444)
* Harden external plugin PR quality gates Reference: https://github.com/github/awesome-copilot/pull/2398 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: a79923be-c65f-4d51-8fe3-a86e05fd02f1 * Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> * Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Copilot-Session: a79923be-c65f-4d51-8fe3-a86e05fd02f1
This commit is contained in:
@@ -60,12 +60,20 @@ function validatePluginName(name, prefix, errors) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (name.length > 50) {
|
||||
errors.push(`${prefix}: "name" must be 50 characters or fewer`);
|
||||
if (name.length > 64) {
|
||||
errors.push(`${prefix}: "name" must be 64 characters or fewer`);
|
||||
}
|
||||
|
||||
if (!/^[a-z0-9-]+$/.test(name)) {
|
||||
errors.push(`${prefix}: "name" must contain only lowercase letters, numbers, and hyphens`);
|
||||
if (!/^[a-z0-9.-]+$/.test(name)) {
|
||||
errors.push(`${prefix}: "name" must contain only lowercase letters, numbers, hyphens, and periods`);
|
||||
}
|
||||
|
||||
if (!/^[a-z0-9].*[a-z0-9]$/.test(name) && !/^[a-z0-9]$/.test(name)) {
|
||||
errors.push(`${prefix}: "name" must start and end with a lowercase letter or number`);
|
||||
}
|
||||
|
||||
if (name.includes("--") || name.includes("..")) {
|
||||
errors.push(`${prefix}: "name" must not contain consecutive hyphens or periods`);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user