@@ -46,6 +46,15 @@ const BASIC_FILE_CONTENTS = {
4646 log,
4747} ;
4848
49+ /**
50+ * GitHub can sometimes inconsistently return data from the GraphQL API
51+ * when querying for tree objects.
52+ *
53+ * This function is a workaround to wait for GitHub to be ready
54+ * before running the assertions.
55+ */
56+ const waitForGitHubToBeReady = ( ) => new Promise ( ( r ) => setTimeout ( r , 1000 ) ) ;
57+
4958// const TEST_TARGET_TREE_WITH_BASIC_CHANGES =
5059// "a3431c9b42b71115c52bc6fbf9da3682cf0ed5e8";
5160
@@ -169,6 +178,8 @@ describe("node", () => {
169178 log,
170179 } ) ;
171180
181+ await waitForGitHubToBeReady ( ) ;
182+
172183 await expectBranchHasTree ( {
173184 branch,
174185 // TODO: re-enable
@@ -196,6 +207,8 @@ describe("node", () => {
196207 ...BASIC_FILE_CONTENTS ,
197208 } ) ;
198209
210+ await waitForGitHubToBeReady ( ) ;
211+
199212 // Don't test tree for this one as it will change over time / be unstable
200213 await expectBranchHasTree ( {
201214 branch,
@@ -220,6 +233,8 @@ describe("node", () => {
220233 ...BASIC_FILE_CONTENTS ,
221234 } ) ;
222235
236+ await waitForGitHubToBeReady ( ) ;
237+
223238 // Don't test tree for this one as it will change over time / be unstable
224239 await expectBranchHasTree ( {
225240 branch,
@@ -244,6 +259,8 @@ describe("node", () => {
244259 ...BASIC_FILE_CONTENTS ,
245260 } ) ;
246261
262+ await waitForGitHubToBeReady ( ) ;
263+
247264 await expectBranchHasTree ( {
248265 branch,
249266 // TODO: re-enable
@@ -280,6 +297,8 @@ describe("node", () => {
280297 force : true ,
281298 } ) ;
282299
300+ await waitForGitHubToBeReady ( ) ;
301+
283302 await expectBranchHasTree ( {
284303 branch,
285304 // TODO: re-enable
@@ -304,6 +323,8 @@ describe("node", () => {
304323 } ,
305324 } ) ;
306325
326+ await waitForGitHubToBeReady ( ) ;
327+
307328 expect ( ( ) =>
308329 commitFilesFromBuffers ( {
309330 octokit,
@@ -337,6 +358,8 @@ describe("node", () => {
337358 } ,
338359 } ) ;
339360
361+ await waitForGitHubToBeReady ( ) ;
362+
340363 await commitFilesFromBuffers ( {
341364 octokit,
342365 ...REPO ,
@@ -347,6 +370,8 @@ describe("node", () => {
347370 ...BASIC_FILE_CONTENTS ,
348371 } ) ;
349372
373+ await waitForGitHubToBeReady ( ) ;
374+
350375 await expectBranchHasTree ( {
351376 branch,
352377 // TODO: re-enable
@@ -371,6 +396,8 @@ describe("node", () => {
371396 } ,
372397 } ) ;
373398
399+ await waitForGitHubToBeReady ( ) ;
400+
374401 await commitFilesFromBuffers ( {
375402 octokit,
376403 ...REPO ,
@@ -381,6 +408,8 @@ describe("node", () => {
381408 ...BASIC_FILE_CONTENTS ,
382409 } ) ;
383410
411+ await waitForGitHubToBeReady ( ) ;
412+
384413 await expectBranchHasTree ( {
385414 branch,
386415 // TODO: re-enable
@@ -414,6 +443,8 @@ describe("node", () => {
414443 message : input ,
415444 } ) ;
416445
446+ await waitForGitHubToBeReady ( ) ;
447+
417448 const ref = (
418449 await getRefTreeQuery ( octokit , {
419450 ...REPO ,
0 commit comments