Interface ICopilotReviewHelper
- Namespace
- Invex.RepoUtils.Atom.Module.Helpers
- Assembly
- Invex.RepoUtils.Atom.Module.dll
Provides functionality for waiting until GitHub Copilot has finished reviewing a pull request. GitHub does not currently expose a native way to block auto-merge on a Copilot review, so this helper polls the pull request's review state until Copilot's review has landed (or a timeout elapses).
public interface ICopilotReviewHelper : IBuildAccessor
- Inherited Members
-
IBuildAccessor.GetService<T>()IBuildAccessor.GetServices<T>()IBuildAccessor.GetParam<T>(Expression<Func<T>>, T, Func<string, T>)IBuildAccessor.ServicesIBuildAccessor.LoggerIBuildAccessor.RootedFileSystemIBuildAccessor.ProcessRunner
Fields
DefaultCopilotReviewerLogin
The default login of the GitHub Copilot pull request reviewer bot.
public const string DefaultCopilotReviewerLogin = "Copilot"
Field Value
- string
Methods
WaitForCopilotReviewToComplete(int, string, string, TimeSpan, TimeSpan, CancellationToken)
Polls the supplied pull request until GitHub Copilot has finished reviewing it.
Task<bool> WaitForCopilotReviewToComplete(int pullRequestNumber, string githubToken, string copilotReviewerLogin, TimeSpan timeout, TimeSpan pollInterval, CancellationToken cancellationToken)
Parameters
pullRequestNumberintThe number of the pull request to wait on.
githubTokenstringThe GitHub token used to authenticate the GraphQL requests.
copilotReviewerLoginstringThe login of the Copilot reviewer bot to match against.
timeoutTimeSpanThe maximum amount of time to wait for Copilot to finish reviewing.
pollIntervalTimeSpanThe delay between successive polls of the pull request state.
cancellationTokenCancellationTokenA token used to cancel the operation.
Returns
- Task<bool>
true when Copilot has finished reviewing the pull request; false when Copilot was never requested as a reviewer and therefore there was nothing to wait for.
Remarks
While Copilot is reviewing it remains a pending review request on the pull request. Once it is done it is removed from the pending review requests and a review authored by the Copilot bot appears. The method therefore considers the review complete when Copilot is no longer pending and a review from it exists.
Exceptions
- StepFailedException
Thrown when Copilot does not finish reviewing within
timeout.