File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -40,6 +40,20 @@ const createTravisEnvVar = async ({
40
40
} )
41
41
}
42
42
43
+ interface TravisUser {
44
+ id : number
45
+ login : string
46
+ name : string
47
+ github_id : number
48
+ avatar_url : string
49
+ education : boolean
50
+ is_syncing : boolean
51
+ synced_at : string
52
+ }
53
+
54
+ const getCurrentTravisUser = async ( { travisClient } : { travisClient : TravisClient } ) : Promise < TravisUser > =>
55
+ ( await travisClient . get ( 'user' ) ) . body
56
+
43
57
export async function initTravis ( {
44
58
hasTests,
45
59
repoName,
@@ -98,6 +112,14 @@ export async function initTravis({
98
112
await writeFile ( '.travis.yml' , yaml . dump ( travisYaml ) )
99
113
}
100
114
115
+ const travisUser = await getCurrentTravisUser ( { travisClient } )
116
+ console . log ( 'Triggering Travis sync of repositories' )
117
+ await travisClient . post ( `user/${ travisUser . id } /sync` )
118
+ while ( ( await getCurrentTravisUser ( { travisClient } ) ) . is_syncing ) {
119
+ console . log ( 'Waiting for sync to finish...' )
120
+ await new Promise ( resolve => setTimeout ( resolve , 1000 ) )
121
+ }
122
+
101
123
console . log ( `Activating repository at https://travis-ci.org/sourcegraph/${ repoName } ` )
102
124
await travisClient . post ( `/repo/sourcegraph%2F${ repoName } /activate` )
103
125
You can’t perform that action at this time.
0 commit comments