Skip to content

Commit 76ae9ac

Browse files
committed
fix(community): reject trailing hyphen in GitHub handles
1 parent 0e8ee86 commit 76ae9ac

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

community/_ci/project_rules.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
ALLOWED_FIELDS = set(REQUIRED_FIELDS)
1010
MAX_DESCRIPTION_LENGTH = 250
1111

12-
# GitHub usernames/orgs: alphanumeric and hyphens, no leading hyphen, max 39 chars.
13-
_GITHUB_HANDLE_RE = re.compile(r"^[A-Za-z0-9](?:[A-Za-z0-9-]{0,38})$")
12+
# GitHub usernames/orgs: alphanumeric and hyphens, no leading/trailing hyphen, max 39 chars.
13+
_GITHUB_HANDLE_RE = re.compile(r"^[A-Za-z0-9](?:[A-Za-z0-9-]{0,37}[A-Za-z0-9])?$")
1414

1515

1616
def load_projects(path: Path) -> tuple[list, list[str]]:

community/_ci/tests/test_project_rules.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def test_repo_must_be_http_url():
3232

3333

3434
def test_author_must_be_bare_github_handle():
35-
for bad in ("@jane-doe", "https://github.com/jane-doe", "jane doe"):
35+
for bad in ("@jane-doe", "https://github.com/jane-doe", "jane doe", "jane-", "-jane"):
3636
errors = validate_project(make_project(author=bad), 0)
3737
assert any("'author'" in e for e in errors), bad
3838

0 commit comments

Comments
 (0)