@@ -93,18 +93,81 @@ export async function run(conf) {
9393 }
9494 const branch = conf . github . branch || "gh-pages" ;
9595 const issueBase = new URL ( "./issues/" , ghURL ) . href ;
96- const commitHistoryURL = new URL (
97- `./commits/${ conf . github . branch ?? "" } ` ,
98- ghURL . href
99- ) ;
96+
97+ // Allow custom pullsURL and commitHistoryURL for monorepo scenarios
98+ let pullsURL ;
99+ if (
100+ typeof conf . github === "object" &&
101+ conf . github . hasOwnProperty ( "pullsURL" )
102+ ) {
103+ pullsURL = conf . github . pullsURL ;
104+ } else {
105+ pullsURL = new URL ( "./pulls/" , ghURL ) . href ;
106+ }
107+
108+ // Validate pullsURL if it's provided
109+ if ( pullsURL ) {
110+ try {
111+ const pullsURLObj = new URL ( pullsURL ) ;
112+ if ( pullsURLObj . origin !== "https://github.com" ) {
113+ const msg = docLink `${ "[github.pullsURL]" } must be HTTPS and pointing to GitHub. (${ pullsURL } ).` ;
114+ rejectGithubPromise ( msg ) ;
115+ return ;
116+ }
117+ if ( ! pullsURLObj . pathname . includes ( "/pulls" ) ) {
118+ const msg = docLink `${ "[github.pullsURL]" } must point to pull requests. (${ pullsURL } ).` ;
119+ rejectGithubPromise ( msg ) ;
120+ return ;
121+ }
122+ } catch {
123+ const msg = docLink `${ "[github.pullsURL]" } is not a valid URL. (${ pullsURL } ).` ;
124+ rejectGithubPromise ( msg ) ;
125+ return ;
126+ }
127+ }
128+
129+ let commitHistoryURL ;
130+ if (
131+ typeof conf . github === "object" &&
132+ conf . github . hasOwnProperty ( "commitHistoryURL" )
133+ ) {
134+ commitHistoryURL = conf . github . commitHistoryURL ;
135+ } else {
136+ commitHistoryURL = new URL (
137+ `./commits/${ conf . github . branch ?? "" } ` ,
138+ ghURL . href
139+ ) . href ;
140+ }
141+
142+ // Validate commitHistoryURL if it's provided
143+ if ( commitHistoryURL ) {
144+ try {
145+ const commitURLObj = new URL ( commitHistoryURL ) ;
146+ if ( commitURLObj . origin !== "https://github.com" ) {
147+ const msg = docLink `${ "[github.commitHistoryURL]" } must be HTTPS and pointing to GitHub. (${ commitHistoryURL } ).` ;
148+ rejectGithubPromise ( msg ) ;
149+ return ;
150+ }
151+ if ( ! commitURLObj . pathname . includes ( "/commits" ) ) {
152+ const msg = docLink `${ "[github.commitHistoryURL]" } must point to commits. (${ commitHistoryURL } ).` ;
153+ rejectGithubPromise ( msg ) ;
154+ return ;
155+ }
156+ } catch {
157+ const msg = docLink `${ "[github.commitHistoryURL]" } is not a valid URL. (${ commitHistoryURL } ).` ;
158+ rejectGithubPromise ( msg ) ;
159+ return ;
160+ }
161+ }
162+
100163 const newProps = {
101164 edDraftURI : `https://${ org . toLowerCase ( ) } .github.io/${ repo } /` ,
102165 githubToken : undefined ,
103166 githubUser : undefined ,
104167 issueBase,
105168 atRiskBase : issueBase ,
106169 otherLinks : [ ] ,
107- pullBase : new URL ( "./pulls/" , ghURL ) . href ,
170+ pullBase : pullsURL ,
108171 shortName : repo ,
109172 } ;
110173 // Assign new properties, but retain existing ones
@@ -133,11 +196,11 @@ export async function run(conf) {
133196 } ,
134197 {
135198 value : l10n . commit_history ,
136- href : commitHistoryURL . href ,
199+ href : commitHistoryURL ,
137200 } ,
138201 {
139202 value : "Pull requests" ,
140- href : newProps . pullBase ,
203+ href : pullsURL ,
141204 } ,
142205 ] ,
143206 } ;
@@ -152,9 +215,9 @@ export async function run(conf) {
152215 apiBase : githubAPI ,
153216 fullName : `${ org } /${ repo } ` ,
154217 issuesURL : issueBase ,
155- pullsURL : newProps . pullBase ,
218+ pullsURL,
156219 newIssuesURL : new URL ( "./new/choose" , issueBase ) . href ,
157- commitHistoryURL : commitHistoryURL . href ,
220+ commitHistoryURL,
158221 } ;
159222 resolveGithubPromise ( normalizedGHObj ) ;
160223
0 commit comments