Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update PRs with VS information when inserted. #1177

Open
JoeRobich opened this issue Mar 4, 2022 · 0 comments
Open

Update PRs with VS information when inserted. #1177

JoeRobich opened this issue Mar 4, 2022 · 0 comments

Comments

@JoeRobich
Copy link
Member

JoeRobich commented Mar 4, 2022

We can create an Azure pipeline that is triggered when the VS repo is updated. This pipeline can look for updates to our inserted components in the latest merge. If we detect that we have inserted updated components, we can take the current build and previous inserted build to get a range of commits from the repo that was inserted. We can then determine the PRs that were merged and can post comments to them that the change has inserted into VS.

Possible ways to trigger:

  1. We can trigger off merges into the VS repo
  2. We can trigger off successful VS builds

How to determine PRs to update:

  1. Get the current component build #
  2. Get the previous component build # from git
  3. Locate those builds with AzDO apis
    private static async Task<Build> GetSpecificComponentBuildAsync(BuildVersion version, CancellationToken cancellationToken)
  4. Get the Git commits between builds
    internal static async Task<(List<GitCommit> changes, string diffLink)> GetChangesBetweenBuildsAsync(Build fromBuild, Build tobuild, CancellationToken cancellationToken)
  5. Use our merge PR log heuristics to find the PRs
    if (oldBuild.Repository.Type == "GitHub" || !string.IsNullOrEmpty(Options.ComponentGitHubRepoName))
    {
    AppendGitHubChangesToDescription(changes, hardLimit, description, repoId);
    }
    else if (oldBuild.Repository.Type == "TfsGit")
    {
    AppendAzDOChangesToDescription(oldBuild, changes, hardLimit, description);
    }
  6. Post comments to PRs
    Task<HttpResponseMessage> PostComment(string prNumber, string comment)
    {
    // https://developer.github.com/v3/pulls/comments/#create-a-comment
    var body = JsonConvert.SerializeObject(new { body = comment });
    return _client.PostAsyncAsJson($"repos/{repoOwner}/{repoName}/issues/{prNumber}/comments", body);
    }

What information do we want to add to PRs?

  • Link to VS insertion PR
  • If we trigger off VS build we could include minimum VS version for the change
  • more??

Potentially this one pipeline could work for many teams if we develop a suitable config. Configuration may need to include Team Name, Component Name, Build Pipeline, Repo Url, additional information...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant