File tree Expand file tree Collapse file tree 3 files changed +12
-11
lines changed
Expand file tree Collapse file tree 3 files changed +12
-11
lines changed Original file line number Diff line number Diff line change 1+ import { execSync } from "child_process" ;
12import Z from "zod" ;
23
34const defaultMessage = "feat: update translations via @lingodotdev" ;
@@ -23,7 +24,13 @@ export abstract class PlatformKit<PlatformConfig extends BasePlatformConfig = Ba
2324
2425 abstract buildPullRequestUrl ( pullRequestNumber : number ) : string ;
2526
26- gitConfig ( ) : Promise < void > | void { }
27+ gitConfig ( token ?: string , repoUrl ?: string ) {
28+ if ( token && repoUrl ) {
29+ execSync ( `git remote set-url origin ${ repoUrl } ` , {
30+ stdio : "inherit" ,
31+ } ) ;
32+ }
33+ }
2734
2835 get config ( ) {
2936 const env = Z . object ( {
Original file line number Diff line number Diff line change @@ -2,8 +2,6 @@ import { Octokit } from "octokit";
22import { PlatformKit } from "./_base.js" ;
33import Z from "zod" ;
44
5- import { execSync } from "child_process" ;
6-
75export class GitHubPlatformKit extends PlatformKit {
86 private _octokit ?: Octokit ;
97
@@ -79,9 +77,7 @@ export class GitHubPlatformKit extends PlatformKit {
7977
8078 const url = `https://${ ghToken } @github.com/${ repositoryOwner } /${ repositoryName } .git` ;
8179
82- execSync ( `git remote set-url origin ${ url } ` , {
83- stdio : "inherit" ,
84- } ) ;
80+ super . gitConfig ( ghToken , url ) ;
8581 }
8682 }
8783
Original file line number Diff line number Diff line change 11import { Gitlab } from "@gitbeaker/rest" ;
22import Z from "zod" ;
33import { PlatformKit } from "./_base.js" ;
4- import { execSync } from "child_process" ;
54
65const gl = new Gitlab ( { token : "" } ) ;
76
@@ -91,11 +90,10 @@ export class GitlabPlatformKit extends PlatformKit {
9190 }
9291
9392 gitConfig ( ) : Promise < void > | void {
94- const url = `https://oauth2:${ this . platformConfig . glToken } @gitlab.com/${ this . platformConfig . repositoryOwner } /${ this . platformConfig . repositoryName } .git` ;
93+ const glToken = this . platformConfig . glToken ;
94+ const url = `https://oauth2:${ glToken } @gitlab.com/${ this . platformConfig . repositoryOwner } /${ this . platformConfig . repositoryName } .git` ;
9595
96- execSync ( `git remote set-url origin ${ url } ` , {
97- stdio : "inherit" ,
98- } ) ;
96+ super . gitConfig ( glToken , url ) ;
9997 }
10098
10199 buildPullRequestUrl ( pullRequestNumber : number ) : string {
You can’t perform that action at this time.
0 commit comments