Skip to content

Commit 9d30104

Browse files
committed
New attempt to streamline downstream merges.
1 parent f6863e9 commit 9d30104

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

src/PostSharp.Engineering.BuildTools/ContinuousIntegration/GitHubHelper.cs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,13 @@
66
using Octokit.GraphQL.Model;
77
using PostSharp.Engineering.BuildTools.Build;
88
using PostSharp.Engineering.BuildTools.Utilities;
9+
using System;
910
using System.Collections.Generic;
11+
using System.Diagnostics;
1012
using System.Diagnostics.CodeAnalysis;
1113
using System.Linq;
1214
using System.Text;
15+
using System.Threading;
1316
using System.Threading.Tasks;
1417
using Connection = Octokit.GraphQL.Connection;
1518
using Environment = System.Environment;
@@ -181,7 +184,17 @@ bool TryConnectRestApis( [NotNullWhen( true )] out GitHubClient? creatorClient,
181184

182185
return default;
183186
}
184-
187+
188+
// Wait until the mergeability is known.
189+
var waitStatusStopwatch = Stopwatch.StartNew();
190+
191+
while ( pullRequest.Mergeable == null && waitStatusStopwatch.Elapsed < TimeSpan.FromMinutes( 1 ) )
192+
{
193+
console.WriteMessage( $"Waiting until we know whether the PR is mergeable (waited {waitStatusStopwatch.Elapsed} so far)." );
194+
Thread.Sleep( 200 );
195+
pullRequest = await creatorGitHub.PullRequest.Get( repository.Owner, repository.Name, pullRequest.Number );
196+
}
197+
185198
// Check status checks (if any required)
186199
if ( pullRequest.Mergeable == true )
187200
{

0 commit comments

Comments
 (0)