@@ -18,6 +18,7 @@ import { readFileSync, writeFileSync } from "fs";
1818import { homedir } from "os" ;
1919import { join , resolve } from "path" ;
2020import { DECLINED_EMAILS , JUDGE_EMAILS } from "../lib/hackathon-event-signup" ;
21+ import { parseGithubLogin } from "./_lib/parse-github-login" ;
2122
2223const REPO_OWNER = "rogerSuperBuilderAlpha" ;
2324const REPO_NAME = "cursor-boston" ;
@@ -38,10 +39,6 @@ const GITHUB_LOGIN_CORRECTIONS: Record<string, string> = {
3839 dannygarciadev : "DannyGarciaDEV" ,
3940} ;
4041
41- const INVALID_LOGIN_TOKENS = new Set ( [
42- "" , "n" , "no" , "none" , "na" , "n/a" , "-" , "." , "unknown" ,
43- ] ) ;
44-
4542type CsvRow = Record < string , string > ;
4643
4744function parseCsv ( content : string ) : CsvRow [ ] {
@@ -73,30 +70,6 @@ function parseCsv(content: string): CsvRow[] {
7370 } ) ;
7471}
7572
76- function parseGithubLogin ( raw : string ) : string | null {
77- if ( ! raw ) return null ;
78- let s = raw . trim ( ) ;
79- const lower = s . toLowerCase ( ) ;
80- if ( lower . startsWith ( "http://" ) || lower . startsWith ( "https://" ) ) {
81- try {
82- const u = new URL ( s ) ;
83- if ( ! u . hostname . includes ( "github.com" ) ) return null ;
84- const parts = u . pathname . split ( "/" ) . filter ( Boolean ) ;
85- if ( parts . length === 0 ) return null ;
86- s = parts [ 0 ] ! ;
87- } catch { return null ; }
88- } else if ( lower . includes ( "github.com" ) ) {
89- const idx = lower . indexOf ( "github.com" ) ;
90- const rest = s . slice ( idx + "github.com" . length ) . replace ( / ^ [ / : ] + / , "" ) ;
91- const parts = rest . split ( "/" ) . filter ( Boolean ) ;
92- if ( parts . length === 0 ) return null ;
93- s = parts [ 0 ] ! ;
94- }
95- s = s . replace ( / ^ @ + / , "" ) ;
96- if ( INVALID_LOGIN_TOKENS . has ( s . toLowerCase ( ) ) || s . length < 2 ) return null ;
97- return s ;
98- }
99-
10073function resolveGithubLogin ( lumaLogin : string ) : string {
10174 const corrected = GITHUB_LOGIN_CORRECTIONS [ lumaLogin . toLowerCase ( ) ] ;
10275 return corrected ?? lumaLogin ;
0 commit comments