@@ -441,7 +441,7 @@ export class GitHubRepository extends Disposable {
441
441
Logger . debug ( 'Fetch pull request templates - done' , this . id ) ;
442
442
return result . data . repository . pullRequestTemplates . map ( template => template . body ) ;
443
443
} catch ( e ) {
444
- Logger . error ( `Fetching pull request templates failed: ${ e } ` , this . id ) ;
444
+ // The template was not found.
445
445
}
446
446
}
447
447
@@ -837,6 +837,24 @@ export class GitHubRepository extends Disposable {
837
837
owner : remote . owner ,
838
838
repo : remote . repositoryName ,
839
839
} ) ;
840
+ Logger . debug ( `Fork repository - done` , this . id ) ;
841
+ // GitHub can say the fork succeeded but it isn't actually ready yet.
842
+ // So we wait up to 5 seconds for the fork to be ready
843
+ const start = Date . now ( ) ;
844
+ let exists = async ( ) => {
845
+ try {
846
+ await octokit . call ( octokit . api . repos . get , { owner : result . data . owner . login , repo : result . data . name } ) ;
847
+ Logger . appendLine ( 'Fork ready' , this . id ) ;
848
+ return true ;
849
+ } catch ( e ) {
850
+ Logger . appendLine ( 'Fork not ready yet' , this . id ) ;
851
+ return false ;
852
+ }
853
+ } ;
854
+ while ( ! ( await exists ( ) ) && ( ( Date . now ( ) - start ) < 5000 ) ) {
855
+ await new Promise ( resolve => setTimeout ( resolve , 500 ) ) ;
856
+ }
857
+
840
858
return result . data . clone_url ;
841
859
} catch ( e ) {
842
860
Logger . error ( `GitHubRepository> Forking repository failed: ${ e } ` , this . id ) ;
0 commit comments