diff --git a/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Azure.Sdk.Tools.GitHubEventProcessor.Tests.csproj b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Azure.Sdk.Tools.GitHubEventProcessor.Tests.csproj new file mode 100644 index 00000000000..c04befa7c13 --- /dev/null +++ b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Azure.Sdk.Tools.GitHubEventProcessor.Tests.csproj @@ -0,0 +1,34 @@ + + + + net6.0 + disable + enable + + false + + + + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + + + + + + + + + + PreserveNewest + + + PreserveNewest + + + + diff --git a/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/MockGitHubEventClient.cs b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/MockGitHubEventClient.cs new file mode 100644 index 00000000000..ecd22498043 --- /dev/null +++ b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/MockGitHubEventClient.cs @@ -0,0 +1,459 @@ +using System; +using System.Collections.Generic; +using System.Data; +using System.Linq; +using System.Reflection; +using System.Security.AccessControl; +using System.Text; +using System.Threading.Channels; +using System.Threading.Tasks; +using Azure.Sdk.Tools.GitHubEventProcessor; +using Azure.Sdk.Tools.GitHubEventProcessor.Constants; +using Azure.Sdk.Tools.GitHubEventProcessor.GitHubPayload; +using Azure.Sdk.Tools.GitHubEventProcessor.Utils; +using Octokit; + +namespace Azure.Sdk.Tools.GitHubEventProcessor.Tests +{ + public class MockGitHubEventClient: GitHubEventClient + { + /// + /// IsCollaborator return value. Defaults to false. + /// + public bool IsCollaboratorReturn { get; set; } = false; + + /// + /// DoesUserHavePermissions return value. Defaults to false. + /// + public bool UserHasPermissionsReturn { get; set; } = false; + + /// + /// IsUserMemberOfOrg value. Defaults to false. + /// + public bool IsUserMemberOfOrgReturn { get; set; } = false; + + public List PullRequestReviews { get; set; } = new List(); + public List PullRequestFiles { get; set; } = new List(); + + public List AILabelServiceReturn { get; set; } = new List(); + + public SearchIssuesResult SearchIssuesResultReturn { get; set; } = new SearchIssuesResult(); + + public MockGitHubEventClient(string productHeaderName, string? rulesConfigLocation = null) : + base(productHeaderName, rulesConfigLocation) + { + + } + + /// + /// The mock ProcessPendingUpdates should just return the number of updates + /// + /// + /// + /// integer,the number of pending updates that would be processed + public override Task ProcessPendingUpdates(long repositoryId, int issueOrPullRequestNumber = 0) + { + int numUpdates = 0; + if (_issueUpdate != null) + { + Console.WriteLine("MockGitHubEventClient::ProcessPendingUpdates, Issue Update is non-null"); + numUpdates++; + } + else + { + Console.WriteLine("MockGitHubEventClient::ProcessPendingUpdates, Issue Update is null"); + } + Console.WriteLine($"MockGitHubEventClient::ProcessPendingUpdates, number of pending comments = {_gitHubComments.Count}"); + numUpdates += _gitHubComments.Count; + + Console.WriteLine($"MockGitHubEventClient::ProcessPendingUpdates, number of pending dismissals = {_gitHubReviewDismissals.Count}"); + numUpdates += _gitHubReviewDismissals.Count; + + Console.WriteLine($"MockGitHubEventClient::ProcessPendingUpdates, number of pending IssueUpdates = {_gitHubIssuesToUpdate.Count}"); + numUpdates += _gitHubIssuesToUpdate.Count; + + Console.WriteLine($"MockGitHubEventClient::ProcessPendingUpdates, number of issues to Lock = {_gitHubIssuesToLock.Count}"); + numUpdates += _gitHubIssuesToLock.Count; + + return Task.FromResult(numUpdates); + } + + /// + /// IsUserCollaborator override. Returns IsCollaboratorReturn value + /// + /// The Id of the repository + /// The User.Login for the event object from the action payload + /// bool, returns the IsCollaboratorReturn set for testing + public override Task IsUserCollaborator(long repositoryId, string user) + { + return Task.FromResult(IsCollaboratorReturn); + } + + /// + /// IsUserMemberOfOrg override. Returns IsUserMemberOfOrgReturn value + /// + /// The organization name. + /// The User.Login for the event object from the action payload + /// bool, returns IsUserMemberOfOrgReturn set for testing + public override Task IsUserMemberOfOrg(string orgName, string user) + { + return Task.FromResult(IsUserMemberOfOrgReturn); + } + + + /// + /// DoesUserHavePermissions override. Returns UserHasPermissionsReturn value + /// + /// The Id of the repository + /// The User.Login for the event object from the action payload + /// The list of permissions to check for. + /// bool, returns UserHasPermissionsReturn for testing + public override Task DoesUserHavePermissions(long repositoryId, string user, List permissionList) + { + return Task.FromResult(UserHasPermissionsReturn); + } + + /// + /// Mock call that will return a SearchIssuesResult for testing purposes + /// + /// SearchIssuesRequest objected which contains the search criteria. + /// OctoKit.SearchIssuesResult + public override async Task QueryIssues(SearchIssuesRequest searchIssuesRequest) + { + return await Task.FromResult(SearchIssuesResultReturn); + } + + /// + /// Create a bunch of fake issues for QueryIssues to return. + /// + /// The number of results to create. + public void CreateSearchIssuesResult(int numResults, Repository repository, ItemState itemState) + { + // Empty issues should be okay for the QueryResult. The scheduled events + // never look at the returned issues because everything returned already + // matches the search criteria. They only thing the rules are doing is + // modifying the issues returned. + List issues = new List(); + for(int iCounter=0;iCounter labels, User assignee, IReadOnlyList assignees, Milestone milestone, int comments, PullRequest pullRequest, DateTimeOffset? closedAt, DateTimeOffset createdAt, DateTimeOffset? updatedAt, int id, string nodeId, bool locked, Repository repository, ReactionSummary reactions, LockReason? activeLockReason) + Issue issue = new Issue( + "url", + "htmlUrl", + "commentsUrl", + "eventsUrl", + iCounter, + itemState, + $"title {iCounter}", + $"body {iCounter}", + null, + user, + null, + null, + null, + null, + 0, + null, + null, + DateTimeOffset.UtcNow, + null, + iCounter+100, + "", + false, + repository, + null, + null, + null + ); + issues.Add(issue); + } + IReadOnlyList readOnlyIssues = issues; + SearchIssuesResult searchIssuesResult = new SearchIssuesResult(numResults, false, readOnlyIssues); + SearchIssuesResultReturn = searchIssuesResult; + } + + /// + /// Mock function to get all the reviews for a given pull request. + /// + /// The Id of the repository + /// The pull request number + /// IReadOnlyList of PullRequestReview + public override Task> GetReviewsForPullRequest(long repositoryId, int pullRequestNumber) + { + // The return value needs to be an IReadOnlyList and calling PullRequestReviews.AsReadOnly returns + // a ReadOnlyCollection, not an IReadOnlyList + IReadOnlyList readOnlyList = PullRequestReviews; + return Task.FromResult(readOnlyList); + } + + /// + /// Create fake pull request reviews to return from GetReviewsForPullRequest. The pieces of the + /// PullRequestReview that matter for processing are: + /// 1. PullRequestReview.State == PullRequestReviewState.Approved, only approved pull requests are dismissed, + /// all other states are ignored. + /// 2. PullRequestReview.User.Login, for the dismiss message + /// 3. PullRequestReview.Id which is the Id of the review, itself, and is necessary for the dismissal. + /// + /// + /// + public void CreateFakeReviewsForPullRequest(int numApproved, int numNotApproved) + { + // Since we're using FakeUser1..N in the json payloads, start the FakeUsers for reviews at 100 + int fakeUserNumber = 100; + + for (int iCounter = 0;iCounter + /// Convenience to create fake users. Unfortunately, this is necessary becaue Octokit's classes have public getters + /// and private setters. This means everything needs to be passed into the constructor. + /// + /// This will become string that'll be the User.Login + /// Octokit.User + internal User CreateFakeUser(string fakeLogin) + { + DateTimeOffset dateTimeOffset= DateTimeOffset.Now; + User fakeUser = new User( + // string avatarUrl, + "https://avatars.githubusercontent.com/u/13556087?v=4", + // string bio, + null, + // string blog, + null, + // int collaborators, + 0, + // string company, + null, + // DateTimeOffset createdAt, + dateTimeOffset, + // DateTimeOffset updatedAt, + dateTimeOffset, + // int diskUsage, + 0, + // string email, + $"{fakeLogin}@fake.com", + // int followers, + 0, + // int following, + 0, + // bool? hireable, + null, + // string htmlUrl, + $"https://github.com/{fakeLogin}", + // int totalPrivateRepos, + 0, + // int id, + 12345, + // string location, + null, + // string login, + fakeLogin, + // string name, + fakeLogin, + // string nodeId, + null, + // int ownedPrivateRepos, + 0, + // Plan plan, + null, + // int privateGists, + 0, + // int publicGists, + 0, + // int publicRepos, + 0, + // string url, + null, + // RepositoryPermissions permissions, + null, + // bool siteAdmin, + false, + // string ldapDistinguishedName, + null, + // DateTimeOffset? suspendedAt + null + ); + + return fakeUser; + } + + /// + /// Convenience to create fake PullRequestReviews. Unfortunately, this is necessary becaue Octokit's classes have public + /// getters and private setters. This means everything needs to be passed into the constructor. + /// + /// fake Octokit.User, created using CreateFakeUser + /// Octokit.PullRequestReviewState, the state of the review + /// Fake prReviewId, it'll match the number of the fakeUser{number} + /// Octkit.PullRequestReview + internal PullRequestReview CreateFakeReview(User fakeUser, PullRequestReviewState prReviewState, long prReviewId) + { + PullRequestReview prReview = new PullRequestReview( + // long id, + prReviewId, + // string nodeId, + null, + // string commitId, + null, + // User user, + fakeUser, + // string body, + null, + // string htmlUrl, + null, + // string pullRequestUrl, + null, + // PullRequestReviewState state, + prReviewState, + // AuthorAssociation authorAssociation, + AuthorAssociation.Collaborator, + // DateTimeOffset submittedAt + DateTimeOffset.Now + ); + return prReview; + } + + public override Task> GetFilesForPullRequest(long repositoryId, int pullRequestNumber) + { + // The return value needs to be an IReadOnlyList and calling PullRequestFiles.AsReadOnly returns + // a ReadOnlyCollection, not an IReadOnlyList + IReadOnlyList readOnlyList = PullRequestFiles; + return Task.FromResult(readOnlyList); + } + + public void CreateFakePullRequestFiles(List prFiles) + { + foreach (string file in prFiles) + { + // The only thing we actually care about here is the fileName (includes path) + // PullRequestFile(string sha, string fileName, string status, int additions, int deletions, int changes, string blobUrl, string rawUrl, string contentsUrl, string patch, string previousFileName) + PullRequestFile prFile = new PullRequestFile( + //string sha, + "", + //string fileName, + file, + //string status, + "", + //int additions, + 0, + //int deletions, + 0, + //int changes, + 0, + //string blobUrl, + "", + //string rawUrl, + "", + //string contentsUrl, + "", + //string patch, + "", + //string previousFileName + "" + ); + PullRequestFiles.Add(prFile); + } + } + + // The GitHubClient, for testing purposes, should not be set. It's not going to be authenticating + // or calling GitHub as part of the mock. + public override GitHubClient? CreateClientWithGitHubEnvToken(string productHeaderName) + { + return null; + } + + /// + /// For testing purposes, if the rulesConfigLocation is null then create a rulesConfiguration with + /// all rules defaulting to RuleState.On, otherwise load the rulesConfiguration from the location. + /// + /// Rules configuration location + /// RulesConfiguration + public override RulesConfiguration LoadRulesConfiguration(string? rulesConfigLocation = null) + { + RulesConfiguration? rulesConfiguration = null; + if (rulesConfigLocation != null) + { + rulesConfiguration = new RulesConfiguration(rulesConfigLocation); + } + else + { + rulesConfiguration = new RulesConfiguration(); + rulesConfiguration.CreateDefaultConfig(RuleState.On); + } + return rulesConfiguration; + } + + // The mock won't be calling the actual service and since the method it's overriding is + // async, the warning needs to be disabled. +#pragma warning disable CS1998 // Async method lacks 'await' operators and will run synchronously + public override async Task> QueryAILabelService(IssueEventGitHubPayload issueEventPayload) +#pragma warning restore CS1998 // Async method lacks 'await' operators and will run synchronously + { + return AILabelServiceReturn; + } + + /// + /// Convenience function for testing to get the list of comment updates + /// + /// List of GitHubComment + public List GetComments() + { + return _gitHubComments; + } + + /// + /// Convenience function for testing to get the list of dismissals + /// + /// List of GitHubReviewDismissal + public List GetReviewDismissals() + { + return _gitHubReviewDismissals; + } + + /// + /// Convenience function for testing, get the issue update stored on the GitHubEventClient, rather + /// than creating one from the issue or pull request payload + /// + /// Octokit.net IssueUpdate + public IssueUpdate GetIssueUpdate() + { + return _issueUpdate; + } + + /// + /// Convenience function for testing, get the list of GitHub issues to update. For normal action + /// processing this list won't be used as actions make changes to a common IssueUpdate. For scheduled, + /// or cron, tasks, those will potentially end up updating multiple, differnt issues. + /// + /// List of GitHubIssueToUpdate + public List GetGitHubIssuesToUpdate() + { + return _gitHubIssuesToUpdate; + } + + /// + /// Convenience function for testing, get the list of GitHub issues to update. For normal action + /// processing this list won't be used as actions make changes to a common IssueUpdate. For scheduled, + /// or cron, tasks, those will potentially end up updating multiple, differnt issues. + /// + /// List of GitHubIssueToUpdate + public List GetGitHubIssuesToLock() + { + return _gitHubIssuesToLock; + } + } +} diff --git a/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/ProcessingTestBase.cs b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/ProcessingTestBase.cs new file mode 100644 index 00000000000..6ba238c5d8d --- /dev/null +++ b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/ProcessingTestBase.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Azure.Sdk.Tools.GitHubEventProcessor.Constants; +using NUnit.Framework; +using Octokit.Internal; + +namespace Azure.Sdk.Tools.GitHubEventProcessor.Tests +{ + /// + /// Testing base class. Each static test is going to be using Octokit's SimpleJsonSerializer to deserialize + /// the json payload. + /// + public class ProcessingTestBase + { + // SimpleJsonSerializer is OctoKit's serializer used for deserializing GitHub action payloads + SimpleJsonSerializer _serializer = new SimpleJsonSerializer(); + + public SimpleJsonSerializer SimpleJsonSerializer + { + get => _serializer; + } + } +} diff --git a/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/README.md b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/README.md new file mode 100644 index 00000000000..d44f9fce815 --- /dev/null +++ b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/README.md @@ -0,0 +1,95 @@ +# GitHub Event Processor Tests + +NUnit test project for GitHubEventProcessor. It contains a suite of static tests used to test the individual rules that can be run within Visual Studio. + +## Why are there only automated Static tests and no automated Live tests? + +1. Actions requires something happening with an Issue, Pull_Request, Pull_Request_Review or Comment that's done through through the UI. Creating or modifying things authenticated using a token is not going to cause other events to fire. For example, adding a label to an issue, will not cause an **Issues Labeled** event to fire off. +2. Actions are repository specific. Even if we could do automated live testing, it would only able to be done a repository setup specifically for it which would not be the same repository that's building, packaging and releasing the tools package. +3. Rule specific reasons. There are rule specific reasons that would also make this challenging. For example, we have a rules that look for issues or pull_requests that haven't had activity for 7/14/60/90 days and those can't be created on the fly and as soon as one is modified by rules process, that activity counter resets. +4. Live testing really only ends up testing the GitHub API. Calling to get permissions for a user, checking a user's org, updating an Issue or Pull_Request, or adding a comment, none of these are really going to test anything related to the rules themselves that couldn't be tested with a static payload and mocked calls. + +## Static Testing and NUnit + +The individual action and scheduled event functions are tested using NUnit and static payloads. The tests are all located in the [Static](./Static/) subdirectory and their GitHub Event Payloads are located in the [Tests.JsonEventPayloads](./Tests.JsonEventPayloads/) subdirectory. Like the event processing code, the tests are divided up by the events that trigger particular workflows and each rule has its own test function. For example, all of the Pull Request processing tests are located in [PullRequestProcessingTests.cs](./Static/PullRequestCommentProcessingTests.cs). + +Each rule has at least two tests. The first test should ensure nothing happens if the rule is turned off. The second, and any subsequent tests, run with the rule turned on. These verify that things process as expected given a payload that contains the correct action and criteria for the event. For example, **Pull Request Triage** is rule that processes on a *pull request* event's *opened* action if there the pull request is created with no labels. The processing in the rule will add labels based upon file paths in the PR and will create a comment if the user who opened the PR does not have write or admin collaborator permissions. The permission check, along with anything else that requires a call to GitHub, are mocked for static tests. There are three tests for this particular rule, with the last two scenarios checking behavior with and without admin permissions. While this rule does not, some rules can require multiple payloads to test. + +### Generating the static payloads + +In order to run actions the following need to be setup: + +1. The repository settings need to enable actions. *This can be done on a fork.* +2. A workflow yml file needs to be in the .github/workflows directory with the appropriate event and action to test. The following example just sets up to output the event payload **issue_comment** event's **created** action and just echos out the event payload. +3. After the yml file has been checked in, whatever setup required for the payload being generated needs to be done. In this example an issue comment needs to be created. The issue, itself, could be one that already exists but, if not, it would need to be created first. Other events might require more involved setup depending on the event, action and criteria of the rule. + +The yml below was put into a file named issue-comment-handler.yml and checked into the .github/workflows directory of the [azure-sdk/github-event-processor-test](https://github.com/azure-sdk/github-event-processor-test) repository. + +```yml +name: Issue Comment Event Handler +on: + issue_comment: + types: [created] +jobs: + event-handler: + name: Handle ${{ github.event_name }} ${{ github.event.action }} event + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Echo event payload + run: | + echo $GITHUB_PAYLOAD + shell: bash + env: + GITHUB_PAYLOAD: ${{ toJson(github.event) }} +``` + +Once the workflow yml file has been checked into the repository or branch a comment created on an Issue or Pull Request will cause the event to fire. Select Actions in the repository which bring up all the Actions for a given repository. Over on the left, is the list of Workflows and the name, in the yml, should be one of them. Selecting that workflow will only show actions for that particular workflow. + +![image](./documentation/images/action_event.png) + +Select action event to look at the details for its workflow run. + +![image](./documentation/images/action_event_details.png) + +The workflow run will show all of the steps from setup, execution and cleanup. The one that matters is the **Echo event payload** which is the name of step that is outputting the payload. + +![image](./documentation/images/event_payload.png) + +The payload in between the begin/end tags and is usually several hundred lines long. Copy this and save it a file. At this point it's almost ready to be used for static testing, it just needs to be sanitized. + +#### Sanitizing the static payloads + +User and repository names should not be in the static payload files and sanitizing them requires a few, easy, global replacements. + +- replace: azure-sdk/github-event-processor-test +- with: Azure/azure-sdk-fake + +- replace: Actual user name(s) +- with: FakeUser1 ..FakeUserN + +- replace: github-event-processor-test (there's always one "name" field in the repository section that has "github-event-processor-test" and not full name "azure-sdk/github-event-processor-test") +- with: azure-sdk-fake + +#### Scheduled event tests only require a single static payload + +Scheduled events differ from Action events in that the payload is vastly simpler. They really only contains the repository information necessary to search issues in GitHub and this information isn't required for the Scheduled event static tests. + +### Static tests use a mock GitHubEventClient + +The GitHubEventClient is a singleton used by workflow processing and any/all external calls are made through this class as well as calls to load rules configuration and CODEOWNERS files. The [MockGitHubEventClient](./MockGitHubEventClient.cs) overrides all of these calls, setting return values used for testing, or loading files crafted to help test certain scenarios in the case of CODEOWNERS. It's also used to expose things, for testing purposes, that aren't exposed in the GitHubEventClient. For example, the lists of items created by Scheduled events aren't exposed in GitHubEventClient because they don't to be. + +## Live Testing + +[azure-sdk/github-event-processor-test](https://github.com/azure-sdk/github-event-processor-test) is a repository which was specifically setup for testing purposes and can be used to generate static payloads. The .github\workflow contains the [config and workflow yml files](../YmlAndConfigFiles/) which, aside from different config files, the final version of the workflow files. Every Action rule can be setup through creation and modification of issues and pull requests within the repository and every action has been tested this way. Scheduled events are a little different to test live because constraints dealing with time. Every scheduled event has "last modified X days ago" as part of its criteria ranging from 7 to 90 days which isn't something that can be created on the fly. + +### Other requirements of the test repository + +- Actions are turned on +- Every Azure SDK repository has a set of common labels that are used in rules automation. Those have already been created in this repository. The full list can be found in [LabelConstants.cs](../Azure.Sdk.Tools.GitHubEventProcessor/Constants/LabelConstants.cs) in the main project. +- Several testing SDK/ServiceDirectories with simplistic contents for creating PRs +- CODEOWNERS file that's been simplified for testing and tailored to the testing SDK/ServiceDirectories in the repository. + +### Live testing using the installed package vs live testing building from source + +The default in the workflow yml files is to install the github-event-processor from the [feed](https://dev.azure.com/azure-sdk/public/_artifacts/feed/azure-sdk-for-net/NuGet/Azure.Sdk.Tools.GitHubEventProcessor) which is produced from the Azure/azure-sdk-tools repository, where the source code lives. When doing active development, it's beneficial to be able to test changes live in the repository. Both workflow yml files have been setup to flip between running the installed package from the feed or building and installing the github-event-processor from Azure/azure-sdk-tools at a specific PR or SHA. This is trivial to do and instructions on how to do it are in both workflow yml files. Outside of the test repository, only the installed package should be ever be used. The reason for this is that the test repository does not have the same traffic as other repositories and building downloads several additional package from nuget. \ No newline at end of file diff --git a/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Static/IssueCommentProcessingTests.cs b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Static/IssueCommentProcessingTests.cs new file mode 100644 index 00000000000..c2d78616414 --- /dev/null +++ b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Static/IssueCommentProcessingTests.cs @@ -0,0 +1,294 @@ +using System.Threading.Tasks; +using Azure.Sdk.Tools.GitHubEventProcessor.Constants; +using Azure.Sdk.Tools.GitHubEventProcessor.EventProcessing; +using Azure.Sdk.Tools.GitHubEventProcessor.Utils; +using Octokit; +using Octokit.Internal; +using NUnit.Framework; +using System.IO; +using System; +using System.Data; +using NUnit.Framework.Interfaces; + +namespace Azure.Sdk.Tools.GitHubEventProcessor.Tests.Static +{ + [TestFixture] + [Parallelizable(ParallelScope.Children)] + public class IssueCommentProcessingTests : ProcessingTestBase + { + /// + /// Test AuthorFeedback rule enabled/disabled, with a payload that would cause updates when enabled. + /// Verify all the expected updates when enabled and no updates when disabled. + /// + /// String, RulesConstants for the rule being tested + /// JSon payload file for the event being tested + /// Whether or not the rule is on/off + [Category("static")] + [TestCase(RulesConstants.AuthorFeedback, "Tests.JsonEventPayloads/AuthorFeedBack_issue_comment_created.json", RuleState.On)] + [TestCase(RulesConstants.AuthorFeedback, "Tests.JsonEventPayloads/AuthorFeedBack_issue_comment_created.json", RuleState.Off)] + public async Task TestAuthorFeedback(string rule, string payloadFile, RuleState ruleState) + { + var mockGitHubEventClient = new MockGitHubEventClient(OrgConstants.ProductHeaderName); + mockGitHubEventClient.RulesConfiguration.Rules[rule] = ruleState; + var rawJson = TestHelpers.GetTestEventPayload(payloadFile); + var issueCommentPayload = SimpleJsonSerializer.Deserialize(rawJson); + IssueCommentProcessing.AuthorFeedback(mockGitHubEventClient, issueCommentPayload); + + // Verify the RuleCheck + Assert.AreEqual(ruleState == RuleState.On, mockGitHubEventClient.RulesConfiguration.RuleEnabled(rule), $"Rule '{rule}' enabled should have been {ruleState == RuleState.On} but RuleEnabled returned {ruleState != RuleState.On}.'"); + + var totalUpdates = await mockGitHubEventClient.ProcessPendingUpdates(issueCommentPayload.Repository.Id, issueCommentPayload.Issue.Number); + var numComments = mockGitHubEventClient.GetComments().Count; + if (RuleState.On == ruleState) + { + // There should be two updates, an IssueUpdate with the label updates and a single comment + Assert.AreEqual(2, totalUpdates, $"The number of updates should have been 2 but was instead, {totalUpdates}"); + Assert.AreEqual(1, numComments, $"{rule} should have created a single comment but {numComments} comments were created."); + + // Retrieve the IssueUpdate and verify the expected changes + var issueUpdate = mockGitHubEventClient.GetIssueUpdate(); + Assert.IsNotNull(issueUpdate, $"{rule} is {ruleState} and should have produced an IssueUpdate with {LabelConstants.NeedsTeamAttention} removed and {LabelConstants.NeedsAuthorFeedback} added."); + // Verify that NeedsTeamAttention was added + Assert.True(issueUpdate.Labels.Contains(LabelConstants.NeedsTeamAttention), $"IssueUpdate does not contain {LabelConstants.NeedsTeamAttention} label whcih should have been added."); + // Verify that NeedsAuthorFeedback was removed + Assert.False(issueUpdate.Labels.Contains(LabelConstants.NeedsAuthorFeedback), $"IssueUpdate contains {LabelConstants.NeedsAuthorFeedback} label which should have been removed."); + } + else + { + Assert.AreEqual(0, numComments, $"{rule} is {ruleState} and should not have created any comments but {numComments} comments were created."); + Assert.IsNull(mockGitHubEventClient.GetIssueUpdate(), $"{rule} is {ruleState} and should not have produced an IssueUpdate."); + } + } + + /// + /// Test ResetIssueActivity enabled/disabled with an issue_comment payload that would cause updates if enabled. + /// Verify all the expected updates when enabled and no updates when disabled. + /// + /// String, RulesConstants for the rule being tested + /// JSon payload file for the event being tested + /// Whether or not the rule is on/off + [Category("static")] + [TestCase(RulesConstants.ResetIssueActivity, "Tests.JsonEventPayloads/ResetIssueActivity_issue_comment_created.json", RuleState.On)] + [TestCase(RulesConstants.ResetIssueActivity, "Tests.JsonEventPayloads/ResetIssueActivity_issue_comment_created.json", RuleState.Off)] + public async Task TestResetIssueActivity(string rule, string payloadFile, RuleState ruleState) + { + var mockGitHubEventClient = new MockGitHubEventClient(OrgConstants.ProductHeaderName); + mockGitHubEventClient.RulesConfiguration.Rules[rule] = ruleState; + var rawJson = TestHelpers.GetTestEventPayload(payloadFile); + var issueCommentPayload = SimpleJsonSerializer.Deserialize(rawJson); + IssueCommentProcessing.ResetIssueActivity(mockGitHubEventClient, issueCommentPayload); + + // Verify the RuleCheck + Assert.AreEqual(ruleState == RuleState.On, mockGitHubEventClient.RulesConfiguration.RuleEnabled(rule), $"Rule '{rule}' enabled should have been {ruleState == RuleState.On} but RuleEnabled returned {ruleState != RuleState.On}.'"); + + var totalUpdates = await mockGitHubEventClient.ProcessPendingUpdates(issueCommentPayload.Repository.Id, issueCommentPayload.Issue.Number); + if (RuleState.On == ruleState) + { + // There should be one update, an IssueUpdate with the label NoRecentActivity removed + Assert.AreEqual(1, totalUpdates, $"The number of updates should have been 1 but was instead, {totalUpdates}"); + + // Retrieve the IssueUpdate and verify the expected changes + var issueUpdate = mockGitHubEventClient.GetIssueUpdate(); + Assert.IsNotNull(issueUpdate, $"IssueUpdate is null. {rule} is {ruleState} and should have produced an IssueUpdate with {LabelConstants.NoRecentActivity} removed."); + // Verify that NoRecentActivity was removed + Assert.False(issueUpdate.Labels.Contains(LabelConstants.NoRecentActivity), $"IssueUpdate contains {LabelConstants.NoRecentActivity} label which should have been removed."); + } + else + { + Assert.AreEqual(0, totalUpdates, $"The number of updates should have been 0 but was instead, {totalUpdates}"); + Assert.IsNull(mockGitHubEventClient.GetIssueUpdate(), $"{rule} is {ruleState} and should not have produced an IssueUpdate."); + } + } + + /// + /// Test ReopenIssue enabled/disabled with issue_comment payload that would cause updates if enabled. + /// Verify all the expected updates when enabled and no updates when disabled. + /// + /// String, RulesConstants for the rule being tested + /// JSon payload file for the event being tested + /// Whether or not the rule is on/off + [Category("static")] + [TestCase(RulesConstants.ReopenIssue, "Tests.JsonEventPayloads/ReopenIssue_issue_comment_created.json", RuleState.On)] + [TestCase(RulesConstants.ReopenIssue, "Tests.JsonEventPayloads/ReopenIssue_issue_comment_created.json", RuleState.Off)] + public async Task TestReopenIssue(string rule, string payloadFile, RuleState ruleState) + { + var mockGitHubEventClient = new MockGitHubEventClient(OrgConstants.ProductHeaderName); + mockGitHubEventClient.RulesConfiguration.Rules[rule] = ruleState; + var rawJson = TestHelpers.GetTestEventPayload(payloadFile); + var updateJson = TestHelpers.SetClosedByDateToYesterday(rawJson); + var issueCommentPayload = SimpleJsonSerializer.Deserialize(updateJson); + IssueCommentProcessing.ReopenIssue(mockGitHubEventClient, issueCommentPayload); + + // Verify the RuleCheck + Assert.AreEqual(ruleState == RuleState.On, mockGitHubEventClient.RulesConfiguration.RuleEnabled(rule), $"Rule '{rule}' enabled should have been {ruleState == RuleState.On} but RuleEnabled returned {ruleState != RuleState.On}.'"); + + var totalUpdates = await mockGitHubEventClient.ProcessPendingUpdates(issueCommentPayload.Repository.Id, issueCommentPayload.Issue.Number); + if (RuleState.On == ruleState) + { + // There should be one update, an IssueUpdate with the labels NeedsAuthorFeedback and NoRecentActivity removed + // and NeedsTeamAttention added + Assert.AreEqual(1, totalUpdates, $"The number of updates should have been 1 but was instead, {totalUpdates}"); + + // Retrieve the IssueUpdate and verify the expected changes + var issueUpdate = mockGitHubEventClient.GetIssueUpdate(); + Assert.IsNotNull(issueUpdate, $"IssueUpdate is null. {rule} is {ruleState} and should have produced an IssueUpdate with {LabelConstants.NeedsAuthorFeedback} and {LabelConstants.NoRecentActivity} removed and {LabelConstants.NeedsTeamAttention} added."); + + // Verify that the NeedsTeamAttention label was added + Assert.True(issueUpdate.Labels.Contains(LabelConstants.NeedsTeamAttention), $"IssueUpdate does not contain {LabelConstants.NeedsTeamAttention} label which should have been added."); + + // Verify that NeedsAuthorFeedback and NoRecentActivity labels were removed + Assert.False(issueUpdate.Labels.Contains(LabelConstants.NeedsAuthorFeedback), $"IssueUpdate contains {LabelConstants.NeedsAuthorFeedback} label which should have been removed."); + Assert.False(issueUpdate.Labels.Contains(LabelConstants.NoRecentActivity), $"IssueUpdate contains {LabelConstants.NoRecentActivity} label which should have been removed."); + } + else + { + Assert.AreEqual(0, totalUpdates, $"The number of updates should have been 0 but was instead, {totalUpdates}"); + Assert.IsNull(mockGitHubEventClient.GetIssueUpdate(), $"{rule} is {ruleState} and should not have produced an IssueUpdate."); + } + } + + /// + /// Test DeclineToReopenIssue enabled/disabled with issue_comment payload that would cause updates if enabled. + /// Verify all the expected updates when enabled and no updates when disabled. + /// + /// String, RulesConstants for the rule being tested + /// JSon payload file for the event being tested + /// Whether or not the rule is on/off + [Category("static")] + [TestCase(RulesConstants.DeclineToReopenIssue, "Tests.JsonEventPayloads/DeclineToReopenIssue_issue_comment_created.json", RuleState.On)] + [TestCase(RulesConstants.DeclineToReopenIssue, "Tests.JsonEventPayloads/DeclineToReopenIssue_issue_comment_created.json", RuleState.Off)] + public async Task TestDeclineToReopenIssue(string rule, string payloadFile, RuleState ruleState) + { + var mockGitHubEventClient = new MockGitHubEventClient(OrgConstants.ProductHeaderName); + mockGitHubEventClient.RulesConfiguration.Rules[rule] = ruleState; + var rawJson = TestHelpers.GetTestEventPayload(payloadFile); + var issueCommentPayload = SimpleJsonSerializer.Deserialize(rawJson); + // Set the return value for the DoesUserHavePermission check. The rule requires the user who created the + // comment to have PermissionLevel.None and that call needs to return true. + mockGitHubEventClient.UserHasPermissionsReturn = true; + await IssueCommentProcessing.DeclineToReopenIssue(mockGitHubEventClient, issueCommentPayload); + + // Verify the RuleCheck + Assert.AreEqual(ruleState == RuleState.On, mockGitHubEventClient.RulesConfiguration.RuleEnabled(rule), $"Rule '{rule}' enabled should have been {ruleState == RuleState.On} but RuleEnabled returned {ruleState != RuleState.On}.'"); + + var totalUpdates = await mockGitHubEventClient.ProcessPendingUpdates(issueCommentPayload.Repository.Id, issueCommentPayload.Issue.Number); + var numComments = mockGitHubEventClient.GetComments().Count; + if (RuleState.On == ruleState) + { + // There should be one update, a comment. + Assert.AreEqual(1, totalUpdates, $"The number of updates should have been 1 but was instead, {totalUpdates}"); + + // Verify the IssueUpdate is null, the rule does not change that + Assert.IsNull(mockGitHubEventClient.GetIssueUpdate(), $"{rule} is {ruleState} and should not have produced an IssueUpdate."); + // Verify that a single comment was created + Assert.AreEqual(1, numComments, $"{rule} should have created a single comment but {numComments} comments were created."); + } + else + { + Assert.AreEqual(0, numComments, $"{rule} is {ruleState} and should not have created any comments but {numComments} comments were created."); + Assert.IsNull(mockGitHubEventClient.GetIssueUpdate(), $"{rule} is {ruleState} and should not have produced an IssueUpdate."); + } + } + + /// + /// Test DeclineToReopenIssue enabled/disabled with issue_comment payload that would cause updates if enabled. + /// Verify all the expected updates when enabled and no updates when disabled. + /// Same user means the user who created the Issue also created the IssueComment. If the user who created the + /// issue also created the comment, then whether or not the user has admin or write permissions is irrelevant. + /// + /// String, RulesConstants for the rule being tested + /// JSon payload file for the event being tested + /// Whether or not the rule is on/off + /// Whether or not the user has Admin or Write permission. + [Category("static")] + [TestCase(RulesConstants.IssueAddressedCommands, "Tests.JsonEventPayloads/IssueAddressedCommands_issue_comment_created_same_user.json", RuleState.On, true)] + [TestCase(RulesConstants.IssueAddressedCommands, "Tests.JsonEventPayloads/IssueAddressedCommands_issue_comment_created_same_user.json", RuleState.On, false)] + [TestCase(RulesConstants.IssueAddressedCommands, "Tests.JsonEventPayloads/IssueAddressedCommands_issue_comment_created_same_user.json", RuleState.Off, false)] + public async Task TestIssueAddressedCommands_SameUser(string rule, string payloadFile, RuleState ruleState, bool userHasAdminOrWritePermission) + { + var mockGitHubEventClient = new MockGitHubEventClient(OrgConstants.ProductHeaderName); + mockGitHubEventClient.RulesConfiguration.Rules[rule] = ruleState; + var rawJson = TestHelpers.GetTestEventPayload(payloadFile); + var issueCommentPayload = SimpleJsonSerializer.Deserialize(rawJson); + // Set the return value for the DoesUserHavePermission check. Since the comment creator is the same user + // that created the issue, whether or not they have admin or write permissions should have no effect. + mockGitHubEventClient.UserHasPermissionsReturn = userHasAdminOrWritePermission; + await IssueCommentProcessing.IssueAddressedCommands(mockGitHubEventClient, issueCommentPayload); + + // Verify the RuleCheck + Assert.AreEqual(ruleState == RuleState.On, mockGitHubEventClient.RulesConfiguration.RuleEnabled(rule), $"Rule '{rule}' enabled should have been {ruleState == RuleState.On} but RuleEnabled returned {ruleState != RuleState.On}.'"); + + var totalUpdates = await mockGitHubEventClient.ProcessPendingUpdates(issueCommentPayload.Repository.Id, issueCommentPayload.Issue.Number); + if (RuleState.On == ruleState) + { + // There should only be 1 update, the IssueUpdate + Assert.AreEqual(1, totalUpdates, $"The number of updates should have been 1 but was instead, {totalUpdates}"); + + var issueUpdate = mockGitHubEventClient.GetIssueUpdate(); + // Verify the IssueUpdate is not null + Assert.IsNotNull(issueUpdate, $"{rule} is {ruleState} and should have produced an IssueUpdate."); + // Verify the IssueUpdate contains the following changes: + // State = ItemState.Open + Assert.AreEqual(issueUpdate.State, ItemState.Open, $"IssueUpdate's state should be ItemState.Open and was not."); + // IssueAddressed label has been removed + Assert.False(issueUpdate.Labels.Contains(LabelConstants.IssueAddressed), $"IssueUpdate contains {LabelConstants.IssueAddressed} label which should have been removed."); + // NeedsTeamAttention has been added + Assert.True(issueUpdate.Labels.Contains(LabelConstants.NeedsTeamAttention), $"IssueUpdate does not contain {LabelConstants.NeedsTeamAttention} label which should have been added."); + } + else + { + Assert.AreEqual(0, totalUpdates, $"The number of updates should have been 0 but was instead, {totalUpdates}"); + Assert.IsNull(mockGitHubEventClient.GetIssueUpdate(), $"{rule} is {ruleState} and should not have produced an IssueUpdate."); + } + } + + /// + /// Test DeclineToReopenIssue enabled/disabled with issue_comment payload that would cause updates if enabled. + /// Verify all the expected updates when enabled and no updates when disabled. + /// Different user means the user who created the Issue is not the same user that created the IssueComment and + /// different actions are performed if the user has admin or write permission than if they don't. + /// We test the rule being on/off in the Same User test and that will not be tested here. + /// + /// String, RulesConstants for the rule being tested + /// JSon payload file for the event being tested + /// Whether or not the user has Admin or Write permission. + [Category("static")] + [TestCase(RulesConstants.IssueAddressedCommands, "Tests.JsonEventPayloads/IssueAddressedCommands_issue_comment_created_different_user.json", true)] + [TestCase(RulesConstants.IssueAddressedCommands, "Tests.JsonEventPayloads/IssueAddressedCommands_issue_comment_created_different_user.json", false)] + public async Task TestIssueAddressedCommands_DifferentUser(string rule, string payloadFile, bool userHasAdminOrWritePermission) + { + var mockGitHubEventClient = new MockGitHubEventClient(OrgConstants.ProductHeaderName); + var rawJson = TestHelpers.GetTestEventPayload(payloadFile); + var issueCommentPayload = SimpleJsonSerializer.Deserialize(rawJson); + // Set the return value for the permission check. Since the comment creator is the + mockGitHubEventClient.UserHasPermissionsReturn = userHasAdminOrWritePermission; + await IssueCommentProcessing.IssueAddressedCommands(mockGitHubEventClient, issueCommentPayload); + + var totalUpdates = await mockGitHubEventClient.ProcessPendingUpdates(issueCommentPayload.Repository.Id, issueCommentPayload.Issue.Number); + var numComments = mockGitHubEventClient.GetComments().Count; + if (userHasAdminOrWritePermission) + { + // There should only be 1 update, the IssueUpdate + Assert.AreEqual(1, totalUpdates, $"The number of updates should have been 1 but was instead, {totalUpdates}"); + + var issueUpdate = mockGitHubEventClient.GetIssueUpdate(); + // Verify the IssueUpdate is not null + Assert.IsNotNull(issueUpdate, $"{rule} is should have produced an IssueUpdate."); + // Verify the IssueUpdate contains the following changes: + // State = ItemState.Open + Assert.AreEqual(issueUpdate.State, ItemState.Open, $"IssueUpdate's state should be ItemState.Open and was not."); + // IssueAddressed label has been removed + Assert.False(issueUpdate.Labels.Contains(LabelConstants.IssueAddressed), $"IssueUpdate contains {LabelConstants.IssueAddressed} label which should have been removed."); + // NeedsTeamAttention has been added + Assert.True(issueUpdate.Labels.Contains(LabelConstants.NeedsTeamAttention), $"IssueUpdate does not contain {LabelConstants.NeedsTeamAttention} label which should have been added."); + } + else + { + // If the user does not have admin or write permission then there should be a single comment + Assert.AreEqual(1, totalUpdates, $"The number of updates should have been 1 but was instead, {totalUpdates}"); + Assert.AreEqual(1, numComments, $"Without admin or write permissions, 1 comment should have been created but {numComments} comments were created."); + Assert.IsNull(mockGitHubEventClient.GetIssueUpdate(), $"Without admin or write permissions there should not be an IssueUpdate."); + } + } + } +} diff --git a/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Static/IssueProcessingTests.cs b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Static/IssueProcessingTests.cs new file mode 100644 index 00000000000..bbdc9f00479 --- /dev/null +++ b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Static/IssueProcessingTests.cs @@ -0,0 +1,600 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Azure.Sdk.Tools.GitHubEventProcessor.Constants; +using Azure.Sdk.Tools.GitHubEventProcessor.EventProcessing; +using Azure.Sdk.Tools.GitHubEventProcessor.GitHubPayload; +using Azure.Sdk.Tools.GitHubEventProcessor.Utils; +using NUnit.Framework; + +namespace Azure.Sdk.Tools.GitHubEventProcessor.Tests.Static +{ + [TestFixture] + [Parallelizable(ParallelScope.Children)] + public class IssueProcessingTests : ProcessingTestBase + { + /// + /// TBD: InitialIssueTriage rule is not yet complete as it requires a CODEOWNERS overhaul that is not complete. + /// The payload for this rule to process requires an issues opened event with no assignee and no labels. + /// Until the CODEOWNERS changes are complete, processing is as follows: + /// Trigger: issues opened + /// Conditions: Issue has no assignee + /// Issue has no labels + /// Resulting Action:Query the AI Service + /// If the AI Service + /// + /// String, RulesConstants for the rule being tested + /// JSon payload file for the event being tested + /// Whether or not the rule is on/off + /// Whether or not the AI Service should return labels + [Category("static")] + [TestCase(RulesConstants.InitialIssueTriage, "Tests.JsonEventPayloads/InitialIssueTriage_issue_opened_no_labels_no_assignee.json", RuleState.On, true)] + [TestCase(RulesConstants.InitialIssueTriage, "Tests.JsonEventPayloads/InitialIssueTriage_issue_opened_no_labels_no_assignee.json", RuleState.On, false)] + [TestCase(RulesConstants.InitialIssueTriage, "Tests.JsonEventPayloads/InitialIssueTriage_issue_opened_no_labels_no_assignee.json", RuleState.Off, false)] + public async Task TestInitialIssueTriage(string rule, string payloadFile, RuleState ruleState, bool AIServiceReturnsLabels) + { + var mockGitHubEventClient = new MockGitHubEventClient(OrgConstants.ProductHeaderName); + mockGitHubEventClient.RulesConfiguration.Rules[rule] = ruleState; + var rawJson = TestHelpers.GetTestEventPayload(payloadFile); + var issueEventPayload = SimpleJsonSerializer.Deserialize(rawJson); + List expectedLabels = new List + { + "FakeLabel1", + "FakeLabel2" + }; + + if (AIServiceReturnsLabels) + { + foreach (string label in expectedLabels) + { + mockGitHubEventClient.AILabelServiceReturn.Add(label); + } + } + await IssueProcessing.InitialIssueTriage(mockGitHubEventClient, issueEventPayload); + var totalUpdates = await mockGitHubEventClient.ProcessPendingUpdates(issueEventPayload.Repository.Id, issueEventPayload.Issue.Number); + // Verify the RuleCheck + Assert.AreEqual(ruleState == RuleState.On, mockGitHubEventClient.RulesConfiguration.RuleEnabled(rule), $"Rule '{rule}' enabled should have been {ruleState == RuleState.On} but RuleEnabled returned {ruleState != RuleState.On}.'"); + if (RuleState.On == ruleState) + { + Assert.AreEqual(1, totalUpdates, $"The number of updates should have been 1 but was instead, {totalUpdates}"); + // Retrieve the IssueUpdate and verify the expected changes + var issueUpdate = mockGitHubEventClient.GetIssueUpdate(); + if (AIServiceReturnsLabels) + { + Assert.True(issueUpdate.Labels.Contains(LabelConstants.NeedsTeamTriage), $"IssueUpdate does not contain {LabelConstants.NeedsTeamTriage} which should have been added when labels were predicted."); + // Verify the labels returned by the AI service + foreach (string label in expectedLabels) + { + Assert.True(issueUpdate.Labels.Contains(label), $"IssueUpdate does not contain {label} which was returned by the AI service and should have been added."); + } + } + else + { + // If the AI Label service doesn't predict labels, the label added is NeedsTriage + Assert.True(issueUpdate.Labels.Contains(LabelConstants.NeedsTriage), $"IssueUpdate does not contain {LabelConstants.NeedsTriage} which should have been added when no labels were predicted."); + } + } + else + { + Assert.AreEqual(0, totalUpdates, $"{rule} is {ruleState} and should not have produced any updates."); + } + } + + /// + /// ManualIssueTriage requires 2 labeled event payloads to test. + /// 1. Labeled payload needs needs to be one where needs-triage is being added which should cause no change. + /// 2. Needs-triage needs to be already on the issues when another label is added. This should cause an update + /// where the needs-triage label is removed. This is also the payload used to check when the rule is Off. + /// Trigger: issues labeled + /// Conditions: Issue is open + /// Issue has "needs-triage" label + /// Label being added is NOT "needs-triage" + /// Resulting Action: Remove "needs-triage" label + /// + /// String, RulesConstants for the rule being tested + /// JSon payload file for the event being tested + /// Whether or not the rule is on/off + /// Whether or not the payload's labeled event is adding needs-triage + [Category("static")] + [TestCase(RulesConstants.ManualIssueTriage, "Tests.JsonEventPayloads/ManualIssueTriage_issue_labeled_needs-triage.json", RuleState.On, true)] + [TestCase(RulesConstants.ManualIssueTriage, "Tests.JsonEventPayloads/ManualIssueTriage_issue_labeled_not_needs-triage.json", RuleState.On, false)] + [TestCase(RulesConstants.ManualIssueTriage, "Tests.JsonEventPayloads/ManualIssueTriage_issue_labeled_not_needs-triage.json", RuleState.Off, false)] + public async Task TestManualIssueTriage(string rule, string payloadFile, RuleState ruleState, bool labelAddedIsNeedsTriage) + { + var mockGitHubEventClient = new MockGitHubEventClient(OrgConstants.ProductHeaderName); + mockGitHubEventClient.RulesConfiguration.Rules[rule] = ruleState; + var rawJson = TestHelpers.GetTestEventPayload(payloadFile); + var issueEventPayload = SimpleJsonSerializer.Deserialize(rawJson); + IssueProcessing.ManualIssueTriage(mockGitHubEventClient, issueEventPayload); + + // Verify the RuleCheck + Assert.AreEqual(ruleState == RuleState.On, mockGitHubEventClient.RulesConfiguration.RuleEnabled(rule), $"Rule '{rule}' enabled should have been {ruleState == RuleState.On} but RuleEnabled returned {ruleState != RuleState.On}.'"); + + var totalUpdates = await mockGitHubEventClient.ProcessPendingUpdates(issueEventPayload.Repository.Id, issueEventPayload.Issue.Number); + if (RuleState.On == ruleState) + { + // If the label being added is NeedsTriage, there should be no updates + if (labelAddedIsNeedsTriage) + { + Assert.AreEqual(0, totalUpdates, $"The label being added was {LabelConstants.NeedsTriage} and should not have produced any updates."); + } + else + { + // There should be one update, an IssueUpdate with the NoRecentActivity label removed + Assert.AreEqual(1, totalUpdates, $"The number of updates should have been 1 but was instead, {totalUpdates}"); + + // Retrieve the IssueUpdate and verify the expected changes + var issueUpdate = mockGitHubEventClient.GetIssueUpdate(); + Assert.IsNotNull(issueUpdate, $"{rule} is {ruleState} and should have produced an IssueUpdate with {LabelConstants.NeedsTriage} removed."); + // Verify that NeedsTriage was removed + Assert.False(issueUpdate.Labels.Contains(LabelConstants.NeedsTriage), $"IssueUpdate contains {LabelConstants.NeedsTriage} label which should have been removed."); + } + } + else + { + Assert.AreEqual(0, totalUpdates, $"{rule} is {ruleState} and should not have produced any updates."); + } + } + + /// + /// Service Attention requires two different CODEOWNERS files to test, one that has parties to mention + /// for ServiceAttention and one that doesn't. When there are no parties to mention, there should be + /// no updates. + /// Trigger: issue labeled + /// Conditions: Issue is open + /// Label being added is "Service Attention" + /// Resulting Action: Add issue comment "Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc ${mentionees}." + /// + /// String, RulesConstants for the rule being tested + /// JSon payload file for the event being tested + /// Whether or not the rule is on/off + /// Determines whether to load the codeowners with parties to mention or the one without + [Category("static")] + [NonParallelizable] + [TestCase(RulesConstants.ServiceAttention, "Tests.JsonEventPayloads/ServiceAttention_issue_labeled.json", RuleState.Off, true)] + [TestCase(RulesConstants.ServiceAttention, "Tests.JsonEventPayloads/ServiceAttention_issue_labeled.json", RuleState.On, true)] + [TestCase(RulesConstants.ServiceAttention, "Tests.JsonEventPayloads/ServiceAttention_issue_labeled.json", RuleState.On, false)] + + public async Task TestServiceAttention(string rule, string payloadFile, RuleState ruleState, bool hasPartiesToMentionForServiceAttention) + { + var mockGitHubEventClient = new MockGitHubEventClient(OrgConstants.ProductHeaderName); + mockGitHubEventClient.RulesConfiguration.Rules[rule] = ruleState; + var rawJson = TestHelpers.GetTestEventPayload(payloadFile); + var issueEventPayload = SimpleJsonSerializer.Deserialize(rawJson); + + // Set the path to the fake CODEOWNERS file to be used for testing + if (hasPartiesToMentionForServiceAttention) + { + CodeOwnerUtils.ResetCodeOwnerEntries(); + CodeOwnerUtils.codeOwnersFilePathOverride = "Tests.FakeCodeowners/ServiceAttention_has_CODEOWNERS"; + } + else + { + CodeOwnerUtils.ResetCodeOwnerEntries(); + CodeOwnerUtils.codeOwnersFilePathOverride = "Tests.FakeCodeowners/ServiceAttention_does_not_have_CODEOWNERS"; + } + IssueProcessing.ServiceAttention(mockGitHubEventClient, issueEventPayload); + + // Verify the RuleCheck + Assert.AreEqual(ruleState == RuleState.On, mockGitHubEventClient.RulesConfiguration.RuleEnabled(rule), $"Rule '{rule}' enabled should have been {ruleState == RuleState.On} but RuleEnabled returned {ruleState != RuleState.On}.'"); + + var totalUpdates = await mockGitHubEventClient.ProcessPendingUpdates(issueEventPayload.Repository.Id, issueEventPayload.Issue.Number); + if (RuleState.On == ruleState) + { + if (hasPartiesToMentionForServiceAttention) + { + string expectedNames = "@FakeUser1 @FakeUser11 @FakeUser4 @FakeUser14 @FakeUser24 @FakeUser9"; + // "Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @FakeUser1 @FakeUser11 @FakeUser4 @FakeUser14 @FakeUser24 @FakeUser9." + // There should be one update, a comment + Assert.AreEqual(1, totalUpdates, $"The number of updates should have been 1 but was instead, {totalUpdates}"); + + // Verify that a single comment was created + Assert.AreEqual(1, mockGitHubEventClient.GetComments().Count, $"{rule} should have produced a single comment."); + string comment = mockGitHubEventClient.GetComments()[0].Comment; + Assert.True(comment.Contains(expectedNames), $"Comment should have contained expected names {expectedNames} but did not. Full comment={comment}"); + } + else + { + Assert.AreEqual(0, totalUpdates, $"With no parties to mention for Service Attention, the rule should not have produced any updates."); + } + } + else + { + Assert.AreEqual(0, totalUpdates, $"{rule} is {ruleState} and should not have produced any updates."); + } + } + + + /// + /// Test CXPAttention rule enabled/disabled, with a payload that would cause updates when enabled. + /// Verify all the expected updates when enabled and no updates when disabled. + /// Trigger: issues labeled + /// Conditions: Issue is open + /// Label being added is "CXP-Attention" + /// Does not have "Service-Attention" label + /// Resulting Action: Add issues comment "Thank you for your feedback. This has been routed to the support team for assistance." + /// + /// String, RulesConstants for the rule being tested + /// JSon payload file for the event being tested + /// Whether or not the rule is on/off + /// Where or not the payload has the Service Attention label + [Category("static")] + [TestCase(RulesConstants.CXPAttention, "Tests.JsonEventPayloads/CXPAttention_issue_labeled.json", RuleState.Off, false)] + [TestCase(RulesConstants.CXPAttention, "Tests.JsonEventPayloads/CXPAttention_issue_labeled.json", RuleState.On, false)] + [TestCase(RulesConstants.CXPAttention, "Tests.JsonEventPayloads/CXPAttention_issue_labeled_has_service-attention.json", RuleState.Off, true)] + + public async Task TestCXPAttention(string rule, string payloadFile, RuleState ruleState, bool hasServiceAttentionLabel) + { + var mockGitHubEventClient = new MockGitHubEventClient(OrgConstants.ProductHeaderName); + mockGitHubEventClient.RulesConfiguration.Rules[rule] = ruleState; + var rawJson = TestHelpers.GetTestEventPayload(payloadFile); + var issueEventPayload = SimpleJsonSerializer.Deserialize(rawJson); + IssueProcessing.CXPAttention(mockGitHubEventClient, issueEventPayload); + + // Verify the RuleCheck + Assert.AreEqual(ruleState == RuleState.On, mockGitHubEventClient.RulesConfiguration.RuleEnabled(rule), $"Rule '{rule}' enabled should have been {ruleState == RuleState.On} but RuleEnabled returned {ruleState != RuleState.On}.'"); + + var totalUpdates = await mockGitHubEventClient.ProcessPendingUpdates(issueEventPayload.Repository.Id, issueEventPayload.Issue.Number); + if (RuleState.On == ruleState) + { + // If the issues has the ServiceAttention label then there should be no updates + if (hasServiceAttentionLabel) + { + Assert.AreEqual(0, totalUpdates, $"Issue has {LabelConstants.ServiceAttention} and should not have produced any updates."); + } + else + { + // There should be one comment created and no other updates + Assert.AreEqual(1, totalUpdates, $"The number of updates should have been 1 but was instead, {totalUpdates}"); + // Verify that no issues update was produced + var issueUpdate = mockGitHubEventClient.GetIssueUpdate(); + Assert.IsNull(issueUpdate, $"{rule} should not have produced an IssueUpdate."); + + // Verify that a single comment was created + Assert.AreEqual(1, mockGitHubEventClient.GetComments().Count, $"{rule} should have produced a single comment."); + } + } + else + { + Assert.AreEqual(0, totalUpdates, $"{rule} is {ruleState} and should not have produced any updates."); + } + } + + /// + /// Test ManualTriageAfterExternalAssignment rule enabled/disabled, with a payload that would cause updates when enabled. + /// Verify all the expected updates when enabled and no updates when disabled. + /// Trigger: issue unlabeled + /// Conditions: Issue is open + /// Has "customer-reported" label + /// Label removed is "Service Attention" OR "CXP Attention" + /// Resulting Action: Add "needs-team-triage" label + /// + /// String, RulesConstants for the rule being tested + /// JSon payload file for the event being tested + /// Whether or not the rule is on/off + /// Whether or not the payload already has the needs-team-triage label + [Category("static")] + [TestCase(RulesConstants.ManualTriageAfterExternalAssignment, "Tests.JsonEventPayloads/ManualTriageAfterExternalAssignment_issue_unlabeled_CXP_attention.json", RuleState.Off, false)] + [TestCase(RulesConstants.ManualTriageAfterExternalAssignment, "Tests.JsonEventPayloads/ManualTriageAfterExternalAssignment_issue_unlabeled_CXP_attention.json", RuleState.On, false)] + [TestCase(RulesConstants.ManualTriageAfterExternalAssignment, "Tests.JsonEventPayloads/ManualTriageAfterExternalAssignment_issue_unlabeled_service_attention.json", RuleState.Off, false)] + [TestCase(RulesConstants.ManualTriageAfterExternalAssignment, "Tests.JsonEventPayloads/ManualTriageAfterExternalAssignment_issue_unlabeled_service_attention.json", RuleState.On, false)] + [TestCase(RulesConstants.ManualTriageAfterExternalAssignment, "Tests.JsonEventPayloads/ManualTriageAfterExternalAssignment_issue_unlabeled_has_needs-team-triage.json", RuleState.On, true)] + public async Task TestManualTriageAfterExternalAssignment(string rule, string payloadFile, RuleState ruleState, bool alreadyHasNeedsTeamTriage) + { + var mockGitHubEventClient = new MockGitHubEventClient(OrgConstants.ProductHeaderName); + mockGitHubEventClient.RulesConfiguration.Rules[rule] = ruleState; + var rawJson = TestHelpers.GetTestEventPayload(payloadFile); + var issueEventPayload = SimpleJsonSerializer.Deserialize(rawJson); + IssueProcessing.ManualTriageAfterExternalAssignment(mockGitHubEventClient, issueEventPayload); + + // Verify the RuleCheck + Assert.AreEqual(ruleState == RuleState.On, mockGitHubEventClient.RulesConfiguration.RuleEnabled(rule), $"Rule '{rule}' enabled should have been {ruleState == RuleState.On} but RuleEnabled returned {ruleState != RuleState.On}.'"); + + var totalUpdates = await mockGitHubEventClient.ProcessPendingUpdates(issueEventPayload.Repository.Id, issueEventPayload.Issue.Number); + if (RuleState.On == ruleState) + { + // If issue already has needs-team-triage there should be no updates + if (alreadyHasNeedsTeamTriage) + { + Assert.AreEqual(0, totalUpdates, $"The issue already has {LabelConstants.NeedsTeamTriage} and should not have produced any updates."); + } + else + { + // There should be one update, an IssueUpdate with the NoRecentActivity label removed + Assert.AreEqual(1, totalUpdates, $"The number of updates should have been 1 but was instead, {totalUpdates}"); + // Retrieve the IssueUpdate and verify the expected changes + var issueUpdate = mockGitHubEventClient.GetIssueUpdate(); + Assert.IsNotNull(issueUpdate, $"{rule} is {ruleState} and should have produced an IssueUpdate with {LabelConstants.NeedsTeamTriage} added."); + // Verify that NeedsTeamTriage was added + Assert.True(issueUpdate.Labels.Contains(LabelConstants.NeedsTeamTriage), $"IssueUpdate does not the {LabelConstants.NeedsTeamTriage} label which should have been added."); + } + } + else + { + Assert.AreEqual(0, totalUpdates, $"{rule} is {ruleState} and should not have produced any updates."); + } + } + + /// + /// Test ResetIssueActivity rule enabled/disabled, with a payload that would cause updates when enabled. + /// Verify all the expected updates when enabled and no updates when disabled. + /// Trigger: issue reopened/edited + /// Conditions: Issue is open OR Issue is being reopened + /// Issue has "no-recent-activity" label + /// User modifying the issue is NOT a known bot + /// + /// String, RulesConstants for the rule being tested + /// JSon payload file for the event being tested + /// Whether or not the rule is on/off + [Category("static")] + [TestCase(RulesConstants.ResetIssueActivity, "Tests.JsonEventPayloads/ResetIssueActivity_issue_edited.json", RuleState.Off)] + [TestCase(RulesConstants.ResetIssueActivity, "Tests.JsonEventPayloads/ResetIssueActivity_issue_edited.json", RuleState.On)] + [TestCase(RulesConstants.ResetIssueActivity, "Tests.JsonEventPayloads/ResetIssueActivity_issue_reopened.json", RuleState.Off)] + [TestCase(RulesConstants.ResetIssueActivity, "Tests.JsonEventPayloads/ResetIssueActivity_issue_reopened.json", RuleState.On)] + public async Task TestResetIssueActivity(string rule, string payloadFile, RuleState ruleState) + { + var mockGitHubEventClient = new MockGitHubEventClient(OrgConstants.ProductHeaderName); + mockGitHubEventClient.RulesConfiguration.Rules[rule] = ruleState; + var rawJson = TestHelpers.GetTestEventPayload(payloadFile); + var issueEventPayload = SimpleJsonSerializer.Deserialize(rawJson); + IssueProcessing.ResetIssueActivity(mockGitHubEventClient, issueEventPayload); + + // Verify the RuleCheck + Assert.AreEqual(ruleState == RuleState.On, mockGitHubEventClient.RulesConfiguration.RuleEnabled(rule), $"Rule '{rule}' enabled should have been {ruleState == RuleState.On} but RuleEnabled returned {ruleState != RuleState.On}.'"); + + var totalUpdates = await mockGitHubEventClient.ProcessPendingUpdates(issueEventPayload.Repository.Id, issueEventPayload.Issue.Number); + if (RuleState.On == ruleState) + { + // There should be one update, an IssueUpdate with the NoRecentActivity label removed + Assert.AreEqual(1, totalUpdates, $"The number of updates should have been 1 but was instead, {totalUpdates}"); + + // Retrieve the IssueUpdate and verify the expected changes + var issueUpdate = mockGitHubEventClient.GetIssueUpdate(); + Assert.IsNotNull(issueUpdate, $"{rule} is {ruleState} and should have produced an IssueUpdate with {LabelConstants.NoRecentActivity} removed."); + // Verify that NoRecentActivity was removed + Assert.False(issueUpdate.Labels.Contains(LabelConstants.NoRecentActivity), $"IssueUpdate contains {LabelConstants.NoRecentActivity} label which should have been removed."); + } + else + { + Assert.AreEqual(0, totalUpdates, $"{rule} is {ruleState} and should not have produced any updates."); + } + } + + /// + /// Test RequireAttentionForNonMilestone rule enabled/disabled, with a payload that would cause updates when enabled. + /// Verify all the expected updates when enabled and no updates when disabled. + /// Trigger: issue labeled/unlabeled + /// Conditions: Issue is open + /// Issue has label "customer-reported" + /// Issue does NOT have label "needs-team-attention" + /// Issue does NOT have label "needs-triage" + /// Issue does NOT have label "needs-team-triage" + /// Issue does NOT have label "needs-author-feedback" + /// Issue does NOT have label "issue-addressed" + /// Issue is not in a milestone + /// Resulting Action: Add "needs-team-attention" label + /// + /// String, RulesConstants for the rule being tested + /// JSon payload file for the event being tested + /// Whether or not the rule is on/off + [Category("static")] + [TestCase(RulesConstants.RequireAttentionForNonMilestone, "Tests.JsonEventPayloads/RequireAttentionForNonMilestone_issue_labeled.json", RuleState.Off)] + [TestCase(RulesConstants.RequireAttentionForNonMilestone, "Tests.JsonEventPayloads/RequireAttentionForNonMilestone_issue_labeled.json", RuleState.On)] + [TestCase(RulesConstants.RequireAttentionForNonMilestone, "Tests.JsonEventPayloads/RequireAttentionForNonMilestone_issue_unlabeled.json", RuleState.Off)] + [TestCase(RulesConstants.RequireAttentionForNonMilestone, "Tests.JsonEventPayloads/RequireAttentionForNonMilestone_issue_unlabeled.json", RuleState.On)] + public async Task TestRequireAttentionForNonMilestone(string rule, string payloadFile, RuleState ruleState) + { + var mockGitHubEventClient = new MockGitHubEventClient(OrgConstants.ProductHeaderName); + mockGitHubEventClient.RulesConfiguration.Rules[rule] = ruleState; + var rawJson = TestHelpers.GetTestEventPayload(payloadFile); + var issueEventPayload = SimpleJsonSerializer.Deserialize(rawJson); + IssueProcessing.RequireAttentionForNonMilestone(mockGitHubEventClient, issueEventPayload); + + // Verify the RuleCheck + Assert.AreEqual(ruleState == RuleState.On, mockGitHubEventClient.RulesConfiguration.RuleEnabled(rule), $"Rule '{rule}' enabled should have been {ruleState == RuleState.On} but RuleEnabled returned {ruleState != RuleState.On}.'"); + + var totalUpdates = await mockGitHubEventClient.ProcessPendingUpdates(issueEventPayload.Repository.Id, issueEventPayload.Issue.Number); + if (RuleState.On == ruleState) + { + // There should be one update, an IssueUpdate with the NoRecentActivity label removed + Assert.AreEqual(1, totalUpdates, $"The number of updates should have been 1 but was instead, {totalUpdates}"); + + // Retrieve the IssueUpdate and verify the expected changes + var issueUpdate = mockGitHubEventClient.GetIssueUpdate(); + Assert.IsNotNull(issueUpdate, $"{rule} is {ruleState} and should have produced an IssueUpdate with {LabelConstants.NeedsTeamAttention} added."); + // Verify that NeedsTeamAttention was added + Assert.True(issueUpdate.Labels.Contains(LabelConstants.NeedsTeamAttention), $"IssueUpdate does not contain {LabelConstants.NeedsTeamAttention} label which should have been added."); + } + else + { + Assert.AreEqual(0, totalUpdates, $"{rule} is {ruleState} and should not have produced any updates."); + } + } + + /// + /// Test AuthorFeedbackNeeded rule enabled/disabled, with a payload that would cause updates when enabled. + /// Verify all the expected updates when enabled and no updates when disabled. + /// Trigger: issue labeled + /// Conditions: Issue is open + /// Label added is "needs-author-feedback" + /// Resulting Action: + /// Remove "needs-triage" label + /// Remove "needs-team-triage" label + /// Remove "needs-team-attention" label + /// + /// String, RulesConstants for the rule being tested + /// JSon payload file for the event being tested + /// Whether or not the rule is on/off + /// Whether or not the payload Issue contains the labels that are being removed + [Category("static")] + [TestCase(RulesConstants.AuthorFeedbackNeeded, "Tests.JsonEventPayloads/AuthorFeedbackNeeded_issue_labeled_with_labels_to_remove.json", RuleState.Off, true)] + [TestCase(RulesConstants.AuthorFeedbackNeeded, "Tests.JsonEventPayloads/AuthorFeedbackNeeded_issue_labeled_with_labels_to_remove.json", RuleState.On, true)] + [TestCase(RulesConstants.AuthorFeedbackNeeded, "Tests.JsonEventPayloads/AuthorFeedbackNeeded_issue_labeled_nothing_to_remove.json", RuleState.Off, false)] + public async Task TestAuthorFeedbackNeeded(string rule, string payloadFile, RuleState ruleState, bool hasLabelsToRemove) + { + var mockGitHubEventClient = new MockGitHubEventClient(OrgConstants.ProductHeaderName); + mockGitHubEventClient.RulesConfiguration.Rules[rule] = ruleState; + var rawJson = TestHelpers.GetTestEventPayload(payloadFile); + var issueEventPayload = SimpleJsonSerializer.Deserialize(rawJson); + IssueProcessing.AuthorFeedbackNeeded(mockGitHubEventClient, issueEventPayload); + + // Verify the RuleCheck + Assert.AreEqual(ruleState == RuleState.On, mockGitHubEventClient.RulesConfiguration.RuleEnabled(rule), $"Rule '{rule}' enabled should have been {ruleState == RuleState.On} but RuleEnabled returned {ruleState != RuleState.On}.'"); + + var totalUpdates = await mockGitHubEventClient.ProcessPendingUpdates(issueEventPayload.Repository.Id, issueEventPayload.Issue.Number); + if (RuleState.On == ruleState) + { + // If there are no labels to remove, there should be no updates + if (!hasLabelsToRemove) + { + Assert.AreEqual(0, totalUpdates, $"The label being removed, {LabelConstants.NeedsTriage}, was not on the Issue and should have not produced any updates."); + } + else + { + // There should be one update, an IssueUpdate with the NeedsTriage, NeedsTeamTriage and NeedsTeamAttention labels removed. + Assert.AreEqual(1, totalUpdates, $"The number of updates should have been 1 but was instead, {totalUpdates}"); + + // Retrieve the IssueUpdate and verify the expected changes + var issueUpdate = mockGitHubEventClient.GetIssueUpdate(); + Assert.IsNotNull(issueUpdate, $"{rule} is {ruleState} and should have produced an IssueUpdate with {LabelConstants.NeedsTriage} removed."); + // Verify that NeedsTriage, NeedsTeamTriage and NeedsTeamAttention were removed + Assert.False(issueUpdate.Labels.Contains(LabelConstants.NeedsTriage), $"IssueUpdate contains {LabelConstants.NeedsTriage} label which should have been removed."); + Assert.False(issueUpdate.Labels.Contains(LabelConstants.NeedsTeamTriage), $"IssueUpdate contains {LabelConstants.NeedsTeamTriage} label which should have been removed."); + Assert.False(issueUpdate.Labels.Contains(LabelConstants.NeedsTeamAttention), $"IssueUpdate contains {LabelConstants.NeedsTeamAttention} label which should have been removed."); + } + } + else + { + Assert.AreEqual(0, totalUpdates, $"{rule} is {ruleState} and should not have produced any updates."); + } + } + + /// + /// Test IssueAddressed rule enabled/disabled, with a payload that would cause updates when enabled. + /// Verify all the expected updates when enabled and no updates when disabled. + /// Trigger: issue labeled + /// Conditions: Issue is open + /// Label added is "issue-addressed" + /// Resulting Action: + /// Remove "needs-triage" label + /// Remove "needs-team-triage" label + /// Remove "needs-team-attention" label + /// Remove "needs-author-feedback" label + /// Remove "no-recent-activity" label + /// Add issue comment + /// + /// String, RulesConstants for the rule being tested + /// JSon payload file for the event being tested + /// Whether or not the rule is on/off + /// Whether or not the payload Issue contains the labels that are being removed + [Category("static")] + [TestCase(RulesConstants.IssueAddressed, "Tests.JsonEventPayloads/IssueAddressed_issue_labeled_with_labels_to_remove.json", RuleState.Off, true)] + [TestCase(RulesConstants.IssueAddressed, "Tests.JsonEventPayloads/IssueAddressed_issue_labeled_with_labels_to_remove.json", RuleState.On, true)] + [TestCase(RulesConstants.IssueAddressed, "Tests.JsonEventPayloads/IssueAddressed_issue_labeled_nothing_to_remove.json", RuleState.On, false)] + public async Task TestIssueAddressed(string rule, string payloadFile, RuleState ruleState, bool hasLabelsToRemove) + { + var mockGitHubEventClient = new MockGitHubEventClient(OrgConstants.ProductHeaderName); + mockGitHubEventClient.RulesConfiguration.Rules[rule] = ruleState; + var rawJson = TestHelpers.GetTestEventPayload(payloadFile); + var issueEventPayload = SimpleJsonSerializer.Deserialize(rawJson); + IssueProcessing.IssueAddressed(mockGitHubEventClient, issueEventPayload); + + // Verify the RuleCheck + Assert.AreEqual(ruleState == RuleState.On, mockGitHubEventClient.RulesConfiguration.RuleEnabled(rule), $"Rule '{rule}' enabled should have been {ruleState == RuleState.On} but RuleEnabled returned {ruleState != RuleState.On}.'"); + + var totalUpdates = await mockGitHubEventClient.ProcessPendingUpdates(issueEventPayload.Repository.Id, issueEventPayload.Issue.Number); + if (RuleState.On == ruleState) + { + // If the label being added is NeedsTriage, there should be no updates + if (!hasLabelsToRemove) + { + Assert.AreEqual(1, totalUpdates, $"With none of the labels to remove being on the Issue, there should still be 1 update from an added comment."); + } + else + { + // There should be one update, an IssueUpdate with the NoRecentActivity label removed + Assert.AreEqual(2, totalUpdates, $"The number of updates should have been 2 but was instead, {totalUpdates}"); + + // Retrieve the IssueUpdate and verify the expected changes + var issueUpdate = mockGitHubEventClient.GetIssueUpdate(); + Assert.IsNotNull(issueUpdate, $"{rule} is {ruleState} and should have produced an IssueUpdate with {LabelConstants.NeedsTriage} removed."); + + // Verify that NeedsTriage was removed + Assert.False(issueUpdate.Labels.Contains(LabelConstants.NeedsTriage), $"IssueUpdate contains {LabelConstants.NeedsTriage} label which should have been removed."); + // Verify that NeedsTeamTriage was removed + Assert.False(issueUpdate.Labels.Contains(LabelConstants.NeedsTeamTriage), $"IssueUpdate contains {LabelConstants.NeedsTeamTriage} label which should have been removed."); + // Verify that NeedsTeamAttention was removed + Assert.False(issueUpdate.Labels.Contains(LabelConstants.NeedsTeamAttention), $"IssueUpdate contains {LabelConstants.NeedsTeamAttention} label which should have been removed."); + // Verify that NeedsAuthorFeedback was removed + Assert.False(issueUpdate.Labels.Contains(LabelConstants.NeedsAuthorFeedback), $"IssueUpdate contains {LabelConstants.NeedsAuthorFeedback} label which should have been removed."); + // Verify that NoRecentActivity was removed + Assert.False(issueUpdate.Labels.Contains(LabelConstants.NoRecentActivity), $"IssueUpdate contains {LabelConstants.NoRecentActivity} label which should have been removed."); + } + // Regardless of whether or not there were labels to remove, a single comment should be created. + Assert.AreEqual(1, mockGitHubEventClient.GetComments().Count, $"{rule} should have produced a single comment."); + } + else + { + Assert.AreEqual(0, totalUpdates, $"{rule} is {ruleState} and should not have produced any updates."); + } + } + + /// + /// Test IssueAddressedReset rule enabled/disabled, with a payload that would cause updates when enabled. + /// Verify all the expected updates when enabled and no updates when disabled. + /// Trigger: issue labeled + /// Conditions: Issue is open + /// Issue has label "issue-addressed" + /// Label added is any one of: + /// "needs-team-attention" + /// "needs-author-feedback" + /// "Service Attention" + /// "CXP Attention" + /// "needs-triage" + /// "needs-team-triage" + /// Resulting Action: + /// Remove "issue-addressed" label + /// + /// String, RulesConstants for the rule being tested + /// JSon payload file for the event being tested + /// Whether or not the rule is on/off + [Category("static")] + [TestCase(RulesConstants.IssueAddressedReset, "Tests.JsonEventPayloads/IssueAddressedReset_issue_labeled_CXP_attention.json", RuleState.Off)] + [TestCase(RulesConstants.IssueAddressedReset, "Tests.JsonEventPayloads/IssueAddressedReset_issue_labeled_CXP_attention.json", RuleState.On)] + [TestCase(RulesConstants.IssueAddressedReset, "Tests.JsonEventPayloads/IssueAddressedReset_issue_labeled_needs-author-feedack.json", RuleState.On)] + [TestCase(RulesConstants.IssueAddressedReset, "Tests.JsonEventPayloads/IssueAddressedReset_issue_labeled_needs-team-attention.json", RuleState.On)] + [TestCase(RulesConstants.IssueAddressedReset, "Tests.JsonEventPayloads/IssueAddressedReset_issue_labeled_needs-team-triage.json", RuleState.On)] + [TestCase(RulesConstants.IssueAddressedReset, "Tests.JsonEventPayloads/IssueAddressedReset_issue_labeled_needs-triage.json", RuleState.On)] + [TestCase(RulesConstants.IssueAddressedReset, "Tests.JsonEventPayloads/IssueAddressedReset_issue_labeled_service_attention.json", RuleState.On)] + public async Task TestIssueAddressedReset(string rule, string payloadFile, RuleState ruleState) + { + var mockGitHubEventClient = new MockGitHubEventClient(OrgConstants.ProductHeaderName); + mockGitHubEventClient.RulesConfiguration.Rules[rule] = ruleState; + var rawJson = TestHelpers.GetTestEventPayload(payloadFile); + var issueEventPayload = SimpleJsonSerializer.Deserialize(rawJson); + IssueProcessing.IssueAddressedReset(mockGitHubEventClient, issueEventPayload); + + // Verify the RuleCheck + Assert.AreEqual(ruleState == RuleState.On, mockGitHubEventClient.RulesConfiguration.RuleEnabled(rule), $"Rule '{rule}' enabled should have been {ruleState == RuleState.On} but RuleEnabled returned {ruleState != RuleState.On}.'"); + + var totalUpdates = await mockGitHubEventClient.ProcessPendingUpdates(issueEventPayload.Repository.Id, issueEventPayload.Issue.Number); + if (RuleState.On == ruleState) + { + // There should be one update, an IssueUpdate with the NoRecentActivity label removed + Assert.AreEqual(1, totalUpdates, $"The number of updates should have been 1 but was instead, {totalUpdates}"); + + // Retrieve the IssueUpdate and verify the expected changes + var issueUpdate = mockGitHubEventClient.GetIssueUpdate(); + Assert.IsNotNull(issueUpdate, $"{rule} is {ruleState} and should have produced an IssueUpdate with {LabelConstants.IssueAddressed} removed."); + // Verify that IssueAddressed was removed + Assert.False(issueUpdate.Labels.Contains(LabelConstants.IssueAddressed), $"IssueUpdate contains {LabelConstants.IssueAddressed} label which should have been removed."); + } + else + { + Assert.AreEqual(0, totalUpdates, $"{rule} is {ruleState} and should not have produced any updates."); + } + } + } +} diff --git a/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Static/PullRequestCommentProcessingTests.cs b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Static/PullRequestCommentProcessingTests.cs new file mode 100644 index 00000000000..f92f3960ba0 --- /dev/null +++ b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Static/PullRequestCommentProcessingTests.cs @@ -0,0 +1,130 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Azure.Sdk.Tools.GitHubEventProcessor.Constants; +using Azure.Sdk.Tools.GitHubEventProcessor.EventProcessing; +using Azure.Sdk.Tools.GitHubEventProcessor.Utils; +using NUnit.Framework; +using Octokit; + +namespace Azure.Sdk.Tools.GitHubEventProcessor.Tests.Static +{ + [TestFixture] + [Parallelizable(ParallelScope.Children)] + public class PullRequestCommentProcessingTests : ProcessingTestBase + { + /// + /// Test ResetPullRequestActivity rule enabled/disabled, with a payload that would cause updates when enabled. + /// Verify all the expected updates when enabled and no updates when disabled. + /// + /// String, RulesConstants for the rule being tested + /// JSon payload file for the event being tested + /// Whether or not the rule is on/off + /// Whether or not the commenter has write/admin permissions or is the PR author + [Category("static")] + [TestCase(RulesConstants.ResetPullRequestActivity, "Tests.JsonEventPayloads/ResetPullRequestActivity_pr_comment_created_creator_is_author.json", RuleState.On, true)] + [TestCase(RulesConstants.ResetPullRequestActivity, "Tests.JsonEventPayloads/ResetPullRequestActivity_pr_comment_created_creator_is_author.json", RuleState.Off, true)] + [TestCase(RulesConstants.ResetPullRequestActivity, "Tests.JsonEventPayloads/ResetPullRequestActivity_pr_comment_created_creator_is_not_author.json", RuleState.On, true)] + [TestCase(RulesConstants.ResetPullRequestActivity, "Tests.JsonEventPayloads/ResetPullRequestActivity_pr_comment_created_creator_is_not_author.json", RuleState.On, false)] + public async Task TestResetPullRequestActivity(string rule, string payloadFile, RuleState ruleState, bool commenterHasPermissionOrIsAuthor) + { + var mockGitHubEventClient = new MockGitHubEventClient(OrgConstants.ProductHeaderName); + mockGitHubEventClient.RulesConfiguration.Rules[rule] = ruleState; + var rawJson = TestHelpers.GetTestEventPayload(payloadFile); + var prCommentPayload = SimpleJsonSerializer.Deserialize(rawJson); + // Set the return value for the permission check. In the case where the commenter is not the author, the label + // will only be removed if they have write or admin collaborator permissions. + mockGitHubEventClient.UserHasPermissionsReturn = commenterHasPermissionOrIsAuthor; + await PullRequestCommentProcessing.ResetPullRequestActivity(mockGitHubEventClient, prCommentPayload); + + // Verify the RuleCheck + Assert.AreEqual(ruleState == RuleState.On, mockGitHubEventClient.RulesConfiguration.RuleEnabled(rule), $"Rule '{rule}' enabled should have been {ruleState == RuleState.On} but RuleEnabled returned {ruleState != RuleState.On}.'"); + + var totalUpdates = await mockGitHubEventClient.ProcessPendingUpdates(prCommentPayload.Repository.Id, prCommentPayload.Issue.Number); + if (RuleState.On == ruleState) + { + if (commenterHasPermissionOrIsAuthor) + { + // There should be one update, an IssueUpdate with the no-recent-activity removed + Assert.AreEqual(1, totalUpdates, $"The number of updates should have been 1 but was instead, {totalUpdates}"); + // Retrieve the IssueUpdate and verify the expected changes + var issueUpdate = mockGitHubEventClient.GetIssueUpdate(); + Assert.IsNotNull(issueUpdate, $"{rule} is {ruleState} and should have produced an IssueUpdate with {LabelConstants.NoRecentActivity} removed."); + // Verify that NeedsAuthorFeedback was removed + Assert.False(issueUpdate.Labels.Contains(LabelConstants.NoRecentActivity), $"IssueUpdate contains {LabelConstants.NoRecentActivity} label which should have been removed."); + } + else + { + Assert.AreEqual(0, totalUpdates, $"Without Admin or Write permissions the number of updaes should have been 0 but was instead, {totalUpdates}"); + } + } + else + { + Assert.AreEqual(0, totalUpdates, $"The number of updates should have been 0 but was instead, {totalUpdates}"); + Assert.IsNull(mockGitHubEventClient.GetIssueUpdate(), $"{rule} is {ruleState} and should not have produced an IssueUpdate."); + } + } + + /// + /// Test ReopenPullRequest rule enabled/disabled, with a payload that would cause updates when enabled. + /// Verify all the expected updates when enabled and no updates when disabled. + /// + /// String, RulesConstants for the rule being tested + /// JSon payload file for the event being tested + /// Whether or not the rule is on/off + /// Whether or not the commenter has write/admin permissions or is the PR author + [Category("static")] + [TestCase(RulesConstants.ReopenPullRequest, "Tests.JsonEventPayloads/ReopenPullRequest_pr_comment_created_creator_is_author.json", RuleState.On, true)] + [TestCase(RulesConstants.ReopenPullRequest, "Tests.JsonEventPayloads/ReopenPullRequest_pr_comment_created_creator_is_author.json", RuleState.Off, true)] + [TestCase(RulesConstants.ReopenPullRequest, "Tests.JsonEventPayloads/ReopenPullRequest_pr_comment_created_creator_is_not_author.json", RuleState.On, true)] + [TestCase(RulesConstants.ReopenPullRequest, "Tests.JsonEventPayloads/ReopenPullRequest_pr_comment_created_creator_is_not_author.json", RuleState.On, false)] + public async Task TestReopenPullRequest(string rule, string payloadFile, RuleState ruleState, bool commenterHasPermissionOrIsAuthor) + { + var mockGitHubEventClient = new MockGitHubEventClient(OrgConstants.ProductHeaderName); + mockGitHubEventClient.RulesConfiguration.Rules[rule] = ruleState; + var rawJson = TestHelpers.GetTestEventPayload(payloadFile); + var prCommentPayload = SimpleJsonSerializer.Deserialize(rawJson); + // Set the return value for the permission check. In the case where the commenter is not the author, the label + // will only be removed if they have write or admin collaborator permissions and, if not, a comment will be created. + mockGitHubEventClient.UserHasPermissionsReturn = commenterHasPermissionOrIsAuthor; + await PullRequestCommentProcessing.ReopenPullRequest(mockGitHubEventClient, prCommentPayload); + + // Verify the RuleCheck + Assert.AreEqual(ruleState == RuleState.On, mockGitHubEventClient.RulesConfiguration.RuleEnabled(rule), $"Rule '{rule}' enabled should have been {ruleState == RuleState.On} but RuleEnabled returned {ruleState != RuleState.On}.'"); + + var totalUpdates = await mockGitHubEventClient.ProcessPendingUpdates(prCommentPayload.Repository.Id, prCommentPayload.Issue.Number); + if (RuleState.On == ruleState) + { + // There should be one update, an IssueUpdate with the no-recent-activity removed + Assert.AreEqual(1, totalUpdates, $"The number of updates should have been 1 but was instead, {totalUpdates}"); + + if (commenterHasPermissionOrIsAuthor) + { + var issueUpdate = mockGitHubEventClient.GetIssueUpdate(); + // Verify the IssueUpdate is not null + Assert.IsNotNull(issueUpdate, $"{rule} is {ruleState} and should have produced an IssueUpdate."); + // Verify the IssueUpdate contains the following changes: + // State = ItemState.Open + Assert.AreEqual(issueUpdate.State, ItemState.Open, $"IssueUpdate's state should be ItemState.Open and was not."); + // Verify that NoRecentActivity was removed + Assert.False(issueUpdate.Labels.Contains(LabelConstants.NoRecentActivity), $"IssueUpdate contains {LabelConstants.NoRecentActivity} label which should have been removed."); + } + else + { + // Verify the IssueUpdate is null + Assert.IsNull(mockGitHubEventClient.GetIssueUpdate(), $"{rule} is {ruleState} and should have produced an IssueUpdate when the commenter isn't the issue author and doesn't have collaborator permissions."); + // There should be a single comment created + int numComments = mockGitHubEventClient.GetComments().Count; + Assert.AreEqual(1, numComments, $"There should have been a single comment created but instead {numComments} were created."); + } + } + else + { + Assert.AreEqual(0, totalUpdates, $"{rule} is {ruleState} and should not have produced any updates."); + Assert.IsNull(mockGitHubEventClient.GetIssueUpdate(), $"{rule} is {ruleState} and should not have produced an IssueUpdate."); + } + } + } +} diff --git a/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Static/PullRequestProcessingTests.cs b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Static/PullRequestProcessingTests.cs new file mode 100644 index 00000000000..fa27ad5619b --- /dev/null +++ b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Static/PullRequestProcessingTests.cs @@ -0,0 +1,221 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Azure.Sdk.Tools.GitHubEventProcessor.Constants; +using Azure.Sdk.Tools.GitHubEventProcessor.EventProcessing; +using Azure.Sdk.Tools.GitHubEventProcessor.GitHubPayload; +using Azure.Sdk.Tools.GitHubEventProcessor.Utils; +using NUnit.Framework; +using Octokit; + +namespace Azure.Sdk.Tools.GitHubEventProcessor.Tests.Static +{ + [TestFixture] + [Parallelizable(ParallelScope.Children)] + public class PullRequestProcessingTests : ProcessingTestBase + { + + /// + /// Test ResetPullRequestActivity rule enabled/disabled, with a payload that would cause updates when enabled. + /// Verify all the expected updates when enabled and no updates when disabled. + /// Trigger: pull request opened + /// Conditions: Pull request has no labels + /// Resulting Action: + /// Evaluate the path for each file in the PR, if the path has a label, add the label to the issue + /// If the sender is not a Collaborator OR, if they are a collaborator without Write/Admin permissions + /// Add "customer-reported" label + /// Add "Community Contribution" label + /// Create issue comment: "Thank you for your contribution @{issueAuthor} ! We will review the pull request and get back to you soon." + /// + /// String, RulesConstants for the rule being tested + /// JSon payload file for the event being tested + /// Whether or not the rule is on/off + /// Whether or not the PR creator has write or admin permissions + [Category("static")] + [NonParallelizable] + [TestCase(RulesConstants.PullRequestTriage, "Tests.JsonEventPayloads/PullRequestTriage_pr_opened_no_labels.json", RuleState.On, true)] + [TestCase(RulesConstants.PullRequestTriage, "Tests.JsonEventPayloads/PullRequestTriage_pr_opened_no_labels.json", RuleState.On, false)] + [TestCase(RulesConstants.PullRequestTriage, "Tests.JsonEventPayloads/PullRequestTriage_pr_opened_no_labels.json", RuleState.Off, false)] + public async Task TestPullRequestTriage(string rule, string payloadFile, RuleState ruleState, bool hasWriteOrAdmin) + { + var mockGitHubEventClient = new MockGitHubEventClient(OrgConstants.ProductHeaderName); + mockGitHubEventClient.RulesConfiguration.Rules[rule] = ruleState; + mockGitHubEventClient.UserHasPermissionsReturn = hasWriteOrAdmin; + var rawJson = TestHelpers.GetTestEventPayload(payloadFile); + var prEventPayload = PullRequestProcessing.DeserializePullRequest(rawJson, SimpleJsonSerializer); + + // Set the path to the fake CODEOWNERS file to be used for testing + CodeOwnerUtils.ResetCodeOwnerEntries(); + CodeOwnerUtils.codeOwnersFilePathOverride = "Tests.FakeCodeowners/PullRequestTriage_CODEOWNERS"; + Dictionary prFilesAndLabels = new Dictionary + { + { "/files/filePath2/file2", "FakeLabel2" }, + { "/files/filePath4/file1", "FakeLabel4" }, + { "/files/filePath7/file3", "FakeLabel7" }, + { "/files/filePath8/file4", "FakeLabel8" } + }; + mockGitHubEventClient.CreateFakePullRequestFiles(prFilesAndLabels.Keys.ToList()); + await PullRequestProcessing.PullRequestTriage(mockGitHubEventClient, prEventPayload); + + // Verify the RuleCheck + Assert.AreEqual(ruleState == RuleState.On, mockGitHubEventClient.RulesConfiguration.RuleEnabled(rule), $"Rule '{rule}' enabled should have been {ruleState == RuleState.On} but RuleEnabled returned {ruleState != RuleState.On}.'"); + + var totalUpdates = await mockGitHubEventClient.ProcessPendingUpdates(prEventPayload.Repository.Id, prEventPayload.PullRequest.Number); + if (RuleState.On == ruleState) + { + // Regardless of whether or not the user has Write or Admin permissions, the prFiles should cause 4 labels to get added + // which means an issueUpdate will be created + int expectedUpdates = 1; + + if (hasWriteOrAdmin) + { + // There should be one update, an IssueUpdate with the NoRecentActivity label removed + Assert.AreEqual(expectedUpdates, totalUpdates, $"The number of updates for a user having Write or Admin permission should have been {expectedUpdates} but was instead, {totalUpdates}"); + } + // If the user doesn't have Write or Admin permissions then "customer-reported" and "Community Contribution" labels + // will be added and a single comment will be created + else + { + expectedUpdates++; + // Along with the label updates, there should also be a comment added. + Assert.AreEqual(expectedUpdates, totalUpdates, $"The number of updates for a user without Write or Admin permission should have been {expectedUpdates} but was instead, {totalUpdates}"); + } + // Retrieve the IssueUpdate and verify the expected changes + var issueUpdate = mockGitHubEventClient.GetIssueUpdate(); + Assert.IsNotNull(issueUpdate, $"{rule} is {ruleState} and should have produced an IssueUpdate with added labels."); + + // Regardless of permissions, all of the labels based on PR file paths should be added + foreach (string label in prFilesAndLabels.Values.ToList()) + { + Assert.True(issueUpdate.Labels.Contains(label), $"label {label} should have been added because of the file paths in the PR but was not."); + } + + if (hasWriteOrAdmin) + { + Assert.False(issueUpdate.Labels.Contains(LabelConstants.CustomerReported), $"User has write or admin permission, IssueUpdate should not contain {LabelConstants.CustomerReported}."); + Assert.False(issueUpdate.Labels.Contains(LabelConstants.CommunityContribution), $"User has write or admin permission, IssueUpdate should not contain {LabelConstants.CommunityContribution}."); + } + else + { + // Without Admin or Write permissions there should be two additional labels and a comment added + Assert.True(issueUpdate.Labels.Contains(LabelConstants.CustomerReported), $"User does not have write or admin permission, IssueUpdate should contain {LabelConstants.CustomerReported}."); + Assert.True(issueUpdate.Labels.Contains(LabelConstants.CommunityContribution), $"User does not have write or admin permission, IssueUpdate should contain {LabelConstants.CommunityContribution}."); + Assert.AreEqual(1, mockGitHubEventClient.GetComments().Count, "Without admin or write permission there should have been a comment added."); + } + + } + else + { + Assert.AreEqual(0, totalUpdates, $"{rule} is {ruleState} and should not have produced any updates."); + Assert.IsNull(mockGitHubEventClient.GetIssueUpdate(), $"{rule} is {ruleState} and should not have produced an IssueUpdate."); + } + } + + /// + /// Test ResetPullRequestActivity rule enabled/disabled, with a payload that would cause updates when enabled. + /// Verify all the expected updates when enabled and no updates when disabled. + /// Conditions for pull_request triggers, except for merge + /// Pull request is open. + /// Action is reopen, synchronize (changed pushed) or review requested + /// Conditions for pull_request merge + /// Pull request is closed. + /// Action is open with PullRequest.Merged = true + /// + /// String, RulesConstants for the rule being tested + /// JSon payload file for the event being tested + /// Whether or not the rule is on/off + [Category("static")] + [TestCase(RulesConstants.ResetPullRequestActivity, "Tests.JsonEventPayloads/ResetPullRequestActivity_pr_reopened.json", RuleState.On)] + [TestCase(RulesConstants.ResetPullRequestActivity, "Tests.JsonEventPayloads/ResetPullRequestActivity_pr_reopened.json", RuleState.Off)] + [TestCase(RulesConstants.ResetPullRequestActivity, "Tests.JsonEventPayloads/ResetPullRequestActivity_pr_review_requested.json", RuleState.On)] + [TestCase(RulesConstants.ResetPullRequestActivity, "Tests.JsonEventPayloads/ResetPullRequestActivity_pr_synchronize.json", RuleState.On)] + [TestCase(RulesConstants.ResetPullRequestActivity, "Tests.JsonEventPayloads/ResetPullRequestActivity_pr_closed_merged.json", RuleState.On)] + public async Task TestResetPullRequestActivity(string rule, string payloadFile, RuleState ruleState) + { + var mockGitHubEventClient = new MockGitHubEventClient(OrgConstants.ProductHeaderName); + mockGitHubEventClient.RulesConfiguration.Rules[rule] = ruleState; + var rawJson = TestHelpers.GetTestEventPayload(payloadFile); + var prEventPayload = PullRequestProcessing.DeserializePullRequest(rawJson, SimpleJsonSerializer); + PullRequestProcessing.ResetPullRequestActivity(mockGitHubEventClient, prEventPayload); + + // Verify the RuleCheck + Assert.AreEqual(ruleState == RuleState.On, mockGitHubEventClient.RulesConfiguration.RuleEnabled(rule), $"Rule '{rule}' enabled should have been {ruleState == RuleState.On} but RuleEnabled returned {ruleState != RuleState.On}.'"); + + var totalUpdates = await mockGitHubEventClient.ProcessPendingUpdates(prEventPayload.Repository.Id, prEventPayload.PullRequest.Number); + if (RuleState.On == ruleState) + { + // There should be one update, an IssueUpdate with the NoRecentActivity label removed + Assert.AreEqual(1, totalUpdates, $"The number of updates should have been 1 but was instead, {totalUpdates}"); + + // Retrieve the IssueUpdate and verify the expected changes + var issueUpdate = mockGitHubEventClient.GetIssueUpdate(); + Assert.IsNotNull(issueUpdate, $"{rule} is {ruleState} and should have produced an IssueUpdate with {LabelConstants.NoRecentActivity} removed."); + // Verify that NeedsAuthorFeedback was removed + Assert.False(issueUpdate.Labels.Contains(LabelConstants.NoRecentActivity), $"IssueUpdate contains {LabelConstants.NoRecentActivity} label which should have been removed."); + } + else + { + Assert.AreEqual(0, totalUpdates, $"{rule} is {ruleState} and should not have produced any updates."); + Assert.IsNull(mockGitHubEventClient.GetIssueUpdate(), $"{rule} is {ruleState} and should not have produced an IssueUpdate."); + } + } + + /// + /// Test ResetPullRequestActivity rule enabled/disabled, with a payload that would cause updates when enabled. + /// Verify all the expected updates when enabled and no updates when disabled. + /// Conditions for pull_request triggers, except for merge + /// Pull request is open. + /// Action is reopen, synchronize (changed pushed) or review requested + /// Conditions for pull_request merge + /// Pull request is closed. + /// Action is open with PullRequest.Merged = true + /// + /// String, RulesConstants for the rule being tested + /// JSon payload file for the event being tested + /// Whether or not the rule is on/off + /// Number of approved reviews the PR has + /// Number of not approved reviews the PR has + [Category("static")] + [TestCase(RulesConstants.ResetApprovalsForUntrustedChanges, "Tests.JsonEventPayloads/ResetApprovalsForUntrustedChanges_pr_synchronize.json", RuleState.Off, 0, 0)] + [TestCase(RulesConstants.ResetApprovalsForUntrustedChanges, "Tests.JsonEventPayloads/ResetApprovalsForUntrustedChanges_pr_synchronize.json", RuleState.On, 0, 0)] + [TestCase(RulesConstants.ResetApprovalsForUntrustedChanges, "Tests.JsonEventPayloads/ResetApprovalsForUntrustedChanges_pr_synchronize.json", RuleState.On, 2, 0)] + [TestCase(RulesConstants.ResetApprovalsForUntrustedChanges, "Tests.JsonEventPayloads/ResetApprovalsForUntrustedChanges_pr_synchronize.json", RuleState.On, 0, 3)] + [TestCase(RulesConstants.ResetApprovalsForUntrustedChanges, "Tests.JsonEventPayloads/ResetApprovalsForUntrustedChanges_pr_synchronize.json", RuleState.On, 4, 5)] + public async Task TestResetApprovalsForUntrustedChanges(string rule, string payloadFile, RuleState ruleState, int approvedReviews, int notApprovedReviews) + { + var mockGitHubEventClient = new MockGitHubEventClient(OrgConstants.ProductHeaderName); + mockGitHubEventClient.RulesConfiguration.Rules[rule] = ruleState; + var rawJson = TestHelpers.GetTestEventPayload(payloadFile); + var prEventPayload = PullRequestProcessing.DeserializePullRequest(rawJson, SimpleJsonSerializer); + + // Set the return value for the permission check. The rull will only process if the user does not have permissions. + mockGitHubEventClient.UserHasPermissionsReturn = false; + // Create the fake reviews that the rule will requery for + mockGitHubEventClient.CreateFakeReviewsForPullRequest(approvedReviews, notApprovedReviews); + await PullRequestProcessing.ResetApprovalsForUntrustedChanges(mockGitHubEventClient, prEventPayload); + + // Verify the RuleCheck + Assert.AreEqual(ruleState == RuleState.On, mockGitHubEventClient.RulesConfiguration.RuleEnabled(rule), $"Rule '{rule}' enabled should have been {ruleState == RuleState.On} but RuleEnabled returned {ruleState != RuleState.On}.'"); + + var totalUpdates = await mockGitHubEventClient.ProcessPendingUpdates(prEventPayload.Repository.Id, prEventPayload.PullRequest.Number); + if (RuleState.On == ruleState) + { + // Regardless of whether or not there are reviews to process, if someone untrusted pushes changes, there will + // always be one comment. The total number of updates should be 1 (comment) + approvedReviews + int expectedUpdates = 1 + approvedReviews; + Assert.AreEqual(expectedUpdates, totalUpdates, $"The number of updates should have been {expectedUpdates} (1 + number of approved reviews) but was instead, {totalUpdates}"); + + int numComments = mockGitHubEventClient.GetComments().Count; + Assert.AreEqual(1, numComments, $"There should have been a single comment created but instead {numComments} were created."); + int numDismissedReviews = mockGitHubEventClient.GetReviewDismissals().Count; + Assert.AreEqual(approvedReviews, numDismissedReviews, $"The number of approved reviews {approvedReviews} does not equal the number of dismissed reviews {numDismissedReviews}."); + } + else + { + Assert.AreEqual(0, totalUpdates, $"{rule} is {ruleState} and should not have produced any updates."); + } + } + } +} diff --git a/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Static/PullRequestReviewProcessingTests.cs b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Static/PullRequestReviewProcessingTests.cs new file mode 100644 index 00000000000..97d8309e693 --- /dev/null +++ b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Static/PullRequestReviewProcessingTests.cs @@ -0,0 +1,60 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Azure.Sdk.Tools.GitHubEventProcessor.Constants; +using Azure.Sdk.Tools.GitHubEventProcessor.EventProcessing; +using Azure.Sdk.Tools.GitHubEventProcessor.Utils; +using NUnit.Framework; +using Octokit.Internal; +using Octokit; + +namespace Azure.Sdk.Tools.GitHubEventProcessor.Tests.Static +{ + [TestFixture] + [Parallelizable(ParallelScope.Children)] + public class PullRequestReviewProcessingTests : ProcessingTestBase + { + /// + /// Test ResetPullRequestActivity rule enabled/disabled, with a payload that would cause updates when enabled. + /// Verify all the expected updates when enabled and no updates when disabled. + /// This rule has a pull_request_review trigger + /// + /// String, RulesConstants for the rule being tested + /// JSon payload file for the event being tested + /// Whether or not the rule is on/off + [Category("static")] + [TestCase(RulesConstants.ResetPullRequestActivity, "Tests.JsonEventPayloads/ResetPullRequestActivity_pr_reviewed.json", RuleState.On)] + [TestCase(RulesConstants.ResetPullRequestActivity, "Tests.JsonEventPayloads/ResetPullRequestActivity_pr_reviewed.json", RuleState.Off)] + public async Task TestResetPullRequestActivity(string rule, string payloadFile, RuleState ruleState) + { + var mockGitHubEventClient = new MockGitHubEventClient(OrgConstants.ProductHeaderName); + mockGitHubEventClient.RulesConfiguration.Rules[rule] = ruleState; + var rawJson = TestHelpers.GetTestEventPayload(payloadFile); + var prReviewEventPayload = SimpleJsonSerializer.Deserialize(rawJson); + PullRequestReviewProcessing.ResetPullRequestActivity(mockGitHubEventClient, prReviewEventPayload); + + // Verify the RuleCheck + Assert.AreEqual(ruleState == RuleState.On, mockGitHubEventClient.RulesConfiguration.RuleEnabled(rule), $"Rule '{rule}' enabled should have been {ruleState == RuleState.On} but RuleEnabled returned {ruleState != RuleState.On}.'"); + + var totalUpdates = await mockGitHubEventClient.ProcessPendingUpdates(prReviewEventPayload.Repository.Id, prReviewEventPayload.PullRequest.Number); + if (RuleState.On == ruleState) + { + // There should be one update, an IssueUpdate with the NoRecentActivity label removed + Assert.AreEqual(1, totalUpdates, $"The number of updates should have been 1 but was instead, {totalUpdates}"); + + // Retrieve the IssueUpdate and verify the expected changes + var issueUpdate = mockGitHubEventClient.GetIssueUpdate(); + Assert.IsNotNull(issueUpdate, $"{rule} is {ruleState} and should have produced an IssueUpdate with {LabelConstants.NoRecentActivity} removed."); + // Verify that NeedsAuthorFeedback was removed + Assert.False(issueUpdate.Labels.Contains(LabelConstants.NoRecentActivity), $"IssueUpdate contains {LabelConstants.NoRecentActivity} label which should have been removed."); + } + else + { + Assert.AreEqual(0, totalUpdates, $"{rule} is {ruleState} and should not have produced any updates."); + Assert.IsNull(mockGitHubEventClient.GetIssueUpdate(), $"{rule} is {ruleState} and should not have produced an IssueUpdate."); + } + } + } +} diff --git a/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Static/ScheduledEventProcessingTests.cs b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Static/ScheduledEventProcessingTests.cs new file mode 100644 index 00000000000..ea200a1e2df --- /dev/null +++ b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Static/ScheduledEventProcessingTests.cs @@ -0,0 +1,279 @@ +using Azure.Sdk.Tools.GitHubEventProcessor.Constants; +using Azure.Sdk.Tools.GitHubEventProcessor.EventProcessing; +using Azure.Sdk.Tools.GitHubEventProcessor.GitHubPayload; +using Azure.Sdk.Tools.GitHubEventProcessor.Utils; +using NUnit.Framework; +using Octokit; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Azure.Sdk.Tools.GitHubEventProcessor.Tests.Static +{ + // Note: All of the Scheduled Event tests will use the same payload. There's nothing in the + // mocked payload that's necessary for processing. + [TestFixture] + [Parallelizable(ParallelScope.Children)] + + public class ScheduledEventProcessingTests : ProcessingTestBase + { + /// + /// Test the CloseAddressedIssues scheduled event. + /// Each item returned from the query will have two updates: + /// Issue will be closed + /// Issue will have a comment added + /// + /// String, RulesConstants for the rule being tested + /// JSon payload file for the event being tested + /// Whether or not the rule is on/off + [Category("static")] + [TestCase(RulesConstants.CloseAddressedIssues, "Tests.JsonEventPayloads/ScheduledEvent_payload.json", RuleState.On)] + [TestCase(RulesConstants.CloseAddressedIssues, "Tests.JsonEventPayloads/ScheduledEvent_payload.json", RuleState.Off)] + public async Task TestCloseAddressedIssues(string rule, string payloadFile, RuleState ruleState) + { + int expectedUpdates = 100; + var mockGitHubEventClient = new MockGitHubEventClient(OrgConstants.ProductHeaderName); + mockGitHubEventClient.RulesConfiguration.Rules[rule] = ruleState; + var rawJson = TestHelpers.GetTestEventPayload(payloadFile); + ScheduledEventGitHubPayload scheduledEventPayload = SimpleJsonSerializer.Deserialize(rawJson); + // Create the fake issues to update. Because CloseAddressedIssues does 2 updates per issue + // creating 100 results should only result in 50 issues being updated and 50 comments created + mockGitHubEventClient.CreateSearchIssuesResult(expectedUpdates, scheduledEventPayload.Repository, ItemState.Open); + await ScheduledEventProcessing.CloseAddressedIssues(mockGitHubEventClient, scheduledEventPayload); + + var totalUpdates = await mockGitHubEventClient.ProcessPendingUpdates(scheduledEventPayload.Repository.Id); + // Verify the RuleCheck + Assert.AreEqual(ruleState == RuleState.On, mockGitHubEventClient.RulesConfiguration.RuleEnabled(rule), $"Rule '{rule}' enabled should have been {ruleState == RuleState.On} but RuleEnabled returned {ruleState != RuleState.On}.'"); + if (RuleState.On == ruleState) + { + Assert.AreEqual(expectedUpdates, totalUpdates, $"The number of updates should have been {expectedUpdates} but was instead, {totalUpdates}"); + // There should be expectedUpdates/2 issueUpdates and expectedUpdates/2 comments + int numIssueUpdates = mockGitHubEventClient.GetGitHubIssuesToUpdate().Count; + Assert.AreEqual(expectedUpdates / 2, numIssueUpdates, $"The number of issue updates should have been {expectedUpdates / 2} but was instead, {numIssueUpdates}"); + int numComments = mockGitHubEventClient.GetComments().Count; + Assert.AreEqual(expectedUpdates/2, numComments, $"The number of comments should have been {expectedUpdates / 2} but was instead, {numComments}"); + + // The rule sets all of the Issue's States to ItemState.Closed. Only one needs to be verified + Assert.AreEqual(mockGitHubEventClient.GetGitHubIssuesToUpdate()[0].IssueUpdate.State, ItemState.Closed, $"rule should have set all processed issues to {ItemState.Closed} and did not."); + } + else + { + Assert.AreEqual(0, totalUpdates, $"{rule} is {ruleState} and should not have produced any updates."); + } + } + + /// + /// Test the CloseStaleIssues scheduled event. + /// Each item returned from the query will have one update: + /// Issue will be closed + /// + /// String, RulesConstants for the rule being tested + /// JSon payload file for the event being tested + /// Whether or not the rule is on/off + [Category("static")] + [TestCase(RulesConstants.CloseStaleIssues, "Tests.JsonEventPayloads/ScheduledEvent_payload.json", RuleState.On)] + [TestCase(RulesConstants.CloseStaleIssues, "Tests.JsonEventPayloads/ScheduledEvent_payload.json", RuleState.Off)] + public async Task TestCloseStaleIssues(string rule, string payloadFile, RuleState ruleState) + { + int expectedUpdates = 100; + var mockGitHubEventClient = new MockGitHubEventClient(OrgConstants.ProductHeaderName); + mockGitHubEventClient.RulesConfiguration.Rules[rule] = ruleState; + var rawJson = TestHelpers.GetTestEventPayload(payloadFile); + ScheduledEventGitHubPayload scheduledEventPayload = SimpleJsonSerializer.Deserialize(rawJson); + // Create the fake issues to update. + mockGitHubEventClient.CreateSearchIssuesResult(expectedUpdates, scheduledEventPayload.Repository, ItemState.Open); + await ScheduledEventProcessing.CloseStaleIssues(mockGitHubEventClient, scheduledEventPayload); + + var totalUpdates = await mockGitHubEventClient.ProcessPendingUpdates(scheduledEventPayload.Repository.Id); + // Verify the RuleCheck + Assert.AreEqual(ruleState == RuleState.On, mockGitHubEventClient.RulesConfiguration.RuleEnabled(rule), $"Rule '{rule}' enabled should have been {ruleState == RuleState.On} but RuleEnabled returned {ruleState != RuleState.On}.'"); + if (RuleState.On == ruleState) + { + Assert.AreEqual(expectedUpdates, totalUpdates, $"The number of updates should have been {expectedUpdates} but was instead, {totalUpdates}"); + int numIssueUpdates = mockGitHubEventClient.GetGitHubIssuesToUpdate().Count; + Assert.AreEqual(expectedUpdates, numIssueUpdates, $"The number of issue updates should have been {expectedUpdates} but was instead, {numIssueUpdates}"); + + // The rule sets all of the Issue's States to ItemState.Closed. Only one needs to be verified + Assert.AreEqual(mockGitHubEventClient.GetGitHubIssuesToUpdate()[0].IssueUpdate.State, ItemState.Closed, $"rule should have set all processed issues to {ItemState.Closed} and did not."); + } + else + { + Assert.AreEqual(0, totalUpdates, $"{rule} is {ruleState} and should not have produced any updates."); + } + } + + /// + /// Test the CloseStalePullRequests scheduled event. + /// Each item returned from the query will have two updates: + /// PullRequest will be closed + /// PullRequest will have a comment added + /// + /// String, RulesConstants for the rule being tested + /// JSon payload file for the event being tested + /// Whether or not the rule is on/off + [Category("static")] + [TestCase(RulesConstants.CloseStalePullRequests, "Tests.JsonEventPayloads/ScheduledEvent_payload.json", RuleState.On)] + [TestCase(RulesConstants.CloseStalePullRequests, "Tests.JsonEventPayloads/ScheduledEvent_payload.json", RuleState.Off)] + public async Task TestCloseStalePullRequests(string rule, string payloadFile, RuleState ruleState) + { + int expectedUpdates = 100; + var mockGitHubEventClient = new MockGitHubEventClient(OrgConstants.ProductHeaderName); + mockGitHubEventClient.RulesConfiguration.Rules[rule] = ruleState; + var rawJson = TestHelpers.GetTestEventPayload(payloadFile); + ScheduledEventGitHubPayload scheduledEventPayload = SimpleJsonSerializer.Deserialize(rawJson); + // Create the fake issues to update. Because CloseStalePullRequests does 2 updates per issue + // creating 100 results should only result in 50 issues being updated and 50 comments created + mockGitHubEventClient.CreateSearchIssuesResult(expectedUpdates, scheduledEventPayload.Repository, ItemState.Open); + await ScheduledEventProcessing.CloseStalePullRequests(mockGitHubEventClient, scheduledEventPayload); + + var totalUpdates = await mockGitHubEventClient.ProcessPendingUpdates(scheduledEventPayload.Repository.Id); + // Verify the RuleCheck + Assert.AreEqual(ruleState == RuleState.On, mockGitHubEventClient.RulesConfiguration.RuleEnabled(rule), $"Rule '{rule}' enabled should have been {ruleState == RuleState.On} but RuleEnabled returned {ruleState != RuleState.On}.'"); + if (RuleState.On == ruleState) + { + Assert.AreEqual(expectedUpdates, totalUpdates, $"The number of updates should have been {expectedUpdates} but was instead, {totalUpdates}"); + // There should be expectedUpdates/2 issueUpdates and expectedUpdates/2 comments + int numIssueUpdates = mockGitHubEventClient.GetGitHubIssuesToUpdate().Count; + Assert.AreEqual(expectedUpdates / 2, numIssueUpdates, $"The number of issue updates should have been {expectedUpdates / 2} but was instead, {numIssueUpdates}"); + int numComments = mockGitHubEventClient.GetComments().Count; + Assert.AreEqual(expectedUpdates / 2, numComments, $"The number of comments should have been {expectedUpdates / 2} but was instead, {numComments}"); + + // The rule sets all of the Issue's States to ItemState.Closed. Only one needs to be verified + Assert.AreEqual(mockGitHubEventClient.GetGitHubIssuesToUpdate()[0].IssueUpdate.State, ItemState.Closed, $"rule should have set all processed pull requests to {ItemState.Closed} and did not."); + } + else + { + Assert.AreEqual(0, totalUpdates, $"{rule} is {ruleState} and should not have produced any updates."); + } + } + + /// + /// Test the IdentifyStalePullRequests scheduled event. + /// Each item returned from the query will have two updates: + /// PullRequest will have NoRecentActivity label added + /// PullRequest will have a comment added + /// + /// String, RulesConstants for the rule being tested + /// JSon payload file for the event being tested + /// Whether or not the rule is on/off + [Category("static")] + [TestCase(RulesConstants.IdentifyStalePullRequests, "Tests.JsonEventPayloads/ScheduledEvent_payload.json", RuleState.On)] + [TestCase(RulesConstants.IdentifyStalePullRequests, "Tests.JsonEventPayloads/ScheduledEvent_payload.json", RuleState.Off)] + public async Task TestIdentifyStalePullRequests(string rule, string payloadFile, RuleState ruleState) + { + int expectedUpdates = 100; + var mockGitHubEventClient = new MockGitHubEventClient(OrgConstants.ProductHeaderName); + mockGitHubEventClient.RulesConfiguration.Rules[rule] = ruleState; + var rawJson = TestHelpers.GetTestEventPayload(payloadFile); + ScheduledEventGitHubPayload scheduledEventPayload = SimpleJsonSerializer.Deserialize(rawJson); + // Create the fake issues to update. Because IdentifyStalePullRequests does 2 updates per issue + // creating 100 results should only result in 50 issues being updated and 50 comments created + mockGitHubEventClient.CreateSearchIssuesResult(expectedUpdates, scheduledEventPayload.Repository, ItemState.Open); + await ScheduledEventProcessing.IdentifyStalePullRequests(mockGitHubEventClient, scheduledEventPayload); + + var totalUpdates = await mockGitHubEventClient.ProcessPendingUpdates(scheduledEventPayload.Repository.Id); + // Verify the RuleCheck + Assert.AreEqual(ruleState == RuleState.On, mockGitHubEventClient.RulesConfiguration.RuleEnabled(rule), $"Rule '{rule}' enabled should have been {ruleState == RuleState.On} but RuleEnabled returned {ruleState != RuleState.On}.'"); + if (RuleState.On == ruleState) + { + Assert.AreEqual(expectedUpdates, totalUpdates, $"The number of updates should have been {expectedUpdates} but was instead, {totalUpdates}"); + // There should be expectedUpdates/2 issueUpdates and expectedUpdates/2 comments + int numIssueUpdates = mockGitHubEventClient.GetGitHubIssuesToUpdate().Count; + Assert.AreEqual(expectedUpdates / 2, numIssueUpdates, $"The number of issue updates should have been {expectedUpdates / 2} but was instead, {numIssueUpdates}"); + int numComments = mockGitHubEventClient.GetComments().Count; + Assert.AreEqual(expectedUpdates / 2, numComments, $"The number of comments should have been {expectedUpdates / 2} but was instead, {numComments}"); + + // Verify LabelConstants.NoRecentActivity was added + Assert.IsTrue(mockGitHubEventClient.GetGitHubIssuesToUpdate()[0].IssueUpdate.Labels.Contains(LabelConstants.NoRecentActivity), $"rule should have added {LabelConstants.NoRecentActivity} label and did not."); + } + else + { + Assert.AreEqual(0, totalUpdates, $"{rule} is {ruleState} and should not have produced any updates."); + } + } + + /// + /// Test the IdentifyStaleIssues scheduled event. + /// Each item returned from the query will have two updates: + /// Issue will have NoRecentActivity label added + /// Issue will have a comment added + /// + /// String, RulesConstants for the rule being tested + /// JSon payload file for the event being tested + /// Whether or not the rule is on/off + [Category("static")] + [TestCase(RulesConstants.IdentifyStaleIssues, "Tests.JsonEventPayloads/ScheduledEvent_payload.json", RuleState.On)] + [TestCase(RulesConstants.IdentifyStaleIssues, "Tests.JsonEventPayloads/ScheduledEvent_payload.json", RuleState.Off)] + public async Task TestIdentifyStaleIssues(string rule, string payloadFile, RuleState ruleState) + { + int expectedUpdates = 100; + var mockGitHubEventClient = new MockGitHubEventClient(OrgConstants.ProductHeaderName); + mockGitHubEventClient.RulesConfiguration.Rules[rule] = ruleState; + var rawJson = TestHelpers.GetTestEventPayload(payloadFile); + ScheduledEventGitHubPayload scheduledEventPayload = SimpleJsonSerializer.Deserialize(rawJson); + // Create the fake issues to update. Because IdentifyStaleIssues does 2 updates per issue + // creating 100 results should only result in 50 issues being updated and 50 comments created + mockGitHubEventClient.CreateSearchIssuesResult(expectedUpdates, scheduledEventPayload.Repository, ItemState.Open); + await ScheduledEventProcessing.IdentifyStaleIssues(mockGitHubEventClient, scheduledEventPayload); + + var totalUpdates = await mockGitHubEventClient.ProcessPendingUpdates(scheduledEventPayload.Repository.Id); + // Verify the RuleCheck + Assert.AreEqual(ruleState == RuleState.On, mockGitHubEventClient.RulesConfiguration.RuleEnabled(rule), $"Rule '{rule}' enabled should have been {ruleState == RuleState.On} but RuleEnabled returned {ruleState != RuleState.On}.'"); + if (RuleState.On == ruleState) + { + Assert.AreEqual(expectedUpdates, totalUpdates, $"The number of updates should have been {expectedUpdates} but was instead, {totalUpdates}"); + // There should be expectedUpdates/2 issueUpdates and expectedUpdates/2 comments + int numIssueUpdates = mockGitHubEventClient.GetGitHubIssuesToUpdate().Count; + Assert.AreEqual(expectedUpdates / 2, numIssueUpdates, $"The number of issue updates should have been {expectedUpdates / 2} but was instead, {numIssueUpdates}"); + int numComments = mockGitHubEventClient.GetComments().Count; + Assert.AreEqual(expectedUpdates / 2, numComments, $"The number of comments should have been {expectedUpdates / 2} but was instead, {numComments}"); + + // Verify LabelConstants.NoRecentActivity was added + Assert.IsTrue(mockGitHubEventClient.GetGitHubIssuesToUpdate()[0].IssueUpdate.Labels.Contains(LabelConstants.NoRecentActivity), $"rule should have added {LabelConstants.NoRecentActivity} label and did not."); + } + else + { + Assert.AreEqual(0, totalUpdates, $"{rule} is {ruleState} and should not have produced any updates."); + } + } + + /// + /// Test the LockClosedIssues scheduled event. + /// Each item returned from the query will have one update: + /// Issue will be locked + /// + /// String, RulesConstants for the rule being tested + /// JSon payload file for the event being tested + /// Whether or not the rule is on/off + [Category("static")] + [TestCase(RulesConstants.LockClosedIssues, "Tests.JsonEventPayloads/ScheduledEvent_payload.json", RuleState.On)] + [TestCase(RulesConstants.LockClosedIssues, "Tests.JsonEventPayloads/ScheduledEvent_payload.json", RuleState.Off)] + public async Task TestLockClosedIssues(string rule, string payloadFile, RuleState ruleState) + { + int expectedUpdates = 100; + var mockGitHubEventClient = new MockGitHubEventClient(OrgConstants.ProductHeaderName); + mockGitHubEventClient.RulesConfiguration.Rules[rule] = ruleState; + var rawJson = TestHelpers.GetTestEventPayload(payloadFile); + ScheduledEventGitHubPayload scheduledEventPayload = SimpleJsonSerializer.Deserialize(rawJson); + // Create the fake issues to update. + mockGitHubEventClient.CreateSearchIssuesResult(expectedUpdates, scheduledEventPayload.Repository, ItemState.Open); + await ScheduledEventProcessing.LockClosedIssues(mockGitHubEventClient, scheduledEventPayload); + + var totalUpdates = await mockGitHubEventClient.ProcessPendingUpdates(scheduledEventPayload.Repository.Id); + // Verify the RuleCheck + Assert.AreEqual(ruleState == RuleState.On, mockGitHubEventClient.RulesConfiguration.RuleEnabled(rule), $"Rule '{rule}' enabled should have been {ruleState == RuleState.On} but RuleEnabled returned {ruleState != RuleState.On}.'"); + if (RuleState.On == ruleState) + { + Assert.AreEqual(expectedUpdates, totalUpdates, $"The number of updates should have been {expectedUpdates} but was instead, {totalUpdates}"); + int numIssuesToLock = mockGitHubEventClient.GetGitHubIssuesToLock().Count; + Assert.AreEqual(expectedUpdates, numIssuesToLock, $"The number of issues to lock should have been {expectedUpdates} but was instead, {numIssuesToLock}"); + } + else + { + Assert.AreEqual(0, totalUpdates, $"{rule} is {ruleState} and should not have produced any updates."); + } + } + } +} diff --git a/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/TestHelpers.cs b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/TestHelpers.cs new file mode 100644 index 00000000000..b067f931025 --- /dev/null +++ b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/TestHelpers.cs @@ -0,0 +1,45 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Text.Json; + +namespace Azure.Sdk.Tools.GitHubEventProcessor.Tests +{ + public static class TestHelpers + { + public static string GetTestEventPayload(string eventJsonFile) + { + string rawJson = File.ReadAllText(eventJsonFile); + return rawJson; + } + + // There are some rules, like the issue_comment rule, ReopenIssue, that require the ClosedBy + // Date to be "less than 7 days ago" and with the static paylods, this won't quite work. Load + // the rawJson, + public static string SetClosedByDateToYesterday(string rawJson) + { + + DateTime yesterday = DateTime.UtcNow.AddDays(0 - 1); + DateTimeOffset yesterdayOffset = new DateTimeOffset(yesterday); + + using var doc = JsonDocument.Parse(rawJson); + // The actions event payload for a pull_request has a class on the pull request that + // the OctoKit.PullRequest class does not have. This will be null if the user the user + // does not have Auto-Merge enabled through the pull request UI and will be non-null if + // the user enabled it through the UI. An AutoMergeEnabled was added to the root of the + // PullRequestEventGitHubPayload class, which defaults to false. The actual information + // in the auto_merge is not necessary for any rules processing other than knowing whether + // or not it's been set. + var closedAtProp = doc.RootElement.GetProperty("issue").GetProperty("closed_at"); +#pragma warning disable CS8600 // Converting null literal or possible null value to non-nullable type. + string closedAt = closedAtProp.GetString(); +#pragma warning restore CS8600 // Converting null literal or possible null value to non-nullable type. +#pragma warning disable CS8604 // Possible null reference argument. + string newJson = rawJson.Replace(closedAt, yesterdayOffset.ToUniversalTime().ToString(yesterdayOffset.ToUniversalTime().ToString("yyyy'-'MM'-'dd'T'HH':'mm':'ss'Z'"))); +#pragma warning restore CS8604 // Possible null reference argument. + + return newJson; + } + + } +} diff --git a/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Tests.FakeCodeowners/PullRequestTriage_CODEOWNERS b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Tests.FakeCodeowners/PullRequestTriage_CODEOWNERS new file mode 100644 index 00000000000..a0eba3f31f0 --- /dev/null +++ b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Tests.FakeCodeowners/PullRequestTriage_CODEOWNERS @@ -0,0 +1,24 @@ +################ +# FAKE Codeownrs file for testing purposes +################ + +# PRLabel: %FakeLabel0 +/files/filePath0/ @FakeUser0 @FakeUser10 +# PRLabel: %FakeLabel1 +/files/filePath1/ @FakeUser1 +# PRLabel: %FakeLabel2 +/files/filePath2/ @FakeUser2 @FakeUser12 +# PRLabel: %FakeLabel3 +/files/filePath3/ @FakeUser3 +# PRLabel: %FakeLabel4 +/files/filePath4/ @FakeUser4 @FakeUser14 @FakeUser24 +# PRLabel: %FakeLabel5 +/files/filePath5/ @FakeUser5 +# PRLabel: %FakeLabel6 +/files/filePath6/ @FakeUser6 +# PRLabel: %FakeLabel7 +/files/filePath7/ @FakeUser7 @FakeUser17 +# PRLabel: %FakeLabel8 +/files/filePath8/ @FakeUser8 +# PRLabel: %FakeLabel9 +/files/filePath9/ @FakeUser9 diff --git a/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Tests.FakeCodeowners/ServiceAttention_does_not_have_CODEOWNERS b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Tests.FakeCodeowners/ServiceAttention_does_not_have_CODEOWNERS new file mode 100644 index 00000000000..6c1f70de032 --- /dev/null +++ b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Tests.FakeCodeowners/ServiceAttention_does_not_have_CODEOWNERS @@ -0,0 +1,24 @@ +################ +# FAKE Codeownrs file for testing purposes +################ + +# ServiceLabel: %FakeLabel0 %Service Attention +/files/filePath0/ @FakeUser0 +# PRLabel: %FakeLabel1 +/files/filePath1/ @FakeUser1 @FakeUser11 +# ServiceLabel: %FakeLabel2 %Service Attention +/files/filePath2/ @FakeUser2 @FakeUser12 +# ServiceLabel: %FakeLabel3 %Service Attention +/files/filePath3/ @FakeUser3 +# PRLabel: %FakeLabel4 +/files/filePath4/ @FakeUser4 @FakeUser14 @FakeUser24 +# ServiceLabel: %FakeLabel5 %Service Attention +/files/filePath5/ @FakeUser5 +# ServiceLabel: %FakeLabel6 %Service Attention +/files/filePath6/ @FakeUser6 +# ServiceLabel: %FakeLabel7 %Service Attention +/files/filePath7/ @FakeUser7 @FakeUser17 +# ServiceLabel: %FakeLabel8 %Service Attention +/files/filePath8/ @FakeUser8 +# PRLabel: %FakeLabel9 +/files/filePath9/ @FakeUser9 diff --git a/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Tests.FakeCodeowners/ServiceAttention_has_CODEOWNERS b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Tests.FakeCodeowners/ServiceAttention_has_CODEOWNERS new file mode 100644 index 00000000000..ff4027ac4a8 --- /dev/null +++ b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Tests.FakeCodeowners/ServiceAttention_has_CODEOWNERS @@ -0,0 +1,24 @@ +################ +# FAKE Codeownrs file for testing purposes +################ + +# ServiceLabel: %FakeLabel0 %Service Attention +/files/filePath0/ @FakeUser0 +# ServiceLabel: %FakeLabel1 %Service Attention +/files/filePath1/ @FakeUser1 @FakeUser11 +# ServiceLabel: %FakeLabel2 %Service Attention +/files/filePath2/ @FakeUser2 @FakeUser12 +# ServiceLabel: %FakeLabel3 %Service Attention +/files/filePath3/ @FakeUser3 +# ServiceLabel: %FakeLabel4 %Service Attention +/files/filePath4/ @FakeUser4 @FakeUser14 @FakeUser24 +# ServiceLabel: %FakeLabel5 %Service Attention +/files/filePath5/ @FakeUser5 +# ServiceLabel: %FakeLabel6 %Service Attention +/files/filePath6/ @FakeUser6 +# ServiceLabel: %FakeLabel7 %Service Attention +/files/filePath7/ @FakeUser7 @FakeUser17 +# ServiceLabel: %FakeLabel8 %Service Attention +/files/filePath8/ @FakeUser8 +# ServiceLabel: %FakeLabel9 %Service Attention +/files/filePath9/ @FakeUser9 diff --git a/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Tests.JsonEventPayloads/AuthorFeedBack_issue_comment_created.json b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Tests.JsonEventPayloads/AuthorFeedBack_issue_comment_created.json new file mode 100644 index 00000000000..412024087dd --- /dev/null +++ b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Tests.JsonEventPayloads/AuthorFeedBack_issue_comment_created.json @@ -0,0 +1,242 @@ +{ + "action": "created", + "comment": { + "author_association": "OWNER", + "body": "This is an issue comment to trigger an event", + "created_at": "2022-11-01T17:37:52Z", + "html_url": "https://github.com/Azure/azure-sdk-fake/issues/1#issuecomment-1298880444", + "id": 1298880444, + "issue_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/1", + "node_id": "IC_kwDOHkcrQs5Na1e8", + "performed_via_github_app": null, + "reactions": { + "+1": 0, + "-1": 0, + "confused": 0, + "eyes": 0, + "heart": 0, + "hooray": 0, + "laugh": 0, + "rocket": 0, + "total_count": 0, + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/comments/1298880444/reactions" + }, + "updated_at": "2022-11-01T17:37:52Z", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/comments/1298880444", + "user": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/Azure/events{/privacy}", + "followers_url": "https://api.github.com/users/Azure/followers", + "following_url": "https://api.github.com/users/Azure/following{/other_user}", + "gists_url": "https://api.github.com/users/Azure/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/Azure/orgs", + "received_events_url": "https://api.github.com/users/Azure/received_events", + "repos_url": "https://api.github.com/users/Azure/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/Azure/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/Azure/subscriptions", + "type": "User", + "url": "https://api.github.com/users/Azure" + } + }, + "issue": { + "active_lock_reason": null, + "assignee": null, + "assignees": [], + "author_association": "OWNER", + "body": "This is just a test issue", + "closed_at": null, + "comments": 4, + "comments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/1/comments", + "created_at": "2022-10-20T22:32:02Z", + "events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/1/events", + "html_url": "https://github.com/Azure/azure-sdk-fake/issues/1", + "id": 1417400997, + "labels": [ + { + "color": "7057ff", + "default": true, + "description": "Needs author feedback", + "id": 4273699701, + "name": "needs-author-feedback", + "node_id": "LA_kwDOHkcrQs7-u3t1", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels/good%20first%20issue" + } + ], + "labels_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/1/labels{/name}", + "locked": false, + "milestone": null, + "node_id": "I_kwDOHkcrQs5Ue9Kl", + "number": 1, + "performed_via_github_app": null, + "reactions": { + "+1": 0, + "-1": 0, + "confused": 0, + "eyes": 0, + "heart": 0, + "hooray": 0, + "laugh": 0, + "rocket": 0, + "total_count": 0, + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/1/reactions" + }, + "repository_url": "https://api.github.com/repos/Azure/azure-sdk-fake", + "state": "open", + "state_reason": null, + "timeline_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/1/timeline", + "title": "This is just a test issue", + "updated_at": "2022-11-01T17:37:52Z", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/1", + "user": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/Azure/events{/privacy}", + "followers_url": "https://api.github.com/users/Azure/followers", + "following_url": "https://api.github.com/users/Azure/following{/other_user}", + "gists_url": "https://api.github.com/users/Azure/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/Azure/orgs", + "received_events_url": "https://api.github.com/users/Azure/received_events", + "repos_url": "https://api.github.com/users/Azure/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/Azure/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/Azure/subscriptions", + "type": "User", + "url": "https://api.github.com/users/Azure" + } + }, + "repository": { + "allow_forking": true, + "archive_url": "https://api.github.com/repos/Azure/azure-sdk-fake/{archive_format}{/ref}", + "archived": false, + "assignees_url": "https://api.github.com/repos/Azure/azure-sdk-fake/assignees{/user}", + "blobs_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/blobs{/sha}", + "branches_url": "https://api.github.com/repos/Azure/azure-sdk-fake/branches{/branch}", + "clone_url": "https://github.com/Azure/azure-sdk-fake.git", + "collaborators_url": "https://api.github.com/repos/Azure/azure-sdk-fake/collaborators{/collaborator}", + "comments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/comments{/number}", + "commits_url": "https://api.github.com/repos/Azure/azure-sdk-fake/commits{/sha}", + "compare_url": "https://api.github.com/repos/Azure/azure-sdk-fake/compare/{base}...{head}", + "contents_url": "https://api.github.com/repos/Azure/azure-sdk-fake/contents/{+path}", + "contributors_url": "https://api.github.com/repos/Azure/azure-sdk-fake/contributors", + "created_at": "2022-06-27T16:19:29Z", + "default_branch": "main", + "deployments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/deployments", + "description": "Tools repository leveraged by the Azure SDK team.", + "disabled": false, + "downloads_url": "https://api.github.com/repos/Azure/azure-sdk-fake/downloads", + "events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/events", + "fork": true, + "forks": 0, + "forks_count": 0, + "forks_url": "https://api.github.com/repos/Azure/azure-sdk-fake/forks", + "full_name": "Azure/azure-sdk-fake", + "git_commits_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/commits{/sha}", + "git_refs_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/refs{/sha}", + "git_tags_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/tags{/sha}", + "git_url": "git://github.com/Azure/azure-sdk-fake.git", + "has_downloads": true, + "has_issues": true, + "has_pages": false, + "has_projects": true, + "has_wiki": true, + "homepage": null, + "hooks_url": "https://api.github.com/repos/Azure/azure-sdk-fake/hooks", + "html_url": "https://github.com/Azure/azure-sdk-fake", + "id": 507980610, + "is_template": false, + "issue_comment_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/comments{/number}", + "issue_events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/events{/number}", + "issues_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues{/number}", + "keys_url": "https://api.github.com/repos/Azure/azure-sdk-fake/keys{/key_id}", + "labels_url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels{/name}", + "language": "C#", + "languages_url": "https://api.github.com/repos/Azure/azure-sdk-fake/languages", + "license": { + "key": "mit", + "name": "MIT License", + "node_id": "MDc6TGljZW5zZTEz", + "spdx_id": "MIT", + "url": "https://api.github.com/licenses/mit" + }, + "merges_url": "https://api.github.com/repos/Azure/azure-sdk-fake/merges", + "milestones_url": "https://api.github.com/repos/Azure/azure-sdk-fake/milestones{/number}", + "mirror_url": null, + "name": "azure-sdk-fake", + "node_id": "R_kgDOHkcrQg", + "notifications_url": "https://api.github.com/repos/Azure/azure-sdk-fake/notifications{?since,all,participating}", + "open_issues": 6, + "open_issues_count": 6, + "owner": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/Azure/events{/privacy}", + "followers_url": "https://api.github.com/users/Azure/followers", + "following_url": "https://api.github.com/users/Azure/following{/other_user}", + "gists_url": "https://api.github.com/users/Azure/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/Azure/orgs", + "received_events_url": "https://api.github.com/users/Azure/received_events", + "repos_url": "https://api.github.com/users/Azure/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/Azure/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/Azure/subscriptions", + "type": "User", + "url": "https://api.github.com/users/Azure" + }, + "private": false, + "pulls_url": "https://api.github.com/repos/Azure/azure-sdk-fake/pulls{/number}", + "pushed_at": "2022-11-01T17:29:13Z", + "releases_url": "https://api.github.com/repos/Azure/azure-sdk-fake/releases{/id}", + "size": 28961, + "ssh_url": "git@github.com:Azure/azure-sdk-fake.git", + "stargazers_count": 0, + "stargazers_url": "https://api.github.com/repos/Azure/azure-sdk-fake/stargazers", + "statuses_url": "https://api.github.com/repos/Azure/azure-sdk-fake/statuses/{sha}", + "subscribers_url": "https://api.github.com/repos/Azure/azure-sdk-fake/subscribers", + "subscription_url": "https://api.github.com/repos/Azure/azure-sdk-fake/subscription", + "svn_url": "https://github.com/Azure/azure-sdk-fake", + "tags_url": "https://api.github.com/repos/Azure/azure-sdk-fake/tags", + "teams_url": "https://api.github.com/repos/Azure/azure-sdk-fake/teams", + "topics": [], + "trees_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/trees{/sha}", + "updated_at": "2022-10-31T16:54:20Z", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake", + "visibility": "public", + "watchers": 0, + "watchers_count": 0, + "web_commit_signoff_required": false + }, + "sender": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/Azure/events{/privacy}", + "followers_url": "https://api.github.com/users/Azure/followers", + "following_url": "https://api.github.com/users/Azure/following{/other_user}", + "gists_url": "https://api.github.com/users/Azure/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/Azure/orgs", + "received_events_url": "https://api.github.com/users/Azure/received_events", + "repos_url": "https://api.github.com/users/Azure/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/Azure/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/Azure/subscriptions", + "type": "User", + "url": "https://api.github.com/users/Azure" + } +} \ No newline at end of file diff --git a/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Tests.JsonEventPayloads/AuthorFeedbackNeeded_issue_labeled_nothing_to_remove.json b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Tests.JsonEventPayloads/AuthorFeedbackNeeded_issue_labeled_nothing_to_remove.json new file mode 100644 index 00000000000..94f2394ecd0 --- /dev/null +++ b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Tests.JsonEventPayloads/AuthorFeedbackNeeded_issue_labeled_nothing_to_remove.json @@ -0,0 +1,275 @@ +{ + "action": "labeled", + "issue": { + "active_lock_reason": null, + "assignee": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + }, + "assignees": [ + { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + } + ], + "author_association": "OWNER", + "body": null, + "closed_at": null, + "comments": 0, + "comments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/14/comments", + "created_at": "2023-01-27T17:01:30Z", + "events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/14/events", + "html_url": "https://github.com/Azure/azure-sdk-fake/issues/14", + "id": 1560095682, + "labels": [ + { + "color": "d73a4a", + "default": true, + "description": "Something isn't working", + "id": 4273699693, + "name": "bug", + "node_id": "LA_kwDOHkcrQs7-u3tt", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels/bug" + }, + { + "color": "ededed", + "default": false, + "description": null, + "id": 4976488245, + "name": "customer-reported", + "node_id": "LA_kwDOHkcrQs8AAAABKJ8vNQ", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels/customer-reported" + }, + { + "color": "CFDBFC", + "default": false, + "description": "", + "id": 5070852679, + "name": "needs-author-feedback", + "node_id": "LA_kwDOHkcrQs8AAAABLj8SRw", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels/needs-author-feedback" + }, + { + "color": "9C7082", + "default": false, + "description": "fake label for testing", + "id": 5095712487, + "name": "FakeLabel1", + "node_id": "LA_kwDOHkcrQs8AAAABL7pm5w", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels/FakeLabel1" + } + ], + "labels_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/14/labels{/name}", + "locked": false, + "milestone": null, + "node_id": "I_kwDOHkcrQs5c_SvC", + "number": 14, + "performed_via_github_app": null, + "reactions": { + "+1": 0, + "-1": 0, + "confused": 0, + "eyes": 0, + "heart": 0, + "hooray": 0, + "laugh": 0, + "rocket": 0, + "total_count": 0, + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/14/reactions" + }, + "repository_url": "https://api.github.com/repos/Azure/azure-sdk-fake", + "state": "open", + "state_reason": null, + "timeline_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/14/timeline", + "title": "New issue to generate event payloads for static tests", + "updated_at": "2023-01-30T17:48:11Z", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/14", + "user": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + } + }, + "label": { + "color": "CFDBFC", + "default": false, + "description": "", + "id": 5070852679, + "name": "needs-author-feedback", + "node_id": "LA_kwDOHkcrQs8AAAABLj8SRw", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels/needs-author-feedback" + }, + "repository": { + "allow_forking": true, + "archive_url": "https://api.github.com/repos/Azure/azure-sdk-fake/{archive_format}{/ref}", + "archived": false, + "assignees_url": "https://api.github.com/repos/Azure/azure-sdk-fake/assignees{/user}", + "blobs_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/blobs{/sha}", + "branches_url": "https://api.github.com/repos/Azure/azure-sdk-fake/branches{/branch}", + "clone_url": "https://github.com/Azure/azure-sdk-fake.git", + "collaborators_url": "https://api.github.com/repos/Azure/azure-sdk-fake/collaborators{/collaborator}", + "comments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/comments{/number}", + "commits_url": "https://api.github.com/repos/Azure/azure-sdk-fake/commits{/sha}", + "compare_url": "https://api.github.com/repos/Azure/azure-sdk-fake/compare/{base}...{head}", + "contents_url": "https://api.github.com/repos/Azure/azure-sdk-fake/contents/{+path}", + "contributors_url": "https://api.github.com/repos/Azure/azure-sdk-fake/contributors", + "created_at": "2022-06-27T16:19:29Z", + "default_branch": "main", + "deployments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/deployments", + "description": "Tools repository leveraged by the Azure SDK team.", + "disabled": false, + "downloads_url": "https://api.github.com/repos/Azure/azure-sdk-fake/downloads", + "events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/events", + "fork": true, + "forks": 0, + "forks_count": 0, + "forks_url": "https://api.github.com/repos/Azure/azure-sdk-fake/forks", + "full_name": "Azure/azure-sdk-fake", + "git_commits_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/commits{/sha}", + "git_refs_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/refs{/sha}", + "git_tags_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/tags{/sha}", + "git_url": "git://github.com/Azure/azure-sdk-fake.git", + "has_discussions": false, + "has_downloads": true, + "has_issues": true, + "has_pages": false, + "has_projects": true, + "has_wiki": true, + "homepage": null, + "hooks_url": "https://api.github.com/repos/Azure/azure-sdk-fake/hooks", + "html_url": "https://github.com/Azure/azure-sdk-fake", + "id": 507980610, + "is_template": false, + "issue_comment_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/comments{/number}", + "issue_events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/events{/number}", + "issues_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues{/number}", + "keys_url": "https://api.github.com/repos/Azure/azure-sdk-fake/keys{/key_id}", + "labels_url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels{/name}", + "language": "C#", + "languages_url": "https://api.github.com/repos/Azure/azure-sdk-fake/languages", + "license": { + "key": "mit", + "name": "MIT License", + "node_id": "MDc6TGljZW5zZTEz", + "spdx_id": "MIT", + "url": "https://api.github.com/licenses/mit" + }, + "merges_url": "https://api.github.com/repos/Azure/azure-sdk-fake/merges", + "milestones_url": "https://api.github.com/repos/Azure/azure-sdk-fake/milestones{/number}", + "mirror_url": null, + "name": "azure-sdk-fake", + "node_id": "R_kgDOHkcrQg", + "notifications_url": "https://api.github.com/repos/Azure/azure-sdk-fake/notifications{?since,all,participating}", + "open_issues": 6, + "open_issues_count": 6, + "owner": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + }, + "private": false, + "pulls_url": "https://api.github.com/repos/Azure/azure-sdk-fake/pulls{/number}", + "pushed_at": "2023-01-27T16:33:00Z", + "releases_url": "https://api.github.com/repos/Azure/azure-sdk-fake/releases{/id}", + "size": 29098, + "ssh_url": "git@github.com:Azure/azure-sdk-fake.git", + "stargazers_count": 0, + "stargazers_url": "https://api.github.com/repos/Azure/azure-sdk-fake/stargazers", + "statuses_url": "https://api.github.com/repos/Azure/azure-sdk-fake/statuses/{sha}", + "subscribers_url": "https://api.github.com/repos/Azure/azure-sdk-fake/subscribers", + "subscription_url": "https://api.github.com/repos/Azure/azure-sdk-fake/subscription", + "svn_url": "https://github.com/Azure/azure-sdk-fake", + "tags_url": "https://api.github.com/repos/Azure/azure-sdk-fake/tags", + "teams_url": "https://api.github.com/repos/Azure/azure-sdk-fake/teams", + "topics": [], + "trees_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/trees{/sha}", + "updated_at": "2023-01-23T19:54:18Z", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake", + "visibility": "public", + "watchers": 0, + "watchers_count": 0, + "web_commit_signoff_required": false + }, + "sender": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + } +} diff --git a/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Tests.JsonEventPayloads/AuthorFeedbackNeeded_issue_labeled_with_labels_to_remove.json b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Tests.JsonEventPayloads/AuthorFeedbackNeeded_issue_labeled_with_labels_to_remove.json new file mode 100644 index 00000000000..1ca52e5dd2d --- /dev/null +++ b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Tests.JsonEventPayloads/AuthorFeedbackNeeded_issue_labeled_with_labels_to_remove.json @@ -0,0 +1,302 @@ +{ + "action": "labeled", + "issue": { + "active_lock_reason": null, + "assignee": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + }, + "assignees": [ + { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + } + ], + "author_association": "OWNER", + "body": null, + "closed_at": null, + "comments": 0, + "comments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/14/comments", + "created_at": "2023-01-27T17:01:30Z", + "events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/14/events", + "html_url": "https://github.com/Azure/azure-sdk-fake/issues/14", + "id": 1560095682, + "labels": [ + { + "color": "d73a4a", + "default": true, + "description": "Something isn't working", + "id": 4273699693, + "name": "bug", + "node_id": "LA_kwDOHkcrQs7-u3tt", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels/bug" + }, + { + "color": "ededed", + "default": false, + "description": null, + "id": 4704569627, + "name": "needs-triage", + "node_id": "LA_kwDOHkcrQs8AAAABGGoJGw", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels/needs-triage" + }, + { + "color": "ededed", + "default": false, + "description": null, + "id": 4976488245, + "name": "customer-reported", + "node_id": "LA_kwDOHkcrQs8AAAABKJ8vNQ", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels/customer-reported" + }, + { + "color": "CFDBFC", + "default": false, + "description": "", + "id": 5070852679, + "name": "needs-author-feedback", + "node_id": "LA_kwDOHkcrQs8AAAABLj8SRw", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels/needs-author-feedback" + }, + { + "color": "9C7082", + "default": false, + "description": "fake label for testing", + "id": 5095712487, + "name": "FakeLabel1", + "node_id": "LA_kwDOHkcrQs8AAAABL7pm5w", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels/FakeLabel1" + }, + { + "color": "DBC2DE", + "default": false, + "description": "", + "id": 5095805781, + "name": "needs-team-triage", + "node_id": "LA_kwDOHkcrQs8AAAABL7vTVQ", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels/needs-team-triage" + }, + { + "color": "027919", + "default": false, + "description": "", + "id": 5096061354, + "name": "needs-team-attention", + "node_id": "LA_kwDOHkcrQs8AAAABL7-5qg", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels/needs-team-attention" + } + ], + "labels_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/14/labels{/name}", + "locked": false, + "milestone": null, + "node_id": "I_kwDOHkcrQs5c_SvC", + "number": 14, + "performed_via_github_app": null, + "reactions": { + "+1": 0, + "-1": 0, + "confused": 0, + "eyes": 0, + "heart": 0, + "hooray": 0, + "laugh": 0, + "rocket": 0, + "total_count": 0, + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/14/reactions" + }, + "repository_url": "https://api.github.com/repos/Azure/azure-sdk-fake", + "state": "open", + "state_reason": null, + "timeline_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/14/timeline", + "title": "New issue to generate event payloads for static tests", + "updated_at": "2023-01-30T17:47:05Z", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/14", + "user": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + } + }, + "label": { + "color": "CFDBFC", + "default": false, + "description": "", + "id": 5070852679, + "name": "needs-author-feedback", + "node_id": "LA_kwDOHkcrQs8AAAABLj8SRw", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels/needs-author-feedback" + }, + "repository": { + "allow_forking": true, + "archive_url": "https://api.github.com/repos/Azure/azure-sdk-fake/{archive_format}{/ref}", + "archived": false, + "assignees_url": "https://api.github.com/repos/Azure/azure-sdk-fake/assignees{/user}", + "blobs_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/blobs{/sha}", + "branches_url": "https://api.github.com/repos/Azure/azure-sdk-fake/branches{/branch}", + "clone_url": "https://github.com/Azure/azure-sdk-fake.git", + "collaborators_url": "https://api.github.com/repos/Azure/azure-sdk-fake/collaborators{/collaborator}", + "comments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/comments{/number}", + "commits_url": "https://api.github.com/repos/Azure/azure-sdk-fake/commits{/sha}", + "compare_url": "https://api.github.com/repos/Azure/azure-sdk-fake/compare/{base}...{head}", + "contents_url": "https://api.github.com/repos/Azure/azure-sdk-fake/contents/{+path}", + "contributors_url": "https://api.github.com/repos/Azure/azure-sdk-fake/contributors", + "created_at": "2022-06-27T16:19:29Z", + "default_branch": "main", + "deployments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/deployments", + "description": "Tools repository leveraged by the Azure SDK team.", + "disabled": false, + "downloads_url": "https://api.github.com/repos/Azure/azure-sdk-fake/downloads", + "events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/events", + "fork": true, + "forks": 0, + "forks_count": 0, + "forks_url": "https://api.github.com/repos/Azure/azure-sdk-fake/forks", + "full_name": "Azure/azure-sdk-fake", + "git_commits_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/commits{/sha}", + "git_refs_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/refs{/sha}", + "git_tags_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/tags{/sha}", + "git_url": "git://github.com/Azure/azure-sdk-fake.git", + "has_discussions": false, + "has_downloads": true, + "has_issues": true, + "has_pages": false, + "has_projects": true, + "has_wiki": true, + "homepage": null, + "hooks_url": "https://api.github.com/repos/Azure/azure-sdk-fake/hooks", + "html_url": "https://github.com/Azure/azure-sdk-fake", + "id": 507980610, + "is_template": false, + "issue_comment_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/comments{/number}", + "issue_events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/events{/number}", + "issues_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues{/number}", + "keys_url": "https://api.github.com/repos/Azure/azure-sdk-fake/keys{/key_id}", + "labels_url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels{/name}", + "language": "C#", + "languages_url": "https://api.github.com/repos/Azure/azure-sdk-fake/languages", + "license": { + "key": "mit", + "name": "MIT License", + "node_id": "MDc6TGljZW5zZTEz", + "spdx_id": "MIT", + "url": "https://api.github.com/licenses/mit" + }, + "merges_url": "https://api.github.com/repos/Azure/azure-sdk-fake/merges", + "milestones_url": "https://api.github.com/repos/Azure/azure-sdk-fake/milestones{/number}", + "mirror_url": null, + "name": "azure-sdk-fake", + "node_id": "R_kgDOHkcrQg", + "notifications_url": "https://api.github.com/repos/Azure/azure-sdk-fake/notifications{?since,all,participating}", + "open_issues": 6, + "open_issues_count": 6, + "owner": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + }, + "private": false, + "pulls_url": "https://api.github.com/repos/Azure/azure-sdk-fake/pulls{/number}", + "pushed_at": "2023-01-27T16:33:00Z", + "releases_url": "https://api.github.com/repos/Azure/azure-sdk-fake/releases{/id}", + "size": 29098, + "ssh_url": "git@github.com:Azure/azure-sdk-fake.git", + "stargazers_count": 0, + "stargazers_url": "https://api.github.com/repos/Azure/azure-sdk-fake/stargazers", + "statuses_url": "https://api.github.com/repos/Azure/azure-sdk-fake/statuses/{sha}", + "subscribers_url": "https://api.github.com/repos/Azure/azure-sdk-fake/subscribers", + "subscription_url": "https://api.github.com/repos/Azure/azure-sdk-fake/subscription", + "svn_url": "https://github.com/Azure/azure-sdk-fake", + "tags_url": "https://api.github.com/repos/Azure/azure-sdk-fake/tags", + "teams_url": "https://api.github.com/repos/Azure/azure-sdk-fake/teams", + "topics": [], + "trees_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/trees{/sha}", + "updated_at": "2023-01-23T19:54:18Z", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake", + "visibility": "public", + "watchers": 0, + "watchers_count": 0, + "web_commit_signoff_required": false + }, + "sender": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + } +} diff --git a/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Tests.JsonEventPayloads/CXPAttention_issue_labeled.json b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Tests.JsonEventPayloads/CXPAttention_issue_labeled.json new file mode 100644 index 00000000000..7fbaeb2b22b --- /dev/null +++ b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Tests.JsonEventPayloads/CXPAttention_issue_labeled.json @@ -0,0 +1,275 @@ +{ + "action": "labeled", + "issue": { + "active_lock_reason": null, + "assignee": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + }, + "assignees": [ + { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + } + ], + "author_association": "OWNER", + "body": null, + "closed_at": null, + "comments": 0, + "comments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/14/comments", + "created_at": "2023-01-27T17:01:30Z", + "events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/14/events", + "html_url": "https://github.com/Azure/azure-sdk-fake/issues/14", + "id": 1560095682, + "labels": [ + { + "color": "d73a4a", + "default": true, + "description": "Something isn't working", + "id": 4273699693, + "name": "bug", + "node_id": "LA_kwDOHkcrQs7-u3tt", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels/bug" + }, + { + "color": "ededed", + "default": false, + "description": null, + "id": 4704569627, + "name": "needs-triage", + "node_id": "LA_kwDOHkcrQs8AAAABGGoJGw", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels/needs-triage" + }, + { + "color": "9C7082", + "default": false, + "description": "fake label for testing", + "id": 5095712487, + "name": "FakeLabel1", + "node_id": "LA_kwDOHkcrQs8AAAABL7pm5w", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels/FakeLabel1" + }, + { + "color": "FDEB99", + "default": false, + "description": "", + "id": 5095753141, + "name": "CXP Attention", + "node_id": "LA_kwDOHkcrQs8AAAABL7sFtQ", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels/CXP%20Attention" + } + ], + "labels_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/14/labels{/name}", + "locked": false, + "milestone": null, + "node_id": "I_kwDOHkcrQs5c_SvC", + "number": 14, + "performed_via_github_app": null, + "reactions": { + "+1": 0, + "-1": 0, + "confused": 0, + "eyes": 0, + "heart": 0, + "hooray": 0, + "laugh": 0, + "rocket": 0, + "total_count": 0, + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/14/reactions" + }, + "repository_url": "https://api.github.com/repos/Azure/azure-sdk-fake", + "state": "open", + "state_reason": null, + "timeline_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/14/timeline", + "title": "New test issue to generate event payloads", + "updated_at": "2023-01-30T16:29:49Z", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/14", + "user": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + } + }, + "label": { + "color": "FDEB99", + "default": false, + "description": "", + "id": 5095753141, + "name": "CXP Attention", + "node_id": "LA_kwDOHkcrQs8AAAABL7sFtQ", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels/CXP%20Attention" + }, + "repository": { + "allow_forking": true, + "archive_url": "https://api.github.com/repos/Azure/azure-sdk-fake/{archive_format}{/ref}", + "archived": false, + "assignees_url": "https://api.github.com/repos/Azure/azure-sdk-fake/assignees{/user}", + "blobs_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/blobs{/sha}", + "branches_url": "https://api.github.com/repos/Azure/azure-sdk-fake/branches{/branch}", + "clone_url": "https://github.com/Azure/azure-sdk-fake.git", + "collaborators_url": "https://api.github.com/repos/Azure/azure-sdk-fake/collaborators{/collaborator}", + "comments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/comments{/number}", + "commits_url": "https://api.github.com/repos/Azure/azure-sdk-fake/commits{/sha}", + "compare_url": "https://api.github.com/repos/Azure/azure-sdk-fake/compare/{base}...{head}", + "contents_url": "https://api.github.com/repos/Azure/azure-sdk-fake/contents/{+path}", + "contributors_url": "https://api.github.com/repos/Azure/azure-sdk-fake/contributors", + "created_at": "2022-06-27T16:19:29Z", + "default_branch": "main", + "deployments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/deployments", + "description": "Tools repository leveraged by the Azure SDK team.", + "disabled": false, + "downloads_url": "https://api.github.com/repos/Azure/azure-sdk-fake/downloads", + "events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/events", + "fork": true, + "forks": 0, + "forks_count": 0, + "forks_url": "https://api.github.com/repos/Azure/azure-sdk-fake/forks", + "full_name": "Azure/azure-sdk-fake", + "git_commits_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/commits{/sha}", + "git_refs_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/refs{/sha}", + "git_tags_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/tags{/sha}", + "git_url": "git://github.com/Azure/azure-sdk-fake.git", + "has_discussions": false, + "has_downloads": true, + "has_issues": true, + "has_pages": false, + "has_projects": true, + "has_wiki": true, + "homepage": null, + "hooks_url": "https://api.github.com/repos/Azure/azure-sdk-fake/hooks", + "html_url": "https://github.com/Azure/azure-sdk-fake", + "id": 507980610, + "is_template": false, + "issue_comment_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/comments{/number}", + "issue_events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/events{/number}", + "issues_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues{/number}", + "keys_url": "https://api.github.com/repos/Azure/azure-sdk-fake/keys{/key_id}", + "labels_url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels{/name}", + "language": "C#", + "languages_url": "https://api.github.com/repos/Azure/azure-sdk-fake/languages", + "license": { + "key": "mit", + "name": "MIT License", + "node_id": "MDc6TGljZW5zZTEz", + "spdx_id": "MIT", + "url": "https://api.github.com/licenses/mit" + }, + "merges_url": "https://api.github.com/repos/Azure/azure-sdk-fake/merges", + "milestones_url": "https://api.github.com/repos/Azure/azure-sdk-fake/milestones{/number}", + "mirror_url": null, + "name": "azure-sdk-fake", + "node_id": "R_kgDOHkcrQg", + "notifications_url": "https://api.github.com/repos/Azure/azure-sdk-fake/notifications{?since,all,participating}", + "open_issues": 6, + "open_issues_count": 6, + "owner": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + }, + "private": false, + "pulls_url": "https://api.github.com/repos/Azure/azure-sdk-fake/pulls{/number}", + "pushed_at": "2023-01-27T16:33:00Z", + "releases_url": "https://api.github.com/repos/Azure/azure-sdk-fake/releases{/id}", + "size": 29098, + "ssh_url": "git@github.com:Azure/azure-sdk-fake.git", + "stargazers_count": 0, + "stargazers_url": "https://api.github.com/repos/Azure/azure-sdk-fake/stargazers", + "statuses_url": "https://api.github.com/repos/Azure/azure-sdk-fake/statuses/{sha}", + "subscribers_url": "https://api.github.com/repos/Azure/azure-sdk-fake/subscribers", + "subscription_url": "https://api.github.com/repos/Azure/azure-sdk-fake/subscription", + "svn_url": "https://github.com/Azure/azure-sdk-fake", + "tags_url": "https://api.github.com/repos/Azure/azure-sdk-fake/tags", + "teams_url": "https://api.github.com/repos/Azure/azure-sdk-fake/teams", + "topics": [], + "trees_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/trees{/sha}", + "updated_at": "2023-01-23T19:54:18Z", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake", + "visibility": "public", + "watchers": 0, + "watchers_count": 0, + "web_commit_signoff_required": false + }, + "sender": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + } +} diff --git a/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Tests.JsonEventPayloads/CXPAttention_issue_labeled_has_service-attention.json b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Tests.JsonEventPayloads/CXPAttention_issue_labeled_has_service-attention.json new file mode 100644 index 00000000000..3024a04e768 --- /dev/null +++ b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Tests.JsonEventPayloads/CXPAttention_issue_labeled_has_service-attention.json @@ -0,0 +1,284 @@ +{ + "action": "labeled", + "issue": { + "active_lock_reason": null, + "assignee": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + }, + "assignees": [ + { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + } + ], + "author_association": "OWNER", + "body": null, + "closed_at": null, + "comments": 0, + "comments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/14/comments", + "created_at": "2023-01-27T17:01:30Z", + "events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/14/events", + "html_url": "https://github.com/Azure/azure-sdk-fake/issues/14", + "id": 1560095682, + "labels": [ + { + "color": "d73a4a", + "default": true, + "description": "Something isn't working", + "id": 4273699693, + "name": "bug", + "node_id": "LA_kwDOHkcrQs7-u3tt", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels/bug" + }, + { + "color": "ededed", + "default": false, + "description": null, + "id": 4704569627, + "name": "needs-triage", + "node_id": "LA_kwDOHkcrQs8AAAABGGoJGw", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels/needs-triage" + }, + { + "color": "9C7082", + "default": false, + "description": "fake label for testing", + "id": 5095712487, + "name": "FakeLabel1", + "node_id": "LA_kwDOHkcrQs8AAAABL7pm5w", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels/FakeLabel1" + }, + { + "color": "F75BB2", + "default": false, + "description": "", + "id": 5095715984, + "name": "Service Attention", + "node_id": "LA_kwDOHkcrQs8AAAABL7p0kA", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels/Service%20Attention" + }, + { + "color": "FDEB99", + "default": false, + "description": "", + "id": 5095753141, + "name": "CXP Attention", + "node_id": "LA_kwDOHkcrQs8AAAABL7sFtQ", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels/CXP%20Attention" + } + ], + "labels_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/14/labels{/name}", + "locked": false, + "milestone": null, + "node_id": "I_kwDOHkcrQs5c_SvC", + "number": 14, + "performed_via_github_app": null, + "reactions": { + "+1": 0, + "-1": 0, + "confused": 0, + "eyes": 0, + "heart": 0, + "hooray": 0, + "laugh": 0, + "rocket": 0, + "total_count": 0, + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/14/reactions" + }, + "repository_url": "https://api.github.com/repos/Azure/azure-sdk-fake", + "state": "open", + "state_reason": null, + "timeline_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/14/timeline", + "title": "New test issue to generate event payloads", + "updated_at": "2023-01-30T16:26:17Z", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/14", + "user": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + } + }, + "label": { + "color": "FDEB99", + "default": false, + "description": "", + "id": 5095753141, + "name": "CXP Attention", + "node_id": "LA_kwDOHkcrQs8AAAABL7sFtQ", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels/CXP%20Attention" + }, + "repository": { + "allow_forking": true, + "archive_url": "https://api.github.com/repos/Azure/azure-sdk-fake/{archive_format}{/ref}", + "archived": false, + "assignees_url": "https://api.github.com/repos/Azure/azure-sdk-fake/assignees{/user}", + "blobs_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/blobs{/sha}", + "branches_url": "https://api.github.com/repos/Azure/azure-sdk-fake/branches{/branch}", + "clone_url": "https://github.com/Azure/azure-sdk-fake.git", + "collaborators_url": "https://api.github.com/repos/Azure/azure-sdk-fake/collaborators{/collaborator}", + "comments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/comments{/number}", + "commits_url": "https://api.github.com/repos/Azure/azure-sdk-fake/commits{/sha}", + "compare_url": "https://api.github.com/repos/Azure/azure-sdk-fake/compare/{base}...{head}", + "contents_url": "https://api.github.com/repos/Azure/azure-sdk-fake/contents/{+path}", + "contributors_url": "https://api.github.com/repos/Azure/azure-sdk-fake/contributors", + "created_at": "2022-06-27T16:19:29Z", + "default_branch": "main", + "deployments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/deployments", + "description": "Tools repository leveraged by the Azure SDK team.", + "disabled": false, + "downloads_url": "https://api.github.com/repos/Azure/azure-sdk-fake/downloads", + "events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/events", + "fork": true, + "forks": 0, + "forks_count": 0, + "forks_url": "https://api.github.com/repos/Azure/azure-sdk-fake/forks", + "full_name": "Azure/azure-sdk-fake", + "git_commits_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/commits{/sha}", + "git_refs_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/refs{/sha}", + "git_tags_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/tags{/sha}", + "git_url": "git://github.com/Azure/azure-sdk-fake.git", + "has_discussions": false, + "has_downloads": true, + "has_issues": true, + "has_pages": false, + "has_projects": true, + "has_wiki": true, + "homepage": null, + "hooks_url": "https://api.github.com/repos/Azure/azure-sdk-fake/hooks", + "html_url": "https://github.com/Azure/azure-sdk-fake", + "id": 507980610, + "is_template": false, + "issue_comment_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/comments{/number}", + "issue_events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/events{/number}", + "issues_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues{/number}", + "keys_url": "https://api.github.com/repos/Azure/azure-sdk-fake/keys{/key_id}", + "labels_url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels{/name}", + "language": "C#", + "languages_url": "https://api.github.com/repos/Azure/azure-sdk-fake/languages", + "license": { + "key": "mit", + "name": "MIT License", + "node_id": "MDc6TGljZW5zZTEz", + "spdx_id": "MIT", + "url": "https://api.github.com/licenses/mit" + }, + "merges_url": "https://api.github.com/repos/Azure/azure-sdk-fake/merges", + "milestones_url": "https://api.github.com/repos/Azure/azure-sdk-fake/milestones{/number}", + "mirror_url": null, + "name": "azure-sdk-fake", + "node_id": "R_kgDOHkcrQg", + "notifications_url": "https://api.github.com/repos/Azure/azure-sdk-fake/notifications{?since,all,participating}", + "open_issues": 6, + "open_issues_count": 6, + "owner": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + }, + "private": false, + "pulls_url": "https://api.github.com/repos/Azure/azure-sdk-fake/pulls{/number}", + "pushed_at": "2023-01-27T16:33:00Z", + "releases_url": "https://api.github.com/repos/Azure/azure-sdk-fake/releases{/id}", + "size": 29098, + "ssh_url": "git@github.com:Azure/azure-sdk-fake.git", + "stargazers_count": 0, + "stargazers_url": "https://api.github.com/repos/Azure/azure-sdk-fake/stargazers", + "statuses_url": "https://api.github.com/repos/Azure/azure-sdk-fake/statuses/{sha}", + "subscribers_url": "https://api.github.com/repos/Azure/azure-sdk-fake/subscribers", + "subscription_url": "https://api.github.com/repos/Azure/azure-sdk-fake/subscription", + "svn_url": "https://github.com/Azure/azure-sdk-fake", + "tags_url": "https://api.github.com/repos/Azure/azure-sdk-fake/tags", + "teams_url": "https://api.github.com/repos/Azure/azure-sdk-fake/teams", + "topics": [], + "trees_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/trees{/sha}", + "updated_at": "2023-01-23T19:54:18Z", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake", + "visibility": "public", + "watchers": 0, + "watchers_count": 0, + "web_commit_signoff_required": false + }, + "sender": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + } +} diff --git a/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Tests.JsonEventPayloads/DeclineToReopenIssue_issue_comment_created.json b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Tests.JsonEventPayloads/DeclineToReopenIssue_issue_comment_created.json new file mode 100644 index 00000000000..bb0f3ed4f2c --- /dev/null +++ b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Tests.JsonEventPayloads/DeclineToReopenIssue_issue_comment_created.json @@ -0,0 +1,252 @@ +{ + "action": "created", + "comment": { + "author_association": "OWNER", + "body": "Comment created for ReopenIssue payload", + "created_at": "2023-01-23T19:46:33Z", + "html_url": "https://github.com/Azure/azure-sdk-fake/issues/1#issuecomment-1400886297", + "id": 1400886297, + "issue_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/1", + "node_id": "IC_kwDOHkcrQs5Tf9QZ", + "performed_via_github_app": null, + "reactions": { + "+1": 0, + "-1": 0, + "confused": 0, + "eyes": 0, + "heart": 0, + "hooray": 0, + "laugh": 0, + "rocket": 0, + "total_count": 0, + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/comments/1400886297/reactions" + }, + "updated_at": "2023-01-23T19:46:33Z", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/comments/1400886297", + "user": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + } + }, + "issue": { + "active_lock_reason": null, + "assignee": null, + "assignees": [], + "author_association": "OWNER", + "body": "This is just a test issue", + "closed_at": "2022-12-09T16:48:56Z", + "comments": 5, + "comments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/1/comments", + "created_at": "2022-10-20T22:32:02Z", + "events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/1/events", + "html_url": "https://github.com/Azure/azure-sdk-fake/issues/1", + "id": 1417400997, + "labels": [ + { + "color": "94812F", + "default": false, + "description": "", + "id": 5070542662, + "name": "no-recent-activity", + "node_id": "LA_kwDOHkcrQs8AAAABLjpXRg", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels/no-recent-activity" + }, + { + "color": "CFDBFC", + "default": false, + "description": "", + "id": 5070852679, + "name": "needs-author-feedback", + "node_id": "LA_kwDOHkcrQs8AAAABLj8SRw", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels/needs-author-feedback" + } + ], + "labels_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/1/labels{/name}", + "locked": false, + "milestone": null, + "node_id": "I_kwDOHkcrQs5Ue9Kl", + "number": 1, + "performed_via_github_app": null, + "reactions": { + "+1": 0, + "-1": 0, + "confused": 0, + "eyes": 0, + "heart": 0, + "hooray": 0, + "laugh": 0, + "rocket": 0, + "total_count": 0, + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/1/reactions" + }, + "repository_url": "https://api.github.com/repos/Azure/azure-sdk-fake", + "state": "closed", + "state_reason": "completed", + "timeline_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/1/timeline", + "title": "This is just a test issue", + "updated_at": "2023-01-23T19:46:34Z", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/1", + "user": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + } + }, + "repository": { + "allow_forking": true, + "archive_url": "https://api.github.com/repos/Azure/azure-sdk-fake/{archive_format}{/ref}", + "archived": false, + "assignees_url": "https://api.github.com/repos/Azure/azure-sdk-fake/assignees{/user}", + "blobs_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/blobs{/sha}", + "branches_url": "https://api.github.com/repos/Azure/azure-sdk-fake/branches{/branch}", + "clone_url": "https://github.com/Azure/azure-sdk-fake.git", + "collaborators_url": "https://api.github.com/repos/Azure/azure-sdk-fake/collaborators{/collaborator}", + "comments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/comments{/number}", + "commits_url": "https://api.github.com/repos/Azure/azure-sdk-fake/commits{/sha}", + "compare_url": "https://api.github.com/repos/Azure/azure-sdk-fake/compare/{base}...{head}", + "contents_url": "https://api.github.com/repos/Azure/azure-sdk-fake/contents/{+path}", + "contributors_url": "https://api.github.com/repos/Azure/azure-sdk-fake/contributors", + "created_at": "2022-06-27T16:19:29Z", + "default_branch": "main", + "deployments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/deployments", + "description": "Tools repository leveraged by the Azure SDK team.", + "disabled": false, + "downloads_url": "https://api.github.com/repos/Azure/azure-sdk-fake/downloads", + "events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/events", + "fork": true, + "forks": 0, + "forks_count": 0, + "forks_url": "https://api.github.com/repos/Azure/azure-sdk-fake/forks", + "full_name": "Azure/azure-sdk-fake", + "git_commits_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/commits{/sha}", + "git_refs_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/refs{/sha}", + "git_tags_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/tags{/sha}", + "git_url": "git://github.com/Azure/azure-sdk-fake.git", + "has_discussions": false, + "has_downloads": true, + "has_issues": true, + "has_pages": false, + "has_projects": true, + "has_wiki": true, + "homepage": null, + "hooks_url": "https://api.github.com/repos/Azure/azure-sdk-fake/hooks", + "html_url": "https://github.com/Azure/azure-sdk-fake", + "id": 507980610, + "is_template": false, + "issue_comment_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/comments{/number}", + "issue_events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/events{/number}", + "issues_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues{/number}", + "keys_url": "https://api.github.com/repos/Azure/azure-sdk-fake/keys{/key_id}", + "labels_url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels{/name}", + "language": "C#", + "languages_url": "https://api.github.com/repos/Azure/azure-sdk-fake/languages", + "license": { + "key": "mit", + "name": "MIT License", + "node_id": "MDc6TGljZW5zZTEz", + "spdx_id": "MIT", + "url": "https://api.github.com/licenses/mit" + }, + "merges_url": "https://api.github.com/repos/Azure/azure-sdk-fake/merges", + "milestones_url": "https://api.github.com/repos/Azure/azure-sdk-fake/milestones{/number}", + "mirror_url": null, + "name": "azure-sdk-fake", + "node_id": "R_kgDOHkcrQg", + "notifications_url": "https://api.github.com/repos/Azure/azure-sdk-fake/notifications{?since,all,participating}", + "open_issues": 5, + "open_issues_count": 5, + "owner": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + }, + "private": false, + "pulls_url": "https://api.github.com/repos/Azure/azure-sdk-fake/pulls{/number}", + "pushed_at": "2023-01-23T18:19:17Z", + "releases_url": "https://api.github.com/repos/Azure/azure-sdk-fake/releases{/id}", + "size": 29043, + "ssh_url": "git@github.com:Azure/azure-sdk-fake.git", + "stargazers_count": 0, + "stargazers_url": "https://api.github.com/repos/Azure/azure-sdk-fake/stargazers", + "statuses_url": "https://api.github.com/repos/Azure/azure-sdk-fake/statuses/{sha}", + "subscribers_url": "https://api.github.com/repos/Azure/azure-sdk-fake/subscribers", + "subscription_url": "https://api.github.com/repos/Azure/azure-sdk-fake/subscription", + "svn_url": "https://github.com/Azure/azure-sdk-fake", + "tags_url": "https://api.github.com/repos/Azure/azure-sdk-fake/tags", + "teams_url": "https://api.github.com/repos/Azure/azure-sdk-fake/teams", + "topics": [], + "trees_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/trees{/sha}", + "updated_at": "2022-12-09T16:58:56Z", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake", + "visibility": "public", + "watchers": 0, + "watchers_count": 0, + "web_commit_signoff_required": false + }, + "sender": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + } +} diff --git a/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Tests.JsonEventPayloads/InitialIssueTriage_issue_created.json b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Tests.JsonEventPayloads/InitialIssueTriage_issue_created.json new file mode 100644 index 00000000000..9a3b40970b8 --- /dev/null +++ b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Tests.JsonEventPayloads/InitialIssueTriage_issue_created.json @@ -0,0 +1,189 @@ +{ + "action": "opened", + "issue": { + "active_lock_reason": null, + "assignee": null, + "assignees": [], + "author_association": "OWNER", + "body": null, + "closed_at": null, + "comments": 0, + "comments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/15/comments", + "created_at": "2023-01-30T18:59:03Z", + "events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/15/events", + "html_url": "https://github.com/Azure/azure-sdk-fake/issues/15", + "id": 1563022437, + "labels": [], + "labels_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/15/labels{/name}", + "locked": false, + "milestone": null, + "node_id": "I_kwDOHkcrQs5dKdRl", + "number": 15, + "performed_via_github_app": null, + "reactions": { + "+1": 0, + "-1": 0, + "confused": 0, + "eyes": 0, + "heart": 0, + "hooray": 0, + "laugh": 0, + "rocket": 0, + "total_count": 0, + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/15/reactions" + }, + "repository_url": "https://api.github.com/repos/Azure/azure-sdk-fake", + "state": "open", + "state_reason": null, + "timeline_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/15/timeline", + "title": "Another new issue to generate test payloads", + "updated_at": "2023-01-30T18:59:03Z", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/15", + "user": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + } + }, + "repository": { + "allow_forking": true, + "archive_url": "https://api.github.com/repos/Azure/azure-sdk-fake/{archive_format}{/ref}", + "archived": false, + "assignees_url": "https://api.github.com/repos/Azure/azure-sdk-fake/assignees{/user}", + "blobs_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/blobs{/sha}", + "branches_url": "https://api.github.com/repos/Azure/azure-sdk-fake/branches{/branch}", + "clone_url": "https://github.com/Azure/azure-sdk-fake.git", + "collaborators_url": "https://api.github.com/repos/Azure/azure-sdk-fake/collaborators{/collaborator}", + "comments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/comments{/number}", + "commits_url": "https://api.github.com/repos/Azure/azure-sdk-fake/commits{/sha}", + "compare_url": "https://api.github.com/repos/Azure/azure-sdk-fake/compare/{base}...{head}", + "contents_url": "https://api.github.com/repos/Azure/azure-sdk-fake/contents/{+path}", + "contributors_url": "https://api.github.com/repos/Azure/azure-sdk-fake/contributors", + "created_at": "2022-06-27T16:19:29Z", + "default_branch": "main", + "deployments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/deployments", + "description": "Tools repository leveraged by the Azure SDK team.", + "disabled": false, + "downloads_url": "https://api.github.com/repos/Azure/azure-sdk-fake/downloads", + "events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/events", + "fork": true, + "forks": 0, + "forks_count": 0, + "forks_url": "https://api.github.com/repos/Azure/azure-sdk-fake/forks", + "full_name": "Azure/azure-sdk-fake", + "git_commits_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/commits{/sha}", + "git_refs_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/refs{/sha}", + "git_tags_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/tags{/sha}", + "git_url": "git://github.com/Azure/azure-sdk-fake.git", + "has_discussions": false, + "has_downloads": true, + "has_issues": true, + "has_pages": false, + "has_projects": true, + "has_wiki": true, + "homepage": null, + "hooks_url": "https://api.github.com/repos/Azure/azure-sdk-fake/hooks", + "html_url": "https://github.com/Azure/azure-sdk-fake", + "id": 507980610, + "is_template": false, + "issue_comment_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/comments{/number}", + "issue_events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/events{/number}", + "issues_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues{/number}", + "keys_url": "https://api.github.com/repos/Azure/azure-sdk-fake/keys{/key_id}", + "labels_url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels{/name}", + "language": "C#", + "languages_url": "https://api.github.com/repos/Azure/azure-sdk-fake/languages", + "license": { + "key": "mit", + "name": "MIT License", + "node_id": "MDc6TGljZW5zZTEz", + "spdx_id": "MIT", + "url": "https://api.github.com/licenses/mit" + }, + "merges_url": "https://api.github.com/repos/Azure/azure-sdk-fake/merges", + "milestones_url": "https://api.github.com/repos/Azure/azure-sdk-fake/milestones{/number}", + "mirror_url": null, + "name": "azure-sdk-fake", + "node_id": "R_kgDOHkcrQg", + "notifications_url": "https://api.github.com/repos/Azure/azure-sdk-fake/notifications{?since,all,participating}", + "open_issues": 7, + "open_issues_count": 7, + "owner": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + }, + "private": false, + "pulls_url": "https://api.github.com/repos/Azure/azure-sdk-fake/pulls{/number}", + "pushed_at": "2023-01-27T16:33:00Z", + "releases_url": "https://api.github.com/repos/Azure/azure-sdk-fake/releases{/id}", + "size": 29098, + "ssh_url": "git@github.com:Azure/azure-sdk-fake.git", + "stargazers_count": 0, + "stargazers_url": "https://api.github.com/repos/Azure/azure-sdk-fake/stargazers", + "statuses_url": "https://api.github.com/repos/Azure/azure-sdk-fake/statuses/{sha}", + "subscribers_url": "https://api.github.com/repos/Azure/azure-sdk-fake/subscribers", + "subscription_url": "https://api.github.com/repos/Azure/azure-sdk-fake/subscription", + "svn_url": "https://github.com/Azure/azure-sdk-fake", + "tags_url": "https://api.github.com/repos/Azure/azure-sdk-fake/tags", + "teams_url": "https://api.github.com/repos/Azure/azure-sdk-fake/teams", + "topics": [], + "trees_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/trees{/sha}", + "updated_at": "2023-01-23T19:54:18Z", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake", + "visibility": "public", + "watchers": 0, + "watchers_count": 0, + "web_commit_signoff_required": false + }, + "sender": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + } +} diff --git a/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Tests.JsonEventPayloads/InitialIssueTriage_issue_opened_no_labels_no_assignee.json b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Tests.JsonEventPayloads/InitialIssueTriage_issue_opened_no_labels_no_assignee.json new file mode 100644 index 00000000000..6e09a742a76 --- /dev/null +++ b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Tests.JsonEventPayloads/InitialIssueTriage_issue_opened_no_labels_no_assignee.json @@ -0,0 +1,183 @@ +{ + "action": "opened", + "issue": { + "active_lock_reason": null, + "assignee": null, + "assignees": [], + "author_association": "COLLABORATOR", + "body": "### Library name\r\n\r\nAzure.Messaging.EventHubs\r\n\r\n### Please describe the feature.\r\n\r\nIt would be great if could pass a PartitionKey while creating a new EventData object.\r\n\r\nThis would allow the use of user defined partition keys when adding message via the EventHub output binding's `IAsyncCollector.AddAsync` method.\r\n\r\nThis is desirable over the use of `EventHubProducerClient.SendAsync` due to the fact that `IAsyncCollector.AddAsync` will queue the message and batch behind the scenes in parallel, whereas `EventHubProducerClient.SendAsync` needs to be awaited on each send of a single message or a batch.\r\n\r\nThe two mechanisms behave quite differently from each other and we've seen large performance gains while using the `IAsyncCollector` and `IAsyncCollector.Flush` compared to `EventHubProducerClient.SendAsync`.\r\n\r\n```cs\\nIAsyncCollector collector = from output binding\\nEventData message = new EventData(data);\\nawait collector.AddAsync(message); <-- returns immediately and is sent in parallel\\n...\\nmore stuff\\n...\\nawait collector.Flush(); <-- waits for remaining messages to send\\n```\\nvs\\n```cs\\nEventHubProducerClient client = from output binding\\nEventData message = new EventData(data);\\nawait client.SendAsync(message); <-- waits for the send operation before returning\\n```\r\n\r\nThis is similar to some of the comments in https://github.com/Azure/azure-sdk-for-net/issues/28245 but it's not the same as the issue itself.\r\n\r\nWe've done some testing using the `EventHubsModelFactory.EventData` testing method and verified the partition key when set via this method appears to be used correctly by `IAsyncCollector` and the events do in fact send and arrive downstream in the correct batches with the set partition.\r\n\r\nClearly, we can't use this testing and mocking method for production though. \r\n\r\nOr maybe there's another way to use the `IAsyncCollector`?\r\n\r\nThanks :-)", + "closed_at": null, + "comments": 0, + "comments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/4/comments", + "created_at": "2023-02-10T19:08:47Z", + "events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/4/events", + "html_url": "https://github.com/Azure/azure-sdk-fake/issues/4", + "id": 1580188561, + "labels": [], + "labels_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/4/labels{/name}", + "locked": false, + "milestone": null, + "node_id": "I_kwDOInEoF85eL8OR", + "number": 4, + "performed_via_github_app": null, + "reactions": { + "+1": 0, + "-1": 0, + "confused": 0, + "eyes": 0, + "heart": 0, + "hooray": 0, + "laugh": 0, + "rocket": 0, + "total_count": 0, + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/4/reactions" + }, + "repository_url": "https://api.github.com/repos/Azure/azure-sdk-fake", + "state": "open", + "state_reason": null, + "timeline_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/4/timeline", + "title": "[FakeIssueForTesting][FEATURE REQ] Azure Function EventHub allow passing of the PartitionKey in the EventData ctor", + "updated_at": "2023-02-10T19:08:47Z", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/4", + "user": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + } + }, + "repository": { + "allow_forking": true, + "archive_url": "https://api.github.com/repos/Azure/azure-sdk-fake/{archive_format}{/ref}", + "archived": false, + "assignees_url": "https://api.github.com/repos/Azure/azure-sdk-fake/assignees{/user}", + "blobs_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/blobs{/sha}", + "branches_url": "https://api.github.com/repos/Azure/azure-sdk-fake/branches{/branch}", + "clone_url": "https://github.com/Azure/azure-sdk-fake.git", + "collaborators_url": "https://api.github.com/repos/Azure/azure-sdk-fake/collaborators{/collaborator}", + "comments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/comments{/number}", + "commits_url": "https://api.github.com/repos/Azure/azure-sdk-fake/commits{/sha}", + "compare_url": "https://api.github.com/repos/Azure/azure-sdk-fake/compare/{base}...{head}", + "contents_url": "https://api.github.com/repos/Azure/azure-sdk-fake/contents/{+path}", + "contributors_url": "https://api.github.com/repos/Azure/azure-sdk-fake/contributors", + "created_at": "2022-12-13T16:41:25Z", + "default_branch": "main", + "deployments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/deployments", + "description": "Used for testing our github-event-processor tooling for github actions", + "disabled": false, + "downloads_url": "https://api.github.com/repos/Azure/azure-sdk-fake/downloads", + "events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/events", + "fork": false, + "forks": 0, + "forks_count": 0, + "forks_url": "https://api.github.com/repos/Azure/azure-sdk-fake/forks", + "full_name": "Azure/azure-sdk-fake", + "git_commits_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/commits{/sha}", + "git_refs_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/refs{/sha}", + "git_tags_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/tags{/sha}", + "git_url": "git://github.com/Azure/azure-sdk-fake.git", + "has_discussions": false, + "has_downloads": true, + "has_issues": true, + "has_pages": false, + "has_projects": true, + "has_wiki": true, + "homepage": null, + "hooks_url": "https://api.github.com/repos/Azure/azure-sdk-fake/hooks", + "html_url": "https://github.com/Azure/azure-sdk-fake", + "id": 577841175, + "is_template": false, + "issue_comment_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/comments{/number}", + "issue_events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/events{/number}", + "issues_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues{/number}", + "keys_url": "https://api.github.com/repos/Azure/azure-sdk-fake/keys{/key_id}", + "labels_url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels{/name}", + "language": "C#", + "languages_url": "https://api.github.com/repos/Azure/azure-sdk-fake/languages", + "license": null, + "merges_url": "https://api.github.com/repos/Azure/azure-sdk-fake/merges", + "milestones_url": "https://api.github.com/repos/Azure/azure-sdk-fake/milestones{/number}", + "mirror_url": null, + "name": "azure-sdk-fake", + "node_id": "R_kgDOInEoFw", + "notifications_url": "https://api.github.com/repos/Azure/azure-sdk-fake/notifications{?since,all,participating}", + "open_issues": 4, + "open_issues_count": 4, + "owner": { + "avatar_url": "https://avatars.githubusercontent.com/u/53356347?v=4", + "events_url": "https://api.github.com/users/azure-sdk/events{/privacy}", + "followers_url": "https://api.github.com/users/azure-sdk/followers", + "following_url": "https://api.github.com/users/azure-sdk/following{/other_user}", + "gists_url": "https://api.github.com/users/azure-sdk/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/azure-sdk", + "id": 53356347, + "login": "azure-sdk", + "node_id": "MDQ6VXNlcjUzMzU2MzQ3", + "organizations_url": "https://api.github.com/users/azure-sdk/orgs", + "received_events_url": "https://api.github.com/users/azure-sdk/received_events", + "repos_url": "https://api.github.com/users/azure-sdk/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/azure-sdk/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/azure-sdk/subscriptions", + "type": "User", + "url": "https://api.github.com/users/azure-sdk" + }, + "private": false, + "pulls_url": "https://api.github.com/repos/Azure/azure-sdk-fake/pulls{/number}", + "pushed_at": "2023-02-08T00:59:23Z", + "releases_url": "https://api.github.com/repos/Azure/azure-sdk-fake/releases{/id}", + "size": 429, + "ssh_url": "git@github.com:Azure/azure-sdk-fake.git", + "stargazers_count": 1, + "stargazers_url": "https://api.github.com/repos/Azure/azure-sdk-fake/stargazers", + "statuses_url": "https://api.github.com/repos/Azure/azure-sdk-fake/statuses/{sha}", + "subscribers_url": "https://api.github.com/repos/Azure/azure-sdk-fake/subscribers", + "subscription_url": "https://api.github.com/repos/Azure/azure-sdk-fake/subscription", + "svn_url": "https://github.com/Azure/azure-sdk-fake", + "tags_url": "https://api.github.com/repos/Azure/azure-sdk-fake/tags", + "teams_url": "https://api.github.com/repos/Azure/azure-sdk-fake/teams", + "topics": [], + "trees_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/trees{/sha}", + "updated_at": "2023-01-30T19:40:49Z", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake", + "visibility": "public", + "watchers": 1, + "watchers_count": 1, + "web_commit_signoff_required": false + }, + "sender": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + } + } \ No newline at end of file diff --git a/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Tests.JsonEventPayloads/IssueAddressedCommands_issue_comment_created_different_user.json b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Tests.JsonEventPayloads/IssueAddressedCommands_issue_comment_created_different_user.json new file mode 100644 index 00000000000..2dac46388ca --- /dev/null +++ b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Tests.JsonEventPayloads/IssueAddressedCommands_issue_comment_created_different_user.json @@ -0,0 +1,243 @@ +{ + "action": "created", + "comment": { + "author_association": "OWNER", + "body": "Comment for IssueAddressedCommands test payload which needs to contain /unresolve.", + "created_at": "2023-01-24T17:00:13Z", + "html_url": "https://github.com/Azure/azure-sdk-fake/issues/1#issuecomment-1402278026", + "id": 1402278026, + "issue_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/1", + "node_id": "IC_kwDOHkcrQs5TlRCK", + "performed_via_github_app": null, + "reactions": { + "+1": 0, + "-1": 0, + "confused": 0, + "eyes": 0, + "heart": 0, + "hooray": 0, + "laugh": 0, + "rocket": 0, + "total_count": 0, + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/comments/1402278026/reactions" + }, + "updated_at": "2023-01-24T17:00:13Z", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/comments/1402278026", + "user": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser2/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser2/followers", + "following_url": "https://api.github.com/users/FakeUser2/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser2/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser2", + "id": 13556087, + "login": "FakeUser2", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser2/orgs", + "received_events_url": "https://api.github.com/users/FakeUser2/received_events", + "repos_url": "https://api.github.com/users/FakeUser2/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser2/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser2/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser2" + } + }, + "issue": { + "active_lock_reason": null, + "assignee": null, + "assignees": [], + "author_association": "OWNER", + "body": "This is just a test issue", + "closed_at": "2022-12-09T16:48:56Z", + "comments": 6, + "comments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/1/comments", + "created_at": "2022-10-20T22:32:02Z", + "events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/1/events", + "html_url": "https://github.com/Azure/azure-sdk-fake/issues/1", + "id": 1417400997, + "labels": [ + { + "color": "0679ED", + "default": false, + "description": "", + "id": 5074290839, + "name": "issue-addressed", + "node_id": "LA_kwDOHkcrQs8AAAABLnOIlw", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels/issue-addressed" + } + ], + "labels_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/1/labels{/name}", + "locked": false, + "milestone": null, + "node_id": "I_kwDOHkcrQs5Ue9Kl", + "number": 1, + "performed_via_github_app": null, + "reactions": { + "+1": 0, + "-1": 0, + "confused": 0, + "eyes": 0, + "heart": 0, + "hooray": 0, + "laugh": 0, + "rocket": 0, + "total_count": 0, + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/1/reactions" + }, + "repository_url": "https://api.github.com/repos/Azure/azure-sdk-fake", + "state": "closed", + "state_reason": "completed", + "timeline_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/1/timeline", + "title": "This is just a test issue", + "updated_at": "2023-01-24T17:00:13Z", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/1", + "user": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + } + }, + "repository": { + "allow_forking": true, + "archive_url": "https://api.github.com/repos/Azure/azure-sdk-fake/{archive_format}{/ref}", + "archived": false, + "assignees_url": "https://api.github.com/repos/Azure/azure-sdk-fake/assignees{/user}", + "blobs_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/blobs{/sha}", + "branches_url": "https://api.github.com/repos/Azure/azure-sdk-fake/branches{/branch}", + "clone_url": "https://github.com/Azure/azure-sdk-fake.git", + "collaborators_url": "https://api.github.com/repos/Azure/azure-sdk-fake/collaborators{/collaborator}", + "comments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/comments{/number}", + "commits_url": "https://api.github.com/repos/Azure/azure-sdk-fake/commits{/sha}", + "compare_url": "https://api.github.com/repos/Azure/azure-sdk-fake/compare/{base}...{head}", + "contents_url": "https://api.github.com/repos/Azure/azure-sdk-fake/contents/{+path}", + "contributors_url": "https://api.github.com/repos/Azure/azure-sdk-fake/contributors", + "created_at": "2022-06-27T16:19:29Z", + "default_branch": "main", + "deployments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/deployments", + "description": "Tools repository leveraged by the Azure SDK team.", + "disabled": false, + "downloads_url": "https://api.github.com/repos/Azure/azure-sdk-fake/downloads", + "events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/events", + "fork": true, + "forks": 0, + "forks_count": 0, + "forks_url": "https://api.github.com/repos/Azure/azure-sdk-fake/forks", + "full_name": "Azure/azure-sdk-fake", + "git_commits_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/commits{/sha}", + "git_refs_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/refs{/sha}", + "git_tags_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/tags{/sha}", + "git_url": "git://github.com/Azure/azure-sdk-fake.git", + "has_discussions": false, + "has_downloads": true, + "has_issues": true, + "has_pages": false, + "has_projects": true, + "has_wiki": true, + "homepage": null, + "hooks_url": "https://api.github.com/repos/Azure/azure-sdk-fake/hooks", + "html_url": "https://github.com/Azure/azure-sdk-fake", + "id": 507980610, + "is_template": false, + "issue_comment_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/comments{/number}", + "issue_events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/events{/number}", + "issues_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues{/number}", + "keys_url": "https://api.github.com/repos/Azure/azure-sdk-fake/keys{/key_id}", + "labels_url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels{/name}", + "language": "C#", + "languages_url": "https://api.github.com/repos/Azure/azure-sdk-fake/languages", + "license": { + "key": "mit", + "name": "MIT License", + "node_id": "MDc6TGljZW5zZTEz", + "spdx_id": "MIT", + "url": "https://api.github.com/licenses/mit" + }, + "merges_url": "https://api.github.com/repos/Azure/azure-sdk-fake/merges", + "milestones_url": "https://api.github.com/repos/Azure/azure-sdk-fake/milestones{/number}", + "mirror_url": null, + "name": "azure-sdk-fake", + "node_id": "R_kgDOHkcrQg", + "notifications_url": "https://api.github.com/repos/Azure/azure-sdk-fake/notifications{?since,all,participating}", + "open_issues": 5, + "open_issues_count": 5, + "owner": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + }, + "private": false, + "pulls_url": "https://api.github.com/repos/Azure/azure-sdk-fake/pulls{/number}", + "pushed_at": "2023-01-23T20:07:27Z", + "releases_url": "https://api.github.com/repos/Azure/azure-sdk-fake/releases{/id}", + "size": 29059, + "ssh_url": "git@github.com:Azure/azure-sdk-fake.git", + "stargazers_count": 0, + "stargazers_url": "https://api.github.com/repos/Azure/azure-sdk-fake/stargazers", + "statuses_url": "https://api.github.com/repos/Azure/azure-sdk-fake/statuses/{sha}", + "subscribers_url": "https://api.github.com/repos/Azure/azure-sdk-fake/subscribers", + "subscription_url": "https://api.github.com/repos/Azure/azure-sdk-fake/subscription", + "svn_url": "https://github.com/Azure/azure-sdk-fake", + "tags_url": "https://api.github.com/repos/Azure/azure-sdk-fake/tags", + "teams_url": "https://api.github.com/repos/Azure/azure-sdk-fake/teams", + "topics": [], + "trees_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/trees{/sha}", + "updated_at": "2023-01-23T19:54:18Z", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake", + "visibility": "public", + "watchers": 0, + "watchers_count": 0, + "web_commit_signoff_required": false + }, + "sender": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser2/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser2/followers", + "following_url": "https://api.github.com/users/FakeUser2/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser2/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser2", + "id": 13556087, + "login": "FakeUser2", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser2/orgs", + "received_events_url": "https://api.github.com/users/FakeUser2/received_events", + "repos_url": "https://api.github.com/users/FakeUser2/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser2/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser2/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser2" + } +} diff --git a/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Tests.JsonEventPayloads/IssueAddressedCommands_issue_comment_created_same_user.json b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Tests.JsonEventPayloads/IssueAddressedCommands_issue_comment_created_same_user.json new file mode 100644 index 00000000000..65537ecb5a6 --- /dev/null +++ b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Tests.JsonEventPayloads/IssueAddressedCommands_issue_comment_created_same_user.json @@ -0,0 +1,243 @@ +{ + "action": "created", + "comment": { + "author_association": "OWNER", + "body": "Comment for IssueAddressedCommands test payload which needs to contain /unresolve.", + "created_at": "2023-01-24T17:00:13Z", + "html_url": "https://github.com/Azure/azure-sdk-fake/issues/1#issuecomment-1402278026", + "id": 1402278026, + "issue_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/1", + "node_id": "IC_kwDOHkcrQs5TlRCK", + "performed_via_github_app": null, + "reactions": { + "+1": 0, + "-1": 0, + "confused": 0, + "eyes": 0, + "heart": 0, + "hooray": 0, + "laugh": 0, + "rocket": 0, + "total_count": 0, + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/comments/1402278026/reactions" + }, + "updated_at": "2023-01-24T17:00:13Z", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/comments/1402278026", + "user": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + } + }, + "issue": { + "active_lock_reason": null, + "assignee": null, + "assignees": [], + "author_association": "OWNER", + "body": "This is just a test issue", + "closed_at": "2022-12-09T16:48:56Z", + "comments": 6, + "comments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/1/comments", + "created_at": "2022-10-20T22:32:02Z", + "events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/1/events", + "html_url": "https://github.com/Azure/azure-sdk-fake/issues/1", + "id": 1417400997, + "labels": [ + { + "color": "0679ED", + "default": false, + "description": "", + "id": 5074290839, + "name": "issue-addressed", + "node_id": "LA_kwDOHkcrQs8AAAABLnOIlw", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels/issue-addressed" + } + ], + "labels_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/1/labels{/name}", + "locked": false, + "milestone": null, + "node_id": "I_kwDOHkcrQs5Ue9Kl", + "number": 1, + "performed_via_github_app": null, + "reactions": { + "+1": 0, + "-1": 0, + "confused": 0, + "eyes": 0, + "heart": 0, + "hooray": 0, + "laugh": 0, + "rocket": 0, + "total_count": 0, + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/1/reactions" + }, + "repository_url": "https://api.github.com/repos/Azure/azure-sdk-fake", + "state": "closed", + "state_reason": "completed", + "timeline_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/1/timeline", + "title": "This is just a test issue", + "updated_at": "2023-01-24T17:00:13Z", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/1", + "user": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + } + }, + "repository": { + "allow_forking": true, + "archive_url": "https://api.github.com/repos/Azure/azure-sdk-fake/{archive_format}{/ref}", + "archived": false, + "assignees_url": "https://api.github.com/repos/Azure/azure-sdk-fake/assignees{/user}", + "blobs_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/blobs{/sha}", + "branches_url": "https://api.github.com/repos/Azure/azure-sdk-fake/branches{/branch}", + "clone_url": "https://github.com/Azure/azure-sdk-fake.git", + "collaborators_url": "https://api.github.com/repos/Azure/azure-sdk-fake/collaborators{/collaborator}", + "comments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/comments{/number}", + "commits_url": "https://api.github.com/repos/Azure/azure-sdk-fake/commits{/sha}", + "compare_url": "https://api.github.com/repos/Azure/azure-sdk-fake/compare/{base}...{head}", + "contents_url": "https://api.github.com/repos/Azure/azure-sdk-fake/contents/{+path}", + "contributors_url": "https://api.github.com/repos/Azure/azure-sdk-fake/contributors", + "created_at": "2022-06-27T16:19:29Z", + "default_branch": "main", + "deployments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/deployments", + "description": "Tools repository leveraged by the Azure SDK team.", + "disabled": false, + "downloads_url": "https://api.github.com/repos/Azure/azure-sdk-fake/downloads", + "events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/events", + "fork": true, + "forks": 0, + "forks_count": 0, + "forks_url": "https://api.github.com/repos/Azure/azure-sdk-fake/forks", + "full_name": "Azure/azure-sdk-fake", + "git_commits_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/commits{/sha}", + "git_refs_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/refs{/sha}", + "git_tags_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/tags{/sha}", + "git_url": "git://github.com/Azure/azure-sdk-fake.git", + "has_discussions": false, + "has_downloads": true, + "has_issues": true, + "has_pages": false, + "has_projects": true, + "has_wiki": true, + "homepage": null, + "hooks_url": "https://api.github.com/repos/Azure/azure-sdk-fake/hooks", + "html_url": "https://github.com/Azure/azure-sdk-fake", + "id": 507980610, + "is_template": false, + "issue_comment_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/comments{/number}", + "issue_events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/events{/number}", + "issues_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues{/number}", + "keys_url": "https://api.github.com/repos/Azure/azure-sdk-fake/keys{/key_id}", + "labels_url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels{/name}", + "language": "C#", + "languages_url": "https://api.github.com/repos/Azure/azure-sdk-fake/languages", + "license": { + "key": "mit", + "name": "MIT License", + "node_id": "MDc6TGljZW5zZTEz", + "spdx_id": "MIT", + "url": "https://api.github.com/licenses/mit" + }, + "merges_url": "https://api.github.com/repos/Azure/azure-sdk-fake/merges", + "milestones_url": "https://api.github.com/repos/Azure/azure-sdk-fake/milestones{/number}", + "mirror_url": null, + "name": "azure-sdk-fake", + "node_id": "R_kgDOHkcrQg", + "notifications_url": "https://api.github.com/repos/Azure/azure-sdk-fake/notifications{?since,all,participating}", + "open_issues": 5, + "open_issues_count": 5, + "owner": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + }, + "private": false, + "pulls_url": "https://api.github.com/repos/Azure/azure-sdk-fake/pulls{/number}", + "pushed_at": "2023-01-23T20:07:27Z", + "releases_url": "https://api.github.com/repos/Azure/azure-sdk-fake/releases{/id}", + "size": 29059, + "ssh_url": "git@github.com:Azure/azure-sdk-fake.git", + "stargazers_count": 0, + "stargazers_url": "https://api.github.com/repos/Azure/azure-sdk-fake/stargazers", + "statuses_url": "https://api.github.com/repos/Azure/azure-sdk-fake/statuses/{sha}", + "subscribers_url": "https://api.github.com/repos/Azure/azure-sdk-fake/subscribers", + "subscription_url": "https://api.github.com/repos/Azure/azure-sdk-fake/subscription", + "svn_url": "https://github.com/Azure/azure-sdk-fake", + "tags_url": "https://api.github.com/repos/Azure/azure-sdk-fake/tags", + "teams_url": "https://api.github.com/repos/Azure/azure-sdk-fake/teams", + "topics": [], + "trees_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/trees{/sha}", + "updated_at": "2023-01-23T19:54:18Z", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake", + "visibility": "public", + "watchers": 0, + "watchers_count": 0, + "web_commit_signoff_required": false + }, + "sender": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + } +} diff --git a/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Tests.JsonEventPayloads/IssueAddressedReset_issue_labeled_CXP_attention.json b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Tests.JsonEventPayloads/IssueAddressedReset_issue_labeled_CXP_attention.json new file mode 100644 index 00000000000..7df111c9ea4 --- /dev/null +++ b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Tests.JsonEventPayloads/IssueAddressedReset_issue_labeled_CXP_attention.json @@ -0,0 +1,275 @@ +{ + "action": "labeled", + "issue": { + "active_lock_reason": null, + "assignee": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + }, + "assignees": [ + { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + } + ], + "author_association": "OWNER", + "body": null, + "closed_at": null, + "comments": 0, + "comments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/14/comments", + "created_at": "2023-01-27T17:01:30Z", + "events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/14/events", + "html_url": "https://github.com/Azure/azure-sdk-fake/issues/14", + "id": 1560095682, + "labels": [ + { + "color": "d73a4a", + "default": true, + "description": "Something isn't working", + "id": 4273699693, + "name": "bug", + "node_id": "LA_kwDOHkcrQs7-u3tt", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels/bug" + }, + { + "color": "FDEB99", + "default": false, + "description": "", + "id": 5095753141, + "name": "CXP Attention", + "node_id": "LA_kwDOHkcrQs8AAAABL7sFtQ", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels/CXP%20Attention" + }, + { + "color": "0679ED", + "default": false, + "description": "", + "id": 5074290839, + "name": "issue-addressed", + "node_id": "LA_kwDOHkcrQs8AAAABLnOIlw", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels/issue-addressed" + }, + { + "color": "9C7082", + "default": false, + "description": "fake label for testing", + "id": 5095712487, + "name": "FakeLabel1", + "node_id": "LA_kwDOHkcrQs8AAAABL7pm5w", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels/FakeLabel1" + } + ], + "labels_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/14/labels{/name}", + "locked": false, + "milestone": null, + "node_id": "I_kwDOHkcrQs5c_SvC", + "number": 14, + "performed_via_github_app": null, + "reactions": { + "+1": 0, + "-1": 0, + "confused": 0, + "eyes": 0, + "heart": 0, + "hooray": 0, + "laugh": 0, + "rocket": 0, + "total_count": 0, + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/14/reactions" + }, + "repository_url": "https://api.github.com/repos/Azure/azure-sdk-fake", + "state": "open", + "state_reason": null, + "timeline_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/14/timeline", + "title": "New issue to generate event payloads for static tests", + "updated_at": "2023-01-30T18:20:53Z", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/14", + "user": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + } + }, + "label": { + "color": "FDEB99", + "default": false, + "description": "", + "id": 5095753141, + "name": "CXP Attention", + "node_id": "LA_kwDOHkcrQs8AAAABL7sFtQ", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels/CXP%20Attention" + }, + "repository": { + "allow_forking": true, + "archive_url": "https://api.github.com/repos/Azure/azure-sdk-fake/{archive_format}{/ref}", + "archived": false, + "assignees_url": "https://api.github.com/repos/Azure/azure-sdk-fake/assignees{/user}", + "blobs_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/blobs{/sha}", + "branches_url": "https://api.github.com/repos/Azure/azure-sdk-fake/branches{/branch}", + "clone_url": "https://github.com/Azure/azure-sdk-fake.git", + "collaborators_url": "https://api.github.com/repos/Azure/azure-sdk-fake/collaborators{/collaborator}", + "comments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/comments{/number}", + "commits_url": "https://api.github.com/repos/Azure/azure-sdk-fake/commits{/sha}", + "compare_url": "https://api.github.com/repos/Azure/azure-sdk-fake/compare/{base}...{head}", + "contents_url": "https://api.github.com/repos/Azure/azure-sdk-fake/contents/{+path}", + "contributors_url": "https://api.github.com/repos/Azure/azure-sdk-fake/contributors", + "created_at": "2022-06-27T16:19:29Z", + "default_branch": "main", + "deployments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/deployments", + "description": "Tools repository leveraged by the Azure SDK team.", + "disabled": false, + "downloads_url": "https://api.github.com/repos/Azure/azure-sdk-fake/downloads", + "events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/events", + "fork": true, + "forks": 0, + "forks_count": 0, + "forks_url": "https://api.github.com/repos/Azure/azure-sdk-fake/forks", + "full_name": "Azure/azure-sdk-fake", + "git_commits_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/commits{/sha}", + "git_refs_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/refs{/sha}", + "git_tags_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/tags{/sha}", + "git_url": "git://github.com/Azure/azure-sdk-fake.git", + "has_discussions": false, + "has_downloads": true, + "has_issues": true, + "has_pages": false, + "has_projects": true, + "has_wiki": true, + "homepage": null, + "hooks_url": "https://api.github.com/repos/Azure/azure-sdk-fake/hooks", + "html_url": "https://github.com/Azure/azure-sdk-fake", + "id": 507980610, + "is_template": false, + "issue_comment_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/comments{/number}", + "issue_events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/events{/number}", + "issues_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues{/number}", + "keys_url": "https://api.github.com/repos/Azure/azure-sdk-fake/keys{/key_id}", + "labels_url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels{/name}", + "language": "C#", + "languages_url": "https://api.github.com/repos/Azure/azure-sdk-fake/languages", + "license": { + "key": "mit", + "name": "MIT License", + "node_id": "MDc6TGljZW5zZTEz", + "spdx_id": "MIT", + "url": "https://api.github.com/licenses/mit" + }, + "merges_url": "https://api.github.com/repos/Azure/azure-sdk-fake/merges", + "milestones_url": "https://api.github.com/repos/Azure/azure-sdk-fake/milestones{/number}", + "mirror_url": null, + "name": "azure-sdk-fake", + "node_id": "R_kgDOHkcrQg", + "notifications_url": "https://api.github.com/repos/Azure/azure-sdk-fake/notifications{?since,all,participating}", + "open_issues": 6, + "open_issues_count": 6, + "owner": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + }, + "private": false, + "pulls_url": "https://api.github.com/repos/Azure/azure-sdk-fake/pulls{/number}", + "pushed_at": "2023-01-27T16:33:00Z", + "releases_url": "https://api.github.com/repos/Azure/azure-sdk-fake/releases{/id}", + "size": 29098, + "ssh_url": "git@github.com:Azure/azure-sdk-fake.git", + "stargazers_count": 0, + "stargazers_url": "https://api.github.com/repos/Azure/azure-sdk-fake/stargazers", + "statuses_url": "https://api.github.com/repos/Azure/azure-sdk-fake/statuses/{sha}", + "subscribers_url": "https://api.github.com/repos/Azure/azure-sdk-fake/subscribers", + "subscription_url": "https://api.github.com/repos/Azure/azure-sdk-fake/subscription", + "svn_url": "https://github.com/Azure/azure-sdk-fake", + "tags_url": "https://api.github.com/repos/Azure/azure-sdk-fake/tags", + "teams_url": "https://api.github.com/repos/Azure/azure-sdk-fake/teams", + "topics": [], + "trees_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/trees{/sha}", + "updated_at": "2023-01-23T19:54:18Z", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake", + "visibility": "public", + "watchers": 0, + "watchers_count": 0, + "web_commit_signoff_required": false + }, + "sender": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + } +} diff --git a/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Tests.JsonEventPayloads/IssueAddressedReset_issue_labeled_needs-author-feedack.json b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Tests.JsonEventPayloads/IssueAddressedReset_issue_labeled_needs-author-feedack.json new file mode 100644 index 00000000000..a6615b0b34e --- /dev/null +++ b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Tests.JsonEventPayloads/IssueAddressedReset_issue_labeled_needs-author-feedack.json @@ -0,0 +1,275 @@ +{ + "action": "labeled", + "issue": { + "active_lock_reason": null, + "assignee": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + }, + "assignees": [ + { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + } + ], + "author_association": "OWNER", + "body": null, + "closed_at": null, + "comments": 0, + "comments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/14/comments", + "created_at": "2023-01-27T17:01:30Z", + "events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/14/events", + "html_url": "https://github.com/Azure/azure-sdk-fake/issues/14", + "id": 1560095682, + "labels": [ + { + "color": "d73a4a", + "default": true, + "description": "Something isn't working", + "id": 4273699693, + "name": "bug", + "node_id": "LA_kwDOHkcrQs7-u3tt", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels/bug" + }, + { + "color": "CFDBFC", + "default": false, + "description": "", + "id": 5070852679, + "name": "needs-author-feedback", + "node_id": "LA_kwDOHkcrQs8AAAABLj8SRw", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels/needs-author-feedback" + }, + { + "color": "0679ED", + "default": false, + "description": "", + "id": 5074290839, + "name": "issue-addressed", + "node_id": "LA_kwDOHkcrQs8AAAABLnOIlw", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels/issue-addressed" + }, + { + "color": "9C7082", + "default": false, + "description": "fake label for testing", + "id": 5095712487, + "name": "FakeLabel1", + "node_id": "LA_kwDOHkcrQs8AAAABL7pm5w", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels/FakeLabel1" + } + ], + "labels_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/14/labels{/name}", + "locked": false, + "milestone": null, + "node_id": "I_kwDOHkcrQs5c_SvC", + "number": 14, + "performed_via_github_app": null, + "reactions": { + "+1": 0, + "-1": 0, + "confused": 0, + "eyes": 0, + "heart": 0, + "hooray": 0, + "laugh": 0, + "rocket": 0, + "total_count": 0, + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/14/reactions" + }, + "repository_url": "https://api.github.com/repos/Azure/azure-sdk-fake", + "state": "open", + "state_reason": null, + "timeline_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/14/timeline", + "title": "New issue to generate event payloads for static tests", + "updated_at": "2023-01-30T18:15:42Z", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/14", + "user": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + } + }, + "label": { + "color": "CFDBFC", + "default": false, + "description": "", + "id": 5070852679, + "name": "needs-author-feedback", + "node_id": "LA_kwDOHkcrQs8AAAABLj8SRw", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels/needs-author-feedback" + }, + "repository": { + "allow_forking": true, + "archive_url": "https://api.github.com/repos/Azure/azure-sdk-fake/{archive_format}{/ref}", + "archived": false, + "assignees_url": "https://api.github.com/repos/Azure/azure-sdk-fake/assignees{/user}", + "blobs_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/blobs{/sha}", + "branches_url": "https://api.github.com/repos/Azure/azure-sdk-fake/branches{/branch}", + "clone_url": "https://github.com/Azure/azure-sdk-fake.git", + "collaborators_url": "https://api.github.com/repos/Azure/azure-sdk-fake/collaborators{/collaborator}", + "comments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/comments{/number}", + "commits_url": "https://api.github.com/repos/Azure/azure-sdk-fake/commits{/sha}", + "compare_url": "https://api.github.com/repos/Azure/azure-sdk-fake/compare/{base}...{head}", + "contents_url": "https://api.github.com/repos/Azure/azure-sdk-fake/contents/{+path}", + "contributors_url": "https://api.github.com/repos/Azure/azure-sdk-fake/contributors", + "created_at": "2022-06-27T16:19:29Z", + "default_branch": "main", + "deployments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/deployments", + "description": "Tools repository leveraged by the Azure SDK team.", + "disabled": false, + "downloads_url": "https://api.github.com/repos/Azure/azure-sdk-fake/downloads", + "events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/events", + "fork": true, + "forks": 0, + "forks_count": 0, + "forks_url": "https://api.github.com/repos/Azure/azure-sdk-fake/forks", + "full_name": "Azure/azure-sdk-fake", + "git_commits_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/commits{/sha}", + "git_refs_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/refs{/sha}", + "git_tags_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/tags{/sha}", + "git_url": "git://github.com/Azure/azure-sdk-fake.git", + "has_discussions": false, + "has_downloads": true, + "has_issues": true, + "has_pages": false, + "has_projects": true, + "has_wiki": true, + "homepage": null, + "hooks_url": "https://api.github.com/repos/Azure/azure-sdk-fake/hooks", + "html_url": "https://github.com/Azure/azure-sdk-fake", + "id": 507980610, + "is_template": false, + "issue_comment_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/comments{/number}", + "issue_events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/events{/number}", + "issues_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues{/number}", + "keys_url": "https://api.github.com/repos/Azure/azure-sdk-fake/keys{/key_id}", + "labels_url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels{/name}", + "language": "C#", + "languages_url": "https://api.github.com/repos/Azure/azure-sdk-fake/languages", + "license": { + "key": "mit", + "name": "MIT License", + "node_id": "MDc6TGljZW5zZTEz", + "spdx_id": "MIT", + "url": "https://api.github.com/licenses/mit" + }, + "merges_url": "https://api.github.com/repos/Azure/azure-sdk-fake/merges", + "milestones_url": "https://api.github.com/repos/Azure/azure-sdk-fake/milestones{/number}", + "mirror_url": null, + "name": "azure-sdk-fake", + "node_id": "R_kgDOHkcrQg", + "notifications_url": "https://api.github.com/repos/Azure/azure-sdk-fake/notifications{?since,all,participating}", + "open_issues": 6, + "open_issues_count": 6, + "owner": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + }, + "private": false, + "pulls_url": "https://api.github.com/repos/Azure/azure-sdk-fake/pulls{/number}", + "pushed_at": "2023-01-27T16:33:00Z", + "releases_url": "https://api.github.com/repos/Azure/azure-sdk-fake/releases{/id}", + "size": 29098, + "ssh_url": "git@github.com:Azure/azure-sdk-fake.git", + "stargazers_count": 0, + "stargazers_url": "https://api.github.com/repos/Azure/azure-sdk-fake/stargazers", + "statuses_url": "https://api.github.com/repos/Azure/azure-sdk-fake/statuses/{sha}", + "subscribers_url": "https://api.github.com/repos/Azure/azure-sdk-fake/subscribers", + "subscription_url": "https://api.github.com/repos/Azure/azure-sdk-fake/subscription", + "svn_url": "https://github.com/Azure/azure-sdk-fake", + "tags_url": "https://api.github.com/repos/Azure/azure-sdk-fake/tags", + "teams_url": "https://api.github.com/repos/Azure/azure-sdk-fake/teams", + "topics": [], + "trees_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/trees{/sha}", + "updated_at": "2023-01-23T19:54:18Z", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake", + "visibility": "public", + "watchers": 0, + "watchers_count": 0, + "web_commit_signoff_required": false + }, + "sender": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + } +} diff --git a/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Tests.JsonEventPayloads/IssueAddressedReset_issue_labeled_needs-team-attention.json b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Tests.JsonEventPayloads/IssueAddressedReset_issue_labeled_needs-team-attention.json new file mode 100644 index 00000000000..a7f11a808dd --- /dev/null +++ b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Tests.JsonEventPayloads/IssueAddressedReset_issue_labeled_needs-team-attention.json @@ -0,0 +1,275 @@ +{ + "action": "labeled", + "issue": { + "active_lock_reason": null, + "assignee": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + }, + "assignees": [ + { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + } + ], + "author_association": "OWNER", + "body": null, + "closed_at": null, + "comments": 0, + "comments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/14/comments", + "created_at": "2023-01-27T17:01:30Z", + "events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/14/events", + "html_url": "https://github.com/Azure/azure-sdk-fake/issues/14", + "id": 1560095682, + "labels": [ + { + "color": "d73a4a", + "default": true, + "description": "Something isn't working", + "id": 4273699693, + "name": "bug", + "node_id": "LA_kwDOHkcrQs7-u3tt", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels/bug" + }, + { + "color": "0679ED", + "default": false, + "description": "", + "id": 5074290839, + "name": "issue-addressed", + "node_id": "LA_kwDOHkcrQs8AAAABLnOIlw", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels/issue-addressed" + }, + { + "color": "9C7082", + "default": false, + "description": "fake label for testing", + "id": 5095712487, + "name": "FakeLabel1", + "node_id": "LA_kwDOHkcrQs8AAAABL7pm5w", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels/FakeLabel1" + }, + { + "color": "027919", + "default": false, + "description": "", + "id": 5096061354, + "name": "needs-team-attention", + "node_id": "LA_kwDOHkcrQs8AAAABL7-5qg", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels/needs-team-attention" + } + ], + "labels_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/14/labels{/name}", + "locked": false, + "milestone": null, + "node_id": "I_kwDOHkcrQs5c_SvC", + "number": 14, + "performed_via_github_app": null, + "reactions": { + "+1": 0, + "-1": 0, + "confused": 0, + "eyes": 0, + "heart": 0, + "hooray": 0, + "laugh": 0, + "rocket": 0, + "total_count": 0, + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/14/reactions" + }, + "repository_url": "https://api.github.com/repos/Azure/azure-sdk-fake", + "state": "open", + "state_reason": null, + "timeline_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/14/timeline", + "title": "New issue to generate event payloads for static tests", + "updated_at": "2023-01-30T18:14:21Z", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/14", + "user": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + } + }, + "label": { + "color": "027919", + "default": false, + "description": "", + "id": 5096061354, + "name": "needs-team-attention", + "node_id": "LA_kwDOHkcrQs8AAAABL7-5qg", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels/needs-team-attention" + }, + "repository": { + "allow_forking": true, + "archive_url": "https://api.github.com/repos/Azure/azure-sdk-fake/{archive_format}{/ref}", + "archived": false, + "assignees_url": "https://api.github.com/repos/Azure/azure-sdk-fake/assignees{/user}", + "blobs_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/blobs{/sha}", + "branches_url": "https://api.github.com/repos/Azure/azure-sdk-fake/branches{/branch}", + "clone_url": "https://github.com/Azure/azure-sdk-fake.git", + "collaborators_url": "https://api.github.com/repos/Azure/azure-sdk-fake/collaborators{/collaborator}", + "comments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/comments{/number}", + "commits_url": "https://api.github.com/repos/Azure/azure-sdk-fake/commits{/sha}", + "compare_url": "https://api.github.com/repos/Azure/azure-sdk-fake/compare/{base}...{head}", + "contents_url": "https://api.github.com/repos/Azure/azure-sdk-fake/contents/{+path}", + "contributors_url": "https://api.github.com/repos/Azure/azure-sdk-fake/contributors", + "created_at": "2022-06-27T16:19:29Z", + "default_branch": "main", + "deployments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/deployments", + "description": "Tools repository leveraged by the Azure SDK team.", + "disabled": false, + "downloads_url": "https://api.github.com/repos/Azure/azure-sdk-fake/downloads", + "events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/events", + "fork": true, + "forks": 0, + "forks_count": 0, + "forks_url": "https://api.github.com/repos/Azure/azure-sdk-fake/forks", + "full_name": "Azure/azure-sdk-fake", + "git_commits_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/commits{/sha}", + "git_refs_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/refs{/sha}", + "git_tags_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/tags{/sha}", + "git_url": "git://github.com/Azure/azure-sdk-fake.git", + "has_discussions": false, + "has_downloads": true, + "has_issues": true, + "has_pages": false, + "has_projects": true, + "has_wiki": true, + "homepage": null, + "hooks_url": "https://api.github.com/repos/Azure/azure-sdk-fake/hooks", + "html_url": "https://github.com/Azure/azure-sdk-fake", + "id": 507980610, + "is_template": false, + "issue_comment_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/comments{/number}", + "issue_events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/events{/number}", + "issues_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues{/number}", + "keys_url": "https://api.github.com/repos/Azure/azure-sdk-fake/keys{/key_id}", + "labels_url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels{/name}", + "language": "C#", + "languages_url": "https://api.github.com/repos/Azure/azure-sdk-fake/languages", + "license": { + "key": "mit", + "name": "MIT License", + "node_id": "MDc6TGljZW5zZTEz", + "spdx_id": "MIT", + "url": "https://api.github.com/licenses/mit" + }, + "merges_url": "https://api.github.com/repos/Azure/azure-sdk-fake/merges", + "milestones_url": "https://api.github.com/repos/Azure/azure-sdk-fake/milestones{/number}", + "mirror_url": null, + "name": "azure-sdk-fake", + "node_id": "R_kgDOHkcrQg", + "notifications_url": "https://api.github.com/repos/Azure/azure-sdk-fake/notifications{?since,all,participating}", + "open_issues": 6, + "open_issues_count": 6, + "owner": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + }, + "private": false, + "pulls_url": "https://api.github.com/repos/Azure/azure-sdk-fake/pulls{/number}", + "pushed_at": "2023-01-27T16:33:00Z", + "releases_url": "https://api.github.com/repos/Azure/azure-sdk-fake/releases{/id}", + "size": 29098, + "ssh_url": "git@github.com:Azure/azure-sdk-fake.git", + "stargazers_count": 0, + "stargazers_url": "https://api.github.com/repos/Azure/azure-sdk-fake/stargazers", + "statuses_url": "https://api.github.com/repos/Azure/azure-sdk-fake/statuses/{sha}", + "subscribers_url": "https://api.github.com/repos/Azure/azure-sdk-fake/subscribers", + "subscription_url": "https://api.github.com/repos/Azure/azure-sdk-fake/subscription", + "svn_url": "https://github.com/Azure/azure-sdk-fake", + "tags_url": "https://api.github.com/repos/Azure/azure-sdk-fake/tags", + "teams_url": "https://api.github.com/repos/Azure/azure-sdk-fake/teams", + "topics": [], + "trees_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/trees{/sha}", + "updated_at": "2023-01-23T19:54:18Z", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake", + "visibility": "public", + "watchers": 0, + "watchers_count": 0, + "web_commit_signoff_required": false + }, + "sender": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + } +} diff --git a/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Tests.JsonEventPayloads/IssueAddressedReset_issue_labeled_needs-team-triage.json b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Tests.JsonEventPayloads/IssueAddressedReset_issue_labeled_needs-team-triage.json new file mode 100644 index 00000000000..66b487d84ce --- /dev/null +++ b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Tests.JsonEventPayloads/IssueAddressedReset_issue_labeled_needs-team-triage.json @@ -0,0 +1,275 @@ +{ + "action": "labeled", + "issue": { + "active_lock_reason": null, + "assignee": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + }, + "assignees": [ + { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + } + ], + "author_association": "OWNER", + "body": null, + "closed_at": null, + "comments": 0, + "comments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/14/comments", + "created_at": "2023-01-27T17:01:30Z", + "events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/14/events", + "html_url": "https://github.com/Azure/azure-sdk-fake/issues/14", + "id": 1560095682, + "labels": [ + { + "color": "d73a4a", + "default": true, + "description": "Something isn't working", + "id": 4273699693, + "name": "bug", + "node_id": "LA_kwDOHkcrQs7-u3tt", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels/bug" + }, + { + "color": "0679ED", + "default": false, + "description": "", + "id": 5074290839, + "name": "issue-addressed", + "node_id": "LA_kwDOHkcrQs8AAAABLnOIlw", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels/issue-addressed" + }, + { + "color": "9C7082", + "default": false, + "description": "fake label for testing", + "id": 5095712487, + "name": "FakeLabel1", + "node_id": "LA_kwDOHkcrQs8AAAABL7pm5w", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels/FakeLabel1" + }, + { + "color": "DBC2DE", + "default": false, + "description": "", + "id": 5095805781, + "name": "needs-team-triage", + "node_id": "LA_kwDOHkcrQs8AAAABL7vTVQ", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels/needs-team-triage" + } + ], + "labels_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/14/labels{/name}", + "locked": false, + "milestone": null, + "node_id": "I_kwDOHkcrQs5c_SvC", + "number": 14, + "performed_via_github_app": null, + "reactions": { + "+1": 0, + "-1": 0, + "confused": 0, + "eyes": 0, + "heart": 0, + "hooray": 0, + "laugh": 0, + "rocket": 0, + "total_count": 0, + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/14/reactions" + }, + "repository_url": "https://api.github.com/repos/Azure/azure-sdk-fake", + "state": "open", + "state_reason": null, + "timeline_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/14/timeline", + "title": "New issue to generate event payloads for static tests", + "updated_at": "2023-01-30T18:19:10Z", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/14", + "user": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + } + }, + "label": { + "color": "DBC2DE", + "default": false, + "description": "", + "id": 5095805781, + "name": "needs-team-triage", + "node_id": "LA_kwDOHkcrQs8AAAABL7vTVQ", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels/needs-team-triage" + }, + "repository": { + "allow_forking": true, + "archive_url": "https://api.github.com/repos/Azure/azure-sdk-fake/{archive_format}{/ref}", + "archived": false, + "assignees_url": "https://api.github.com/repos/Azure/azure-sdk-fake/assignees{/user}", + "blobs_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/blobs{/sha}", + "branches_url": "https://api.github.com/repos/Azure/azure-sdk-fake/branches{/branch}", + "clone_url": "https://github.com/Azure/azure-sdk-fake.git", + "collaborators_url": "https://api.github.com/repos/Azure/azure-sdk-fake/collaborators{/collaborator}", + "comments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/comments{/number}", + "commits_url": "https://api.github.com/repos/Azure/azure-sdk-fake/commits{/sha}", + "compare_url": "https://api.github.com/repos/Azure/azure-sdk-fake/compare/{base}...{head}", + "contents_url": "https://api.github.com/repos/Azure/azure-sdk-fake/contents/{+path}", + "contributors_url": "https://api.github.com/repos/Azure/azure-sdk-fake/contributors", + "created_at": "2022-06-27T16:19:29Z", + "default_branch": "main", + "deployments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/deployments", + "description": "Tools repository leveraged by the Azure SDK team.", + "disabled": false, + "downloads_url": "https://api.github.com/repos/Azure/azure-sdk-fake/downloads", + "events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/events", + "fork": true, + "forks": 0, + "forks_count": 0, + "forks_url": "https://api.github.com/repos/Azure/azure-sdk-fake/forks", + "full_name": "Azure/azure-sdk-fake", + "git_commits_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/commits{/sha}", + "git_refs_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/refs{/sha}", + "git_tags_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/tags{/sha}", + "git_url": "git://github.com/Azure/azure-sdk-fake.git", + "has_discussions": false, + "has_downloads": true, + "has_issues": true, + "has_pages": false, + "has_projects": true, + "has_wiki": true, + "homepage": null, + "hooks_url": "https://api.github.com/repos/Azure/azure-sdk-fake/hooks", + "html_url": "https://github.com/Azure/azure-sdk-fake", + "id": 507980610, + "is_template": false, + "issue_comment_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/comments{/number}", + "issue_events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/events{/number}", + "issues_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues{/number}", + "keys_url": "https://api.github.com/repos/Azure/azure-sdk-fake/keys{/key_id}", + "labels_url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels{/name}", + "language": "C#", + "languages_url": "https://api.github.com/repos/Azure/azure-sdk-fake/languages", + "license": { + "key": "mit", + "name": "MIT License", + "node_id": "MDc6TGljZW5zZTEz", + "spdx_id": "MIT", + "url": "https://api.github.com/licenses/mit" + }, + "merges_url": "https://api.github.com/repos/Azure/azure-sdk-fake/merges", + "milestones_url": "https://api.github.com/repos/Azure/azure-sdk-fake/milestones{/number}", + "mirror_url": null, + "name": "azure-sdk-fake", + "node_id": "R_kgDOHkcrQg", + "notifications_url": "https://api.github.com/repos/Azure/azure-sdk-fake/notifications{?since,all,participating}", + "open_issues": 6, + "open_issues_count": 6, + "owner": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + }, + "private": false, + "pulls_url": "https://api.github.com/repos/Azure/azure-sdk-fake/pulls{/number}", + "pushed_at": "2023-01-27T16:33:00Z", + "releases_url": "https://api.github.com/repos/Azure/azure-sdk-fake/releases{/id}", + "size": 29098, + "ssh_url": "git@github.com:Azure/azure-sdk-fake.git", + "stargazers_count": 0, + "stargazers_url": "https://api.github.com/repos/Azure/azure-sdk-fake/stargazers", + "statuses_url": "https://api.github.com/repos/Azure/azure-sdk-fake/statuses/{sha}", + "subscribers_url": "https://api.github.com/repos/Azure/azure-sdk-fake/subscribers", + "subscription_url": "https://api.github.com/repos/Azure/azure-sdk-fake/subscription", + "svn_url": "https://github.com/Azure/azure-sdk-fake", + "tags_url": "https://api.github.com/repos/Azure/azure-sdk-fake/tags", + "teams_url": "https://api.github.com/repos/Azure/azure-sdk-fake/teams", + "topics": [], + "trees_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/trees{/sha}", + "updated_at": "2023-01-23T19:54:18Z", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake", + "visibility": "public", + "watchers": 0, + "watchers_count": 0, + "web_commit_signoff_required": false + }, + "sender": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + } +} diff --git a/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Tests.JsonEventPayloads/IssueAddressedReset_issue_labeled_needs-triage.json b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Tests.JsonEventPayloads/IssueAddressedReset_issue_labeled_needs-triage.json new file mode 100644 index 00000000000..5ac92ade3ce --- /dev/null +++ b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Tests.JsonEventPayloads/IssueAddressedReset_issue_labeled_needs-triage.json @@ -0,0 +1,275 @@ +{ + "action": "labeled", + "issue": { + "active_lock_reason": null, + "assignee": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + }, + "assignees": [ + { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + } + ], + "author_association": "OWNER", + "body": null, + "closed_at": null, + "comments": 0, + "comments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/14/comments", + "created_at": "2023-01-27T17:01:30Z", + "events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/14/events", + "html_url": "https://github.com/Azure/azure-sdk-fake/issues/14", + "id": 1560095682, + "labels": [ + { + "color": "d73a4a", + "default": true, + "description": "Something isn't working", + "id": 4273699693, + "name": "bug", + "node_id": "LA_kwDOHkcrQs7-u3tt", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels/bug" + }, + { + "color": "ededed", + "default": false, + "description": null, + "id": 4704569627, + "name": "needs-triage", + "node_id": "LA_kwDOHkcrQs8AAAABGGoJGw", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels/needs-triage" + }, + { + "color": "0679ED", + "default": false, + "description": "", + "id": 5074290839, + "name": "issue-addressed", + "node_id": "LA_kwDOHkcrQs8AAAABLnOIlw", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels/issue-addressed" + }, + { + "color": "9C7082", + "default": false, + "description": "fake label for testing", + "id": 5095712487, + "name": "FakeLabel1", + "node_id": "LA_kwDOHkcrQs8AAAABL7pm5w", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels/FakeLabel1" + } + ], + "labels_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/14/labels{/name}", + "locked": false, + "milestone": null, + "node_id": "I_kwDOHkcrQs5c_SvC", + "number": 14, + "performed_via_github_app": null, + "reactions": { + "+1": 0, + "-1": 0, + "confused": 0, + "eyes": 0, + "heart": 0, + "hooray": 0, + "laugh": 0, + "rocket": 0, + "total_count": 0, + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/14/reactions" + }, + "repository_url": "https://api.github.com/repos/Azure/azure-sdk-fake", + "state": "open", + "state_reason": null, + "timeline_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/14/timeline", + "title": "New issue to generate event payloads for static tests", + "updated_at": "2023-01-30T18:17:54Z", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/14", + "user": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + } + }, + "label": { + "color": "ededed", + "default": false, + "description": null, + "id": 4704569627, + "name": "needs-triage", + "node_id": "LA_kwDOHkcrQs8AAAABGGoJGw", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels/needs-triage" + }, + "repository": { + "allow_forking": true, + "archive_url": "https://api.github.com/repos/Azure/azure-sdk-fake/{archive_format}{/ref}", + "archived": false, + "assignees_url": "https://api.github.com/repos/Azure/azure-sdk-fake/assignees{/user}", + "blobs_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/blobs{/sha}", + "branches_url": "https://api.github.com/repos/Azure/azure-sdk-fake/branches{/branch}", + "clone_url": "https://github.com/Azure/azure-sdk-fake.git", + "collaborators_url": "https://api.github.com/repos/Azure/azure-sdk-fake/collaborators{/collaborator}", + "comments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/comments{/number}", + "commits_url": "https://api.github.com/repos/Azure/azure-sdk-fake/commits{/sha}", + "compare_url": "https://api.github.com/repos/Azure/azure-sdk-fake/compare/{base}...{head}", + "contents_url": "https://api.github.com/repos/Azure/azure-sdk-fake/contents/{+path}", + "contributors_url": "https://api.github.com/repos/Azure/azure-sdk-fake/contributors", + "created_at": "2022-06-27T16:19:29Z", + "default_branch": "main", + "deployments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/deployments", + "description": "Tools repository leveraged by the Azure SDK team.", + "disabled": false, + "downloads_url": "https://api.github.com/repos/Azure/azure-sdk-fake/downloads", + "events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/events", + "fork": true, + "forks": 0, + "forks_count": 0, + "forks_url": "https://api.github.com/repos/Azure/azure-sdk-fake/forks", + "full_name": "Azure/azure-sdk-fake", + "git_commits_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/commits{/sha}", + "git_refs_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/refs{/sha}", + "git_tags_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/tags{/sha}", + "git_url": "git://github.com/Azure/azure-sdk-fake.git", + "has_discussions": false, + "has_downloads": true, + "has_issues": true, + "has_pages": false, + "has_projects": true, + "has_wiki": true, + "homepage": null, + "hooks_url": "https://api.github.com/repos/Azure/azure-sdk-fake/hooks", + "html_url": "https://github.com/Azure/azure-sdk-fake", + "id": 507980610, + "is_template": false, + "issue_comment_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/comments{/number}", + "issue_events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/events{/number}", + "issues_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues{/number}", + "keys_url": "https://api.github.com/repos/Azure/azure-sdk-fake/keys{/key_id}", + "labels_url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels{/name}", + "language": "C#", + "languages_url": "https://api.github.com/repos/Azure/azure-sdk-fake/languages", + "license": { + "key": "mit", + "name": "MIT License", + "node_id": "MDc6TGljZW5zZTEz", + "spdx_id": "MIT", + "url": "https://api.github.com/licenses/mit" + }, + "merges_url": "https://api.github.com/repos/Azure/azure-sdk-fake/merges", + "milestones_url": "https://api.github.com/repos/Azure/azure-sdk-fake/milestones{/number}", + "mirror_url": null, + "name": "azure-sdk-fake", + "node_id": "R_kgDOHkcrQg", + "notifications_url": "https://api.github.com/repos/Azure/azure-sdk-fake/notifications{?since,all,participating}", + "open_issues": 6, + "open_issues_count": 6, + "owner": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + }, + "private": false, + "pulls_url": "https://api.github.com/repos/Azure/azure-sdk-fake/pulls{/number}", + "pushed_at": "2023-01-27T16:33:00Z", + "releases_url": "https://api.github.com/repos/Azure/azure-sdk-fake/releases{/id}", + "size": 29098, + "ssh_url": "git@github.com:Azure/azure-sdk-fake.git", + "stargazers_count": 0, + "stargazers_url": "https://api.github.com/repos/Azure/azure-sdk-fake/stargazers", + "statuses_url": "https://api.github.com/repos/Azure/azure-sdk-fake/statuses/{sha}", + "subscribers_url": "https://api.github.com/repos/Azure/azure-sdk-fake/subscribers", + "subscription_url": "https://api.github.com/repos/Azure/azure-sdk-fake/subscription", + "svn_url": "https://github.com/Azure/azure-sdk-fake", + "tags_url": "https://api.github.com/repos/Azure/azure-sdk-fake/tags", + "teams_url": "https://api.github.com/repos/Azure/azure-sdk-fake/teams", + "topics": [], + "trees_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/trees{/sha}", + "updated_at": "2023-01-23T19:54:18Z", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake", + "visibility": "public", + "watchers": 0, + "watchers_count": 0, + "web_commit_signoff_required": false + }, + "sender": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + } +} diff --git a/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Tests.JsonEventPayloads/IssueAddressedReset_issue_labeled_service_attention.json b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Tests.JsonEventPayloads/IssueAddressedReset_issue_labeled_service_attention.json new file mode 100644 index 00000000000..d4cd8dc0906 --- /dev/null +++ b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Tests.JsonEventPayloads/IssueAddressedReset_issue_labeled_service_attention.json @@ -0,0 +1,275 @@ +{ + "action": "labeled", + "issue": { + "active_lock_reason": null, + "assignee": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + }, + "assignees": [ + { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + } + ], + "author_association": "OWNER", + "body": null, + "closed_at": null, + "comments": 0, + "comments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/14/comments", + "created_at": "2023-01-27T17:01:30Z", + "events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/14/events", + "html_url": "https://github.com/Azure/azure-sdk-fake/issues/14", + "id": 1560095682, + "labels": [ + { + "color": "d73a4a", + "default": true, + "description": "Something isn't working", + "id": 4273699693, + "name": "bug", + "node_id": "LA_kwDOHkcrQs7-u3tt", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels/bug" + }, + { + "color": "F75BB2", + "default": false, + "description": "", + "id": 5095715984, + "name": "Service Attention", + "node_id": "LA_kwDOHkcrQs8AAAABL7p0kA", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels/Service%20Attention" + }, + { + "color": "0679ED", + "default": false, + "description": "", + "id": 5074290839, + "name": "issue-addressed", + "node_id": "LA_kwDOHkcrQs8AAAABLnOIlw", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels/issue-addressed" + }, + { + "color": "9C7082", + "default": false, + "description": "fake label for testing", + "id": 5095712487, + "name": "FakeLabel1", + "node_id": "LA_kwDOHkcrQs8AAAABL7pm5w", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels/FakeLabel1" + } + ], + "labels_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/14/labels{/name}", + "locked": false, + "milestone": null, + "node_id": "I_kwDOHkcrQs5c_SvC", + "number": 14, + "performed_via_github_app": null, + "reactions": { + "+1": 0, + "-1": 0, + "confused": 0, + "eyes": 0, + "heart": 0, + "hooray": 0, + "laugh": 0, + "rocket": 0, + "total_count": 0, + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/14/reactions" + }, + "repository_url": "https://api.github.com/repos/Azure/azure-sdk-fake", + "state": "open", + "state_reason": null, + "timeline_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/14/timeline", + "title": "New issue to generate event payloads for static tests", + "updated_at": "2023-01-30T18:20:53Z", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/14", + "user": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + } + }, + "label": { + "color": "F75BB2", + "default": false, + "description": "", + "id": 5095715984, + "name": "Service Attention", + "node_id": "LA_kwDOHkcrQs8AAAABL7p0kA", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels/Service%20Attention" + }, + "repository": { + "allow_forking": true, + "archive_url": "https://api.github.com/repos/Azure/azure-sdk-fake/{archive_format}{/ref}", + "archived": false, + "assignees_url": "https://api.github.com/repos/Azure/azure-sdk-fake/assignees{/user}", + "blobs_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/blobs{/sha}", + "branches_url": "https://api.github.com/repos/Azure/azure-sdk-fake/branches{/branch}", + "clone_url": "https://github.com/Azure/azure-sdk-fake.git", + "collaborators_url": "https://api.github.com/repos/Azure/azure-sdk-fake/collaborators{/collaborator}", + "comments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/comments{/number}", + "commits_url": "https://api.github.com/repos/Azure/azure-sdk-fake/commits{/sha}", + "compare_url": "https://api.github.com/repos/Azure/azure-sdk-fake/compare/{base}...{head}", + "contents_url": "https://api.github.com/repos/Azure/azure-sdk-fake/contents/{+path}", + "contributors_url": "https://api.github.com/repos/Azure/azure-sdk-fake/contributors", + "created_at": "2022-06-27T16:19:29Z", + "default_branch": "main", + "deployments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/deployments", + "description": "Tools repository leveraged by the Azure SDK team.", + "disabled": false, + "downloads_url": "https://api.github.com/repos/Azure/azure-sdk-fake/downloads", + "events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/events", + "fork": true, + "forks": 0, + "forks_count": 0, + "forks_url": "https://api.github.com/repos/Azure/azure-sdk-fake/forks", + "full_name": "Azure/azure-sdk-fake", + "git_commits_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/commits{/sha}", + "git_refs_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/refs{/sha}", + "git_tags_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/tags{/sha}", + "git_url": "git://github.com/Azure/azure-sdk-fake.git", + "has_discussions": false, + "has_downloads": true, + "has_issues": true, + "has_pages": false, + "has_projects": true, + "has_wiki": true, + "homepage": null, + "hooks_url": "https://api.github.com/repos/Azure/azure-sdk-fake/hooks", + "html_url": "https://github.com/Azure/azure-sdk-fake", + "id": 507980610, + "is_template": false, + "issue_comment_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/comments{/number}", + "issue_events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/events{/number}", + "issues_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues{/number}", + "keys_url": "https://api.github.com/repos/Azure/azure-sdk-fake/keys{/key_id}", + "labels_url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels{/name}", + "language": "C#", + "languages_url": "https://api.github.com/repos/Azure/azure-sdk-fake/languages", + "license": { + "key": "mit", + "name": "MIT License", + "node_id": "MDc6TGljZW5zZTEz", + "spdx_id": "MIT", + "url": "https://api.github.com/licenses/mit" + }, + "merges_url": "https://api.github.com/repos/Azure/azure-sdk-fake/merges", + "milestones_url": "https://api.github.com/repos/Azure/azure-sdk-fake/milestones{/number}", + "mirror_url": null, + "name": "azure-sdk-fake", + "node_id": "R_kgDOHkcrQg", + "notifications_url": "https://api.github.com/repos/Azure/azure-sdk-fake/notifications{?since,all,participating}", + "open_issues": 6, + "open_issues_count": 6, + "owner": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + }, + "private": false, + "pulls_url": "https://api.github.com/repos/Azure/azure-sdk-fake/pulls{/number}", + "pushed_at": "2023-01-27T16:33:00Z", + "releases_url": "https://api.github.com/repos/Azure/azure-sdk-fake/releases{/id}", + "size": 29098, + "ssh_url": "git@github.com:Azure/azure-sdk-fake.git", + "stargazers_count": 0, + "stargazers_url": "https://api.github.com/repos/Azure/azure-sdk-fake/stargazers", + "statuses_url": "https://api.github.com/repos/Azure/azure-sdk-fake/statuses/{sha}", + "subscribers_url": "https://api.github.com/repos/Azure/azure-sdk-fake/subscribers", + "subscription_url": "https://api.github.com/repos/Azure/azure-sdk-fake/subscription", + "svn_url": "https://github.com/Azure/azure-sdk-fake", + "tags_url": "https://api.github.com/repos/Azure/azure-sdk-fake/tags", + "teams_url": "https://api.github.com/repos/Azure/azure-sdk-fake/teams", + "topics": [], + "trees_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/trees{/sha}", + "updated_at": "2023-01-23T19:54:18Z", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake", + "visibility": "public", + "watchers": 0, + "watchers_count": 0, + "web_commit_signoff_required": false + }, + "sender": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + } +} diff --git a/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Tests.JsonEventPayloads/IssueAddressed_issue_labeled_nothing_to_remove.json b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Tests.JsonEventPayloads/IssueAddressed_issue_labeled_nothing_to_remove.json new file mode 100644 index 00000000000..9eb64b4f781 --- /dev/null +++ b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Tests.JsonEventPayloads/IssueAddressed_issue_labeled_nothing_to_remove.json @@ -0,0 +1,275 @@ +{ + "action": "labeled", + "issue": { + "active_lock_reason": null, + "assignee": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + }, + "assignees": [ + { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + } + ], + "author_association": "OWNER", + "body": null, + "closed_at": null, + "comments": 0, + "comments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/14/comments", + "created_at": "2023-01-27T17:01:30Z", + "events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/14/events", + "html_url": "https://github.com/Azure/azure-sdk-fake/issues/14", + "id": 1560095682, + "labels": [ + { + "color": "d73a4a", + "default": true, + "description": "Something isn't working", + "id": 4273699693, + "name": "bug", + "node_id": "LA_kwDOHkcrQs7-u3tt", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels/bug" + }, + { + "color": "ededed", + "default": false, + "description": null, + "id": 4976488245, + "name": "customer-reported", + "node_id": "LA_kwDOHkcrQs8AAAABKJ8vNQ", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels/customer-reported" + }, + { + "color": "0679ED", + "default": false, + "description": "", + "id": 5074290839, + "name": "issue-addressed", + "node_id": "LA_kwDOHkcrQs8AAAABLnOIlw", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels/issue-addressed" + }, + { + "color": "9C7082", + "default": false, + "description": "fake label for testing", + "id": 5095712487, + "name": "FakeLabel1", + "node_id": "LA_kwDOHkcrQs8AAAABL7pm5w", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels/FakeLabel1" + } + ], + "labels_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/14/labels{/name}", + "locked": false, + "milestone": null, + "node_id": "I_kwDOHkcrQs5c_SvC", + "number": 14, + "performed_via_github_app": null, + "reactions": { + "+1": 0, + "-1": 0, + "confused": 0, + "eyes": 0, + "heart": 0, + "hooray": 0, + "laugh": 0, + "rocket": 0, + "total_count": 0, + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/14/reactions" + }, + "repository_url": "https://api.github.com/repos/Azure/azure-sdk-fake", + "state": "open", + "state_reason": null, + "timeline_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/14/timeline", + "title": "New issue to generate event payloads for static tests", + "updated_at": "2023-01-30T18:06:19Z", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/14", + "user": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + } + }, + "label": { + "color": "0679ED", + "default": false, + "description": "", + "id": 5074290839, + "name": "issue-addressed", + "node_id": "LA_kwDOHkcrQs8AAAABLnOIlw", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels/issue-addressed" + }, + "repository": { + "allow_forking": true, + "archive_url": "https://api.github.com/repos/Azure/azure-sdk-fake/{archive_format}{/ref}", + "archived": false, + "assignees_url": "https://api.github.com/repos/Azure/azure-sdk-fake/assignees{/user}", + "blobs_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/blobs{/sha}", + "branches_url": "https://api.github.com/repos/Azure/azure-sdk-fake/branches{/branch}", + "clone_url": "https://github.com/Azure/azure-sdk-fake.git", + "collaborators_url": "https://api.github.com/repos/Azure/azure-sdk-fake/collaborators{/collaborator}", + "comments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/comments{/number}", + "commits_url": "https://api.github.com/repos/Azure/azure-sdk-fake/commits{/sha}", + "compare_url": "https://api.github.com/repos/Azure/azure-sdk-fake/compare/{base}...{head}", + "contents_url": "https://api.github.com/repos/Azure/azure-sdk-fake/contents/{+path}", + "contributors_url": "https://api.github.com/repos/Azure/azure-sdk-fake/contributors", + "created_at": "2022-06-27T16:19:29Z", + "default_branch": "main", + "deployments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/deployments", + "description": "Tools repository leveraged by the Azure SDK team.", + "disabled": false, + "downloads_url": "https://api.github.com/repos/Azure/azure-sdk-fake/downloads", + "events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/events", + "fork": true, + "forks": 0, + "forks_count": 0, + "forks_url": "https://api.github.com/repos/Azure/azure-sdk-fake/forks", + "full_name": "Azure/azure-sdk-fake", + "git_commits_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/commits{/sha}", + "git_refs_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/refs{/sha}", + "git_tags_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/tags{/sha}", + "git_url": "git://github.com/Azure/azure-sdk-fake.git", + "has_discussions": false, + "has_downloads": true, + "has_issues": true, + "has_pages": false, + "has_projects": true, + "has_wiki": true, + "homepage": null, + "hooks_url": "https://api.github.com/repos/Azure/azure-sdk-fake/hooks", + "html_url": "https://github.com/Azure/azure-sdk-fake", + "id": 507980610, + "is_template": false, + "issue_comment_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/comments{/number}", + "issue_events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/events{/number}", + "issues_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues{/number}", + "keys_url": "https://api.github.com/repos/Azure/azure-sdk-fake/keys{/key_id}", + "labels_url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels{/name}", + "language": "C#", + "languages_url": "https://api.github.com/repos/Azure/azure-sdk-fake/languages", + "license": { + "key": "mit", + "name": "MIT License", + "node_id": "MDc6TGljZW5zZTEz", + "spdx_id": "MIT", + "url": "https://api.github.com/licenses/mit" + }, + "merges_url": "https://api.github.com/repos/Azure/azure-sdk-fake/merges", + "milestones_url": "https://api.github.com/repos/Azure/azure-sdk-fake/milestones{/number}", + "mirror_url": null, + "name": "azure-sdk-fake", + "node_id": "R_kgDOHkcrQg", + "notifications_url": "https://api.github.com/repos/Azure/azure-sdk-fake/notifications{?since,all,participating}", + "open_issues": 6, + "open_issues_count": 6, + "owner": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + }, + "private": false, + "pulls_url": "https://api.github.com/repos/Azure/azure-sdk-fake/pulls{/number}", + "pushed_at": "2023-01-27T16:33:00Z", + "releases_url": "https://api.github.com/repos/Azure/azure-sdk-fake/releases{/id}", + "size": 29098, + "ssh_url": "git@github.com:Azure/azure-sdk-fake.git", + "stargazers_count": 0, + "stargazers_url": "https://api.github.com/repos/Azure/azure-sdk-fake/stargazers", + "statuses_url": "https://api.github.com/repos/Azure/azure-sdk-fake/statuses/{sha}", + "subscribers_url": "https://api.github.com/repos/Azure/azure-sdk-fake/subscribers", + "subscription_url": "https://api.github.com/repos/Azure/azure-sdk-fake/subscription", + "svn_url": "https://github.com/Azure/azure-sdk-fake", + "tags_url": "https://api.github.com/repos/Azure/azure-sdk-fake/tags", + "teams_url": "https://api.github.com/repos/Azure/azure-sdk-fake/teams", + "topics": [], + "trees_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/trees{/sha}", + "updated_at": "2023-01-23T19:54:18Z", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake", + "visibility": "public", + "watchers": 0, + "watchers_count": 0, + "web_commit_signoff_required": false + }, + "sender": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + } +} diff --git a/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Tests.JsonEventPayloads/IssueAddressed_issue_labeled_with_labels_to_remove.json b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Tests.JsonEventPayloads/IssueAddressed_issue_labeled_with_labels_to_remove.json new file mode 100644 index 00000000000..08ed1eb861e --- /dev/null +++ b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Tests.JsonEventPayloads/IssueAddressed_issue_labeled_with_labels_to_remove.json @@ -0,0 +1,320 @@ +{ + "action": "labeled", + "issue": { + "active_lock_reason": null, + "assignee": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + }, + "assignees": [ + { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + } + ], + "author_association": "OWNER", + "body": null, + "closed_at": null, + "comments": 0, + "comments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/14/comments", + "created_at": "2023-01-27T17:01:30Z", + "events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/14/events", + "html_url": "https://github.com/Azure/azure-sdk-fake/issues/14", + "id": 1560095682, + "labels": [ + { + "color": "d73a4a", + "default": true, + "description": "Something isn't working", + "id": 4273699693, + "name": "bug", + "node_id": "LA_kwDOHkcrQs7-u3tt", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels/bug" + }, + { + "color": "ededed", + "default": false, + "description": null, + "id": 4704569627, + "name": "needs-triage", + "node_id": "LA_kwDOHkcrQs8AAAABGGoJGw", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels/needs-triage" + }, + { + "color": "ededed", + "default": false, + "description": null, + "id": 4976488245, + "name": "customer-reported", + "node_id": "LA_kwDOHkcrQs8AAAABKJ8vNQ", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels/customer-reported" + }, + { + "color": "94812F", + "default": false, + "description": "", + "id": 5070542662, + "name": "no-recent-activity", + "node_id": "LA_kwDOHkcrQs8AAAABLjpXRg", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels/no-recent-activity" + }, + { + "color": "CFDBFC", + "default": false, + "description": "", + "id": 5070852679, + "name": "needs-author-feedback", + "node_id": "LA_kwDOHkcrQs8AAAABLj8SRw", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels/needs-author-feedback" + }, + { + "color": "0679ED", + "default": false, + "description": "", + "id": 5074290839, + "name": "issue-addressed", + "node_id": "LA_kwDOHkcrQs8AAAABLnOIlw", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels/issue-addressed" + }, + { + "color": "9C7082", + "default": false, + "description": "fake label for testing", + "id": 5095712487, + "name": "FakeLabel1", + "node_id": "LA_kwDOHkcrQs8AAAABL7pm5w", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels/FakeLabel1" + }, + { + "color": "DBC2DE", + "default": false, + "description": "", + "id": 5095805781, + "name": "needs-team-triage", + "node_id": "LA_kwDOHkcrQs8AAAABL7vTVQ", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels/needs-team-triage" + }, + { + "color": "027919", + "default": false, + "description": "", + "id": 5096061354, + "name": "needs-team-attention", + "node_id": "LA_kwDOHkcrQs8AAAABL7-5qg", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels/needs-team-attention" + } + ], + "labels_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/14/labels{/name}", + "locked": false, + "milestone": null, + "node_id": "I_kwDOHkcrQs5c_SvC", + "number": 14, + "performed_via_github_app": null, + "reactions": { + "+1": 0, + "-1": 0, + "confused": 0, + "eyes": 0, + "heart": 0, + "hooray": 0, + "laugh": 0, + "rocket": 0, + "total_count": 0, + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/14/reactions" + }, + "repository_url": "https://api.github.com/repos/Azure/azure-sdk-fake", + "state": "open", + "state_reason": null, + "timeline_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/14/timeline", + "title": "New issue to generate event payloads for static tests", + "updated_at": "2023-01-30T18:06:19Z", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/14", + "user": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + } + }, + "label": { + "color": "0679ED", + "default": false, + "description": "", + "id": 5074290839, + "name": "issue-addressed", + "node_id": "LA_kwDOHkcrQs8AAAABLnOIlw", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels/issue-addressed" + }, + "repository": { + "allow_forking": true, + "archive_url": "https://api.github.com/repos/Azure/azure-sdk-fake/{archive_format}{/ref}", + "archived": false, + "assignees_url": "https://api.github.com/repos/Azure/azure-sdk-fake/assignees{/user}", + "blobs_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/blobs{/sha}", + "branches_url": "https://api.github.com/repos/Azure/azure-sdk-fake/branches{/branch}", + "clone_url": "https://github.com/Azure/azure-sdk-fake.git", + "collaborators_url": "https://api.github.com/repos/Azure/azure-sdk-fake/collaborators{/collaborator}", + "comments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/comments{/number}", + "commits_url": "https://api.github.com/repos/Azure/azure-sdk-fake/commits{/sha}", + "compare_url": "https://api.github.com/repos/Azure/azure-sdk-fake/compare/{base}...{head}", + "contents_url": "https://api.github.com/repos/Azure/azure-sdk-fake/contents/{+path}", + "contributors_url": "https://api.github.com/repos/Azure/azure-sdk-fake/contributors", + "created_at": "2022-06-27T16:19:29Z", + "default_branch": "main", + "deployments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/deployments", + "description": "Tools repository leveraged by the Azure SDK team.", + "disabled": false, + "downloads_url": "https://api.github.com/repos/Azure/azure-sdk-fake/downloads", + "events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/events", + "fork": true, + "forks": 0, + "forks_count": 0, + "forks_url": "https://api.github.com/repos/Azure/azure-sdk-fake/forks", + "full_name": "Azure/azure-sdk-fake", + "git_commits_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/commits{/sha}", + "git_refs_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/refs{/sha}", + "git_tags_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/tags{/sha}", + "git_url": "git://github.com/Azure/azure-sdk-fake.git", + "has_discussions": false, + "has_downloads": true, + "has_issues": true, + "has_pages": false, + "has_projects": true, + "has_wiki": true, + "homepage": null, + "hooks_url": "https://api.github.com/repos/Azure/azure-sdk-fake/hooks", + "html_url": "https://github.com/Azure/azure-sdk-fake", + "id": 507980610, + "is_template": false, + "issue_comment_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/comments{/number}", + "issue_events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/events{/number}", + "issues_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues{/number}", + "keys_url": "https://api.github.com/repos/Azure/azure-sdk-fake/keys{/key_id}", + "labels_url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels{/name}", + "language": "C#", + "languages_url": "https://api.github.com/repos/Azure/azure-sdk-fake/languages", + "license": { + "key": "mit", + "name": "MIT License", + "node_id": "MDc6TGljZW5zZTEz", + "spdx_id": "MIT", + "url": "https://api.github.com/licenses/mit" + }, + "merges_url": "https://api.github.com/repos/Azure/azure-sdk-fake/merges", + "milestones_url": "https://api.github.com/repos/Azure/azure-sdk-fake/milestones{/number}", + "mirror_url": null, + "name": "azure-sdk-fake", + "node_id": "R_kgDOHkcrQg", + "notifications_url": "https://api.github.com/repos/Azure/azure-sdk-fake/notifications{?since,all,participating}", + "open_issues": 6, + "open_issues_count": 6, + "owner": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + }, + "private": false, + "pulls_url": "https://api.github.com/repos/Azure/azure-sdk-fake/pulls{/number}", + "pushed_at": "2023-01-27T16:33:00Z", + "releases_url": "https://api.github.com/repos/Azure/azure-sdk-fake/releases{/id}", + "size": 29098, + "ssh_url": "git@github.com:Azure/azure-sdk-fake.git", + "stargazers_count": 0, + "stargazers_url": "https://api.github.com/repos/Azure/azure-sdk-fake/stargazers", + "statuses_url": "https://api.github.com/repos/Azure/azure-sdk-fake/statuses/{sha}", + "subscribers_url": "https://api.github.com/repos/Azure/azure-sdk-fake/subscribers", + "subscription_url": "https://api.github.com/repos/Azure/azure-sdk-fake/subscription", + "svn_url": "https://github.com/Azure/azure-sdk-fake", + "tags_url": "https://api.github.com/repos/Azure/azure-sdk-fake/tags", + "teams_url": "https://api.github.com/repos/Azure/azure-sdk-fake/teams", + "topics": [], + "trees_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/trees{/sha}", + "updated_at": "2023-01-23T19:54:18Z", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake", + "visibility": "public", + "watchers": 0, + "watchers_count": 0, + "web_commit_signoff_required": false + }, + "sender": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + } +} diff --git a/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Tests.JsonEventPayloads/ManualIssueTriage_issue_labeled_needs-triage.json b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Tests.JsonEventPayloads/ManualIssueTriage_issue_labeled_needs-triage.json new file mode 100644 index 00000000000..6ae3b44d1a0 --- /dev/null +++ b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Tests.JsonEventPayloads/ManualIssueTriage_issue_labeled_needs-triage.json @@ -0,0 +1,248 @@ +{ + "action": "labeled", + "issue": { + "active_lock_reason": null, + "assignee": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + }, + "assignees": [ + { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + } + ], + "author_association": "OWNER", + "body": null, + "closed_at": null, + "comments": 0, + "comments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/14/comments", + "created_at": "2023-01-27T17:01:30Z", + "events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/14/events", + "html_url": "https://github.com/Azure/azure-sdk-fake/issues/14", + "id": 1560095682, + "labels": [ + { + "color": "ededed", + "default": false, + "description": null, + "id": 4704569627, + "name": "needs-triage", + "node_id": "LA_kwDOHkcrQs8AAAABGGoJGw", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels/needs-triage" + } + ], + "labels_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/14/labels{/name}", + "locked": false, + "milestone": null, + "node_id": "I_kwDOHkcrQs5c_SvC", + "number": 14, + "performed_via_github_app": null, + "reactions": { + "+1": 0, + "-1": 0, + "confused": 0, + "eyes": 0, + "heart": 0, + "hooray": 0, + "laugh": 0, + "rocket": 0, + "total_count": 0, + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/14/reactions" + }, + "repository_url": "https://api.github.com/repos/Azure/azure-sdk-fake", + "state": "open", + "state_reason": null, + "timeline_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/14/timeline", + "title": "New test issue to generate event payloads", + "updated_at": "2023-01-27T17:06:47Z", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/14", + "user": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + } + }, + "label": { + "color": "ededed", + "default": false, + "description": null, + "id": 4704569627, + "name": "needs-triage", + "node_id": "LA_kwDOHkcrQs8AAAABGGoJGw", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels/needs-triage" + }, + "repository": { + "allow_forking": true, + "archive_url": "https://api.github.com/repos/Azure/azure-sdk-fake/{archive_format}{/ref}", + "archived": false, + "assignees_url": "https://api.github.com/repos/Azure/azure-sdk-fake/assignees{/user}", + "blobs_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/blobs{/sha}", + "branches_url": "https://api.github.com/repos/Azure/azure-sdk-fake/branches{/branch}", + "clone_url": "https://github.com/Azure/azure-sdk-fake.git", + "collaborators_url": "https://api.github.com/repos/Azure/azure-sdk-fake/collaborators{/collaborator}", + "comments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/comments{/number}", + "commits_url": "https://api.github.com/repos/Azure/azure-sdk-fake/commits{/sha}", + "compare_url": "https://api.github.com/repos/Azure/azure-sdk-fake/compare/{base}...{head}", + "contents_url": "https://api.github.com/repos/Azure/azure-sdk-fake/contents/{+path}", + "contributors_url": "https://api.github.com/repos/Azure/azure-sdk-fake/contributors", + "created_at": "2022-06-27T16:19:29Z", + "default_branch": "main", + "deployments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/deployments", + "description": "Tools repository leveraged by the Azure SDK team.", + "disabled": false, + "downloads_url": "https://api.github.com/repos/Azure/azure-sdk-fake/downloads", + "events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/events", + "fork": true, + "forks": 0, + "forks_count": 0, + "forks_url": "https://api.github.com/repos/Azure/azure-sdk-fake/forks", + "full_name": "Azure/azure-sdk-fake", + "git_commits_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/commits{/sha}", + "git_refs_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/refs{/sha}", + "git_tags_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/tags{/sha}", + "git_url": "git://github.com/Azure/azure-sdk-fake.git", + "has_discussions": false, + "has_downloads": true, + "has_issues": true, + "has_pages": false, + "has_projects": true, + "has_wiki": true, + "homepage": null, + "hooks_url": "https://api.github.com/repos/Azure/azure-sdk-fake/hooks", + "html_url": "https://github.com/Azure/azure-sdk-fake", + "id": 507980610, + "is_template": false, + "issue_comment_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/comments{/number}", + "issue_events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/events{/number}", + "issues_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues{/number}", + "keys_url": "https://api.github.com/repos/Azure/azure-sdk-fake/keys{/key_id}", + "labels_url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels{/name}", + "language": "C#", + "languages_url": "https://api.github.com/repos/Azure/azure-sdk-fake/languages", + "license": { + "key": "mit", + "name": "MIT License", + "node_id": "MDc6TGljZW5zZTEz", + "spdx_id": "MIT", + "url": "https://api.github.com/licenses/mit" + }, + "merges_url": "https://api.github.com/repos/Azure/azure-sdk-fake/merges", + "milestones_url": "https://api.github.com/repos/Azure/azure-sdk-fake/milestones{/number}", + "mirror_url": null, + "name": "azure-sdk-fake", + "node_id": "R_kgDOHkcrQg", + "notifications_url": "https://api.github.com/repos/Azure/azure-sdk-fake/notifications{?since,all,participating}", + "open_issues": 6, + "open_issues_count": 6, + "owner": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + }, + "private": false, + "pulls_url": "https://api.github.com/repos/Azure/azure-sdk-fake/pulls{/number}", + "pushed_at": "2023-01-27T16:33:00Z", + "releases_url": "https://api.github.com/repos/Azure/azure-sdk-fake/releases{/id}", + "size": 29083, + "ssh_url": "git@github.com:Azure/azure-sdk-fake.git", + "stargazers_count": 0, + "stargazers_url": "https://api.github.com/repos/Azure/azure-sdk-fake/stargazers", + "statuses_url": "https://api.github.com/repos/Azure/azure-sdk-fake/statuses/{sha}", + "subscribers_url": "https://api.github.com/repos/Azure/azure-sdk-fake/subscribers", + "subscription_url": "https://api.github.com/repos/Azure/azure-sdk-fake/subscription", + "svn_url": "https://github.com/Azure/azure-sdk-fake", + "tags_url": "https://api.github.com/repos/Azure/azure-sdk-fake/tags", + "teams_url": "https://api.github.com/repos/Azure/azure-sdk-fake/teams", + "topics": [], + "trees_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/trees{/sha}", + "updated_at": "2023-01-23T19:54:18Z", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake", + "visibility": "public", + "watchers": 0, + "watchers_count": 0, + "web_commit_signoff_required": false + }, + "sender": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + } +} diff --git a/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Tests.JsonEventPayloads/ManualIssueTriage_issue_labeled_not_needs-triage.json b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Tests.JsonEventPayloads/ManualIssueTriage_issue_labeled_not_needs-triage.json new file mode 100644 index 00000000000..85e13796848 --- /dev/null +++ b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Tests.JsonEventPayloads/ManualIssueTriage_issue_labeled_not_needs-triage.json @@ -0,0 +1,257 @@ +{ + "action": "labeled", + "issue": { + "active_lock_reason": null, + "assignee": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + }, + "assignees": [ + { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + } + ], + "author_association": "OWNER", + "body": null, + "closed_at": null, + "comments": 0, + "comments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/14/comments", + "created_at": "2023-01-27T17:01:30Z", + "events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/14/events", + "html_url": "https://github.com/Azure/azure-sdk-fake/issues/14", + "id": 1560095682, + "labels": [ + { + "color": "d73a4a", + "default": true, + "description": "Something isn't working", + "id": 4273699693, + "name": "bug", + "node_id": "LA_kwDOHkcrQs7-u3tt", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels/bug" + }, + { + "color": "ededed", + "default": false, + "description": null, + "id": 4704569627, + "name": "needs-triage", + "node_id": "LA_kwDOHkcrQs8AAAABGGoJGw", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels/needs-triage" + } + ], + "labels_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/14/labels{/name}", + "locked": false, + "milestone": null, + "node_id": "I_kwDOHkcrQs5c_SvC", + "number": 14, + "performed_via_github_app": null, + "reactions": { + "+1": 0, + "-1": 0, + "confused": 0, + "eyes": 0, + "heart": 0, + "hooray": 0, + "laugh": 0, + "rocket": 0, + "total_count": 0, + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/14/reactions" + }, + "repository_url": "https://api.github.com/repos/Azure/azure-sdk-fake", + "state": "open", + "state_reason": null, + "timeline_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/14/timeline", + "title": "New test issue to generate event payloads", + "updated_at": "2023-01-27T17:08:48Z", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/14", + "user": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + } + }, + "label": { + "color": "d73a4a", + "default": true, + "description": "Something isn't working", + "id": 4273699693, + "name": "bug", + "node_id": "LA_kwDOHkcrQs7-u3tt", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels/bug" + }, + "repository": { + "allow_forking": true, + "archive_url": "https://api.github.com/repos/Azure/azure-sdk-fake/{archive_format}{/ref}", + "archived": false, + "assignees_url": "https://api.github.com/repos/Azure/azure-sdk-fake/assignees{/user}", + "blobs_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/blobs{/sha}", + "branches_url": "https://api.github.com/repos/Azure/azure-sdk-fake/branches{/branch}", + "clone_url": "https://github.com/Azure/azure-sdk-fake.git", + "collaborators_url": "https://api.github.com/repos/Azure/azure-sdk-fake/collaborators{/collaborator}", + "comments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/comments{/number}", + "commits_url": "https://api.github.com/repos/Azure/azure-sdk-fake/commits{/sha}", + "compare_url": "https://api.github.com/repos/Azure/azure-sdk-fake/compare/{base}...{head}", + "contents_url": "https://api.github.com/repos/Azure/azure-sdk-fake/contents/{+path}", + "contributors_url": "https://api.github.com/repos/Azure/azure-sdk-fake/contributors", + "created_at": "2022-06-27T16:19:29Z", + "default_branch": "main", + "deployments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/deployments", + "description": "Tools repository leveraged by the Azure SDK team.", + "disabled": false, + "downloads_url": "https://api.github.com/repos/Azure/azure-sdk-fake/downloads", + "events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/events", + "fork": true, + "forks": 0, + "forks_count": 0, + "forks_url": "https://api.github.com/repos/Azure/azure-sdk-fake/forks", + "full_name": "Azure/azure-sdk-fake", + "git_commits_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/commits{/sha}", + "git_refs_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/refs{/sha}", + "git_tags_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/tags{/sha}", + "git_url": "git://github.com/Azure/azure-sdk-fake.git", + "has_discussions": false, + "has_downloads": true, + "has_issues": true, + "has_pages": false, + "has_projects": true, + "has_wiki": true, + "homepage": null, + "hooks_url": "https://api.github.com/repos/Azure/azure-sdk-fake/hooks", + "html_url": "https://github.com/Azure/azure-sdk-fake", + "id": 507980610, + "is_template": false, + "issue_comment_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/comments{/number}", + "issue_events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/events{/number}", + "issues_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues{/number}", + "keys_url": "https://api.github.com/repos/Azure/azure-sdk-fake/keys{/key_id}", + "labels_url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels{/name}", + "language": "C#", + "languages_url": "https://api.github.com/repos/Azure/azure-sdk-fake/languages", + "license": { + "key": "mit", + "name": "MIT License", + "node_id": "MDc6TGljZW5zZTEz", + "spdx_id": "MIT", + "url": "https://api.github.com/licenses/mit" + }, + "merges_url": "https://api.github.com/repos/Azure/azure-sdk-fake/merges", + "milestones_url": "https://api.github.com/repos/Azure/azure-sdk-fake/milestones{/number}", + "mirror_url": null, + "name": "azure-sdk-fake", + "node_id": "R_kgDOHkcrQg", + "notifications_url": "https://api.github.com/repos/Azure/azure-sdk-fake/notifications{?since,all,participating}", + "open_issues": 6, + "open_issues_count": 6, + "owner": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + }, + "private": false, + "pulls_url": "https://api.github.com/repos/Azure/azure-sdk-fake/pulls{/number}", + "pushed_at": "2023-01-27T16:33:00Z", + "releases_url": "https://api.github.com/repos/Azure/azure-sdk-fake/releases{/id}", + "size": 29083, + "ssh_url": "git@github.com:Azure/azure-sdk-fake.git", + "stargazers_count": 0, + "stargazers_url": "https://api.github.com/repos/Azure/azure-sdk-fake/stargazers", + "statuses_url": "https://api.github.com/repos/Azure/azure-sdk-fake/statuses/{sha}", + "subscribers_url": "https://api.github.com/repos/Azure/azure-sdk-fake/subscribers", + "subscription_url": "https://api.github.com/repos/Azure/azure-sdk-fake/subscription", + "svn_url": "https://github.com/Azure/azure-sdk-fake", + "tags_url": "https://api.github.com/repos/Azure/azure-sdk-fake/tags", + "teams_url": "https://api.github.com/repos/Azure/azure-sdk-fake/teams", + "topics": [], + "trees_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/trees{/sha}", + "updated_at": "2023-01-23T19:54:18Z", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake", + "visibility": "public", + "watchers": 0, + "watchers_count": 0, + "web_commit_signoff_required": false + }, + "sender": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + } +} diff --git a/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Tests.JsonEventPayloads/ManualTriageAfterExternalAssignment_issue_unlabeled_CXP_attention.json b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Tests.JsonEventPayloads/ManualTriageAfterExternalAssignment_issue_unlabeled_CXP_attention.json new file mode 100644 index 00000000000..9aa49ed265d --- /dev/null +++ b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Tests.JsonEventPayloads/ManualTriageAfterExternalAssignment_issue_unlabeled_CXP_attention.json @@ -0,0 +1,275 @@ +{ + "action": "unlabeled", + "issue": { + "active_lock_reason": null, + "assignee": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + }, + "assignees": [ + { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + } + ], + "author_association": "OWNER", + "body": null, + "closed_at": null, + "comments": 0, + "comments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/14/comments", + "created_at": "2023-01-27T17:01:30Z", + "events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/14/events", + "html_url": "https://github.com/Azure/azure-sdk-fake/issues/14", + "id": 1560095682, + "labels": [ + { + "color": "d73a4a", + "default": true, + "description": "Something isn't working", + "id": 4273699693, + "name": "bug", + "node_id": "LA_kwDOHkcrQs7-u3tt", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels/bug" + }, + { + "color": "ededed", + "default": false, + "description": null, + "id": 4976488245, + "name": "customer-reported", + "node_id": "LA_kwDOHkcrQs8AAAABKJ8vNQ", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels/customer-reported" + }, + { + "color": "ededed", + "default": false, + "description": null, + "id": 4704569627, + "name": "needs-triage", + "node_id": "LA_kwDOHkcrQs8AAAABGGoJGw", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels/needs-triage" + }, + { + "color": "9C7082", + "default": false, + "description": "fake label for testing", + "id": 5095712487, + "name": "FakeLabel1", + "node_id": "LA_kwDOHkcrQs8AAAABL7pm5w", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels/FakeLabel1" + } + ], + "labels_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/14/labels{/name}", + "locked": false, + "milestone": null, + "node_id": "I_kwDOHkcrQs5c_SvC", + "number": 14, + "performed_via_github_app": null, + "reactions": { + "+1": 0, + "-1": 0, + "confused": 0, + "eyes": 0, + "heart": 0, + "hooray": 0, + "laugh": 0, + "rocket": 0, + "total_count": 0, + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/14/reactions" + }, + "repository_url": "https://api.github.com/repos/Azure/azure-sdk-fake", + "state": "open", + "state_reason": null, + "timeline_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/14/timeline", + "title": "New test issue to generate event payloads", + "updated_at": "2023-01-30T16:36:13Z", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/14", + "user": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + } + }, + "label": { + "color": "FDEB99", + "default": false, + "description": "", + "id": 5095753141, + "name": "CXP Attention", + "node_id": "LA_kwDOHkcrQs8AAAABL7sFtQ", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels/CXP%20Attention" + }, + "repository": { + "allow_forking": true, + "archive_url": "https://api.github.com/repos/Azure/azure-sdk-fake/{archive_format}{/ref}", + "archived": false, + "assignees_url": "https://api.github.com/repos/Azure/azure-sdk-fake/assignees{/user}", + "blobs_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/blobs{/sha}", + "branches_url": "https://api.github.com/repos/Azure/azure-sdk-fake/branches{/branch}", + "clone_url": "https://github.com/Azure/azure-sdk-fake.git", + "collaborators_url": "https://api.github.com/repos/Azure/azure-sdk-fake/collaborators{/collaborator}", + "comments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/comments{/number}", + "commits_url": "https://api.github.com/repos/Azure/azure-sdk-fake/commits{/sha}", + "compare_url": "https://api.github.com/repos/Azure/azure-sdk-fake/compare/{base}...{head}", + "contents_url": "https://api.github.com/repos/Azure/azure-sdk-fake/contents/{+path}", + "contributors_url": "https://api.github.com/repos/Azure/azure-sdk-fake/contributors", + "created_at": "2022-06-27T16:19:29Z", + "default_branch": "main", + "deployments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/deployments", + "description": "Tools repository leveraged by the Azure SDK team.", + "disabled": false, + "downloads_url": "https://api.github.com/repos/Azure/azure-sdk-fake/downloads", + "events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/events", + "fork": true, + "forks": 0, + "forks_count": 0, + "forks_url": "https://api.github.com/repos/Azure/azure-sdk-fake/forks", + "full_name": "Azure/azure-sdk-fake", + "git_commits_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/commits{/sha}", + "git_refs_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/refs{/sha}", + "git_tags_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/tags{/sha}", + "git_url": "git://github.com/Azure/azure-sdk-fake.git", + "has_discussions": false, + "has_downloads": true, + "has_issues": true, + "has_pages": false, + "has_projects": true, + "has_wiki": true, + "homepage": null, + "hooks_url": "https://api.github.com/repos/Azure/azure-sdk-fake/hooks", + "html_url": "https://github.com/Azure/azure-sdk-fake", + "id": 507980610, + "is_template": false, + "issue_comment_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/comments{/number}", + "issue_events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/events{/number}", + "issues_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues{/number}", + "keys_url": "https://api.github.com/repos/Azure/azure-sdk-fake/keys{/key_id}", + "labels_url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels{/name}", + "language": "C#", + "languages_url": "https://api.github.com/repos/Azure/azure-sdk-fake/languages", + "license": { + "key": "mit", + "name": "MIT License", + "node_id": "MDc6TGljZW5zZTEz", + "spdx_id": "MIT", + "url": "https://api.github.com/licenses/mit" + }, + "merges_url": "https://api.github.com/repos/Azure/azure-sdk-fake/merges", + "milestones_url": "https://api.github.com/repos/Azure/azure-sdk-fake/milestones{/number}", + "mirror_url": null, + "name": "azure-sdk-fake", + "node_id": "R_kgDOHkcrQg", + "notifications_url": "https://api.github.com/repos/Azure/azure-sdk-fake/notifications{?since,all,participating}", + "open_issues": 6, + "open_issues_count": 6, + "owner": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + }, + "private": false, + "pulls_url": "https://api.github.com/repos/Azure/azure-sdk-fake/pulls{/number}", + "pushed_at": "2023-01-27T16:33:00Z", + "releases_url": "https://api.github.com/repos/Azure/azure-sdk-fake/releases{/id}", + "size": 29098, + "ssh_url": "git@github.com:Azure/azure-sdk-fake.git", + "stargazers_count": 0, + "stargazers_url": "https://api.github.com/repos/Azure/azure-sdk-fake/stargazers", + "statuses_url": "https://api.github.com/repos/Azure/azure-sdk-fake/statuses/{sha}", + "subscribers_url": "https://api.github.com/repos/Azure/azure-sdk-fake/subscribers", + "subscription_url": "https://api.github.com/repos/Azure/azure-sdk-fake/subscription", + "svn_url": "https://github.com/Azure/azure-sdk-fake", + "tags_url": "https://api.github.com/repos/Azure/azure-sdk-fake/tags", + "teams_url": "https://api.github.com/repos/Azure/azure-sdk-fake/teams", + "topics": [], + "trees_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/trees{/sha}", + "updated_at": "2023-01-23T19:54:18Z", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake", + "visibility": "public", + "watchers": 0, + "watchers_count": 0, + "web_commit_signoff_required": false + }, + "sender": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + } +} diff --git a/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Tests.JsonEventPayloads/ManualTriageAfterExternalAssignment_issue_unlabeled_has_needs-team-triage.json b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Tests.JsonEventPayloads/ManualTriageAfterExternalAssignment_issue_unlabeled_has_needs-team-triage.json new file mode 100644 index 00000000000..8a667a1ade1 --- /dev/null +++ b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Tests.JsonEventPayloads/ManualTriageAfterExternalAssignment_issue_unlabeled_has_needs-team-triage.json @@ -0,0 +1,284 @@ +{ + "action": "unlabeled", + "issue": { + "active_lock_reason": null, + "assignee": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + }, + "assignees": [ + { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + } + ], + "author_association": "OWNER", + "body": null, + "closed_at": null, + "comments": 0, + "comments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/14/comments", + "created_at": "2023-01-27T17:01:30Z", + "events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/14/events", + "html_url": "https://github.com/Azure/azure-sdk-fake/issues/14", + "id": 1560095682, + "labels": [ + { + "color": "d73a4a", + "default": true, + "description": "Something isn't working", + "id": 4273699693, + "name": "bug", + "node_id": "LA_kwDOHkcrQs7-u3tt", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels/bug" + }, + { + "color": "ededed", + "default": false, + "description": null, + "id": 4704569627, + "name": "needs-triage", + "node_id": "LA_kwDOHkcrQs8AAAABGGoJGw", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels/needs-triage" + }, + { + "color": "ededed", + "default": false, + "description": null, + "id": 4976488245, + "name": "customer-reported", + "node_id": "LA_kwDOHkcrQs8AAAABKJ8vNQ", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels/customer-reported" + }, + { + "color": "9C7082", + "default": false, + "description": "fake label for testing", + "id": 5095712487, + "name": "FakeLabel1", + "node_id": "LA_kwDOHkcrQs8AAAABL7pm5w", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels/FakeLabel1" + }, + { + "color": "DBC2DE", + "default": false, + "description": "", + "id": 5095805781, + "name": "needs-team-triage", + "node_id": "LA_kwDOHkcrQs8AAAABL7vTVQ", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels/needs-team-triage" + } + ], + "labels_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/14/labels{/name}", + "locked": false, + "milestone": null, + "node_id": "I_kwDOHkcrQs5c_SvC", + "number": 14, + "performed_via_github_app": null, + "reactions": { + "+1": 0, + "-1": 0, + "confused": 0, + "eyes": 0, + "heart": 0, + "hooray": 0, + "laugh": 0, + "rocket": 0, + "total_count": 0, + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/14/reactions" + }, + "repository_url": "https://api.github.com/repos/Azure/azure-sdk-fake", + "state": "open", + "state_reason": null, + "timeline_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/14/timeline", + "title": "New test issue to generate event payloads", + "updated_at": "2023-01-30T16:39:43Z", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/14", + "user": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + } + }, + "label": { + "color": "FDEB99", + "default": false, + "description": "", + "id": 5095753141, + "name": "CXP Attention", + "node_id": "LA_kwDOHkcrQs8AAAABL7sFtQ", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels/CXP%20Attention" + }, + "repository": { + "allow_forking": true, + "archive_url": "https://api.github.com/repos/Azure/azure-sdk-fake/{archive_format}{/ref}", + "archived": false, + "assignees_url": "https://api.github.com/repos/Azure/azure-sdk-fake/assignees{/user}", + "blobs_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/blobs{/sha}", + "branches_url": "https://api.github.com/repos/Azure/azure-sdk-fake/branches{/branch}", + "clone_url": "https://github.com/Azure/azure-sdk-fake.git", + "collaborators_url": "https://api.github.com/repos/Azure/azure-sdk-fake/collaborators{/collaborator}", + "comments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/comments{/number}", + "commits_url": "https://api.github.com/repos/Azure/azure-sdk-fake/commits{/sha}", + "compare_url": "https://api.github.com/repos/Azure/azure-sdk-fake/compare/{base}...{head}", + "contents_url": "https://api.github.com/repos/Azure/azure-sdk-fake/contents/{+path}", + "contributors_url": "https://api.github.com/repos/Azure/azure-sdk-fake/contributors", + "created_at": "2022-06-27T16:19:29Z", + "default_branch": "main", + "deployments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/deployments", + "description": "Tools repository leveraged by the Azure SDK team.", + "disabled": false, + "downloads_url": "https://api.github.com/repos/Azure/azure-sdk-fake/downloads", + "events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/events", + "fork": true, + "forks": 0, + "forks_count": 0, + "forks_url": "https://api.github.com/repos/Azure/azure-sdk-fake/forks", + "full_name": "Azure/azure-sdk-fake", + "git_commits_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/commits{/sha}", + "git_refs_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/refs{/sha}", + "git_tags_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/tags{/sha}", + "git_url": "git://github.com/Azure/azure-sdk-fake.git", + "has_discussions": false, + "has_downloads": true, + "has_issues": true, + "has_pages": false, + "has_projects": true, + "has_wiki": true, + "homepage": null, + "hooks_url": "https://api.github.com/repos/Azure/azure-sdk-fake/hooks", + "html_url": "https://github.com/Azure/azure-sdk-fake", + "id": 507980610, + "is_template": false, + "issue_comment_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/comments{/number}", + "issue_events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/events{/number}", + "issues_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues{/number}", + "keys_url": "https://api.github.com/repos/Azure/azure-sdk-fake/keys{/key_id}", + "labels_url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels{/name}", + "language": "C#", + "languages_url": "https://api.github.com/repos/Azure/azure-sdk-fake/languages", + "license": { + "key": "mit", + "name": "MIT License", + "node_id": "MDc6TGljZW5zZTEz", + "spdx_id": "MIT", + "url": "https://api.github.com/licenses/mit" + }, + "merges_url": "https://api.github.com/repos/Azure/azure-sdk-fake/merges", + "milestones_url": "https://api.github.com/repos/Azure/azure-sdk-fake/milestones{/number}", + "mirror_url": null, + "name": "azure-sdk-fake", + "node_id": "R_kgDOHkcrQg", + "notifications_url": "https://api.github.com/repos/Azure/azure-sdk-fake/notifications{?since,all,participating}", + "open_issues": 6, + "open_issues_count": 6, + "owner": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + }, + "private": false, + "pulls_url": "https://api.github.com/repos/Azure/azure-sdk-fake/pulls{/number}", + "pushed_at": "2023-01-27T16:33:00Z", + "releases_url": "https://api.github.com/repos/Azure/azure-sdk-fake/releases{/id}", + "size": 29098, + "ssh_url": "git@github.com:Azure/azure-sdk-fake.git", + "stargazers_count": 0, + "stargazers_url": "https://api.github.com/repos/Azure/azure-sdk-fake/stargazers", + "statuses_url": "https://api.github.com/repos/Azure/azure-sdk-fake/statuses/{sha}", + "subscribers_url": "https://api.github.com/repos/Azure/azure-sdk-fake/subscribers", + "subscription_url": "https://api.github.com/repos/Azure/azure-sdk-fake/subscription", + "svn_url": "https://github.com/Azure/azure-sdk-fake", + "tags_url": "https://api.github.com/repos/Azure/azure-sdk-fake/tags", + "teams_url": "https://api.github.com/repos/Azure/azure-sdk-fake/teams", + "topics": [], + "trees_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/trees{/sha}", + "updated_at": "2023-01-23T19:54:18Z", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake", + "visibility": "public", + "watchers": 0, + "watchers_count": 0, + "web_commit_signoff_required": false + }, + "sender": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + } +} diff --git a/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Tests.JsonEventPayloads/ManualTriageAfterExternalAssignment_issue_unlabeled_service_attention.json b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Tests.JsonEventPayloads/ManualTriageAfterExternalAssignment_issue_unlabeled_service_attention.json new file mode 100644 index 00000000000..f50fa31f7da --- /dev/null +++ b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Tests.JsonEventPayloads/ManualTriageAfterExternalAssignment_issue_unlabeled_service_attention.json @@ -0,0 +1,275 @@ +{ + "action": "unlabeled", + "issue": { + "active_lock_reason": null, + "assignee": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + }, + "assignees": [ + { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + } + ], + "author_association": "OWNER", + "body": null, + "closed_at": null, + "comments": 0, + "comments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/14/comments", + "created_at": "2023-01-27T17:01:30Z", + "events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/14/events", + "html_url": "https://github.com/Azure/azure-sdk-fake/issues/14", + "id": 1560095682, + "labels": [ + { + "color": "d73a4a", + "default": true, + "description": "Something isn't working", + "id": 4273699693, + "name": "bug", + "node_id": "LA_kwDOHkcrQs7-u3tt", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels/bug" + }, + { + "color": "ededed", + "default": false, + "description": null, + "id": 4976488245, + "name": "customer-reported", + "node_id": "LA_kwDOHkcrQs8AAAABKJ8vNQ", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels/customer-reported" + }, + { + "color": "ededed", + "default": false, + "description": null, + "id": 4704569627, + "name": "needs-triage", + "node_id": "LA_kwDOHkcrQs8AAAABGGoJGw", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels/needs-triage" + }, + { + "color": "9C7082", + "default": false, + "description": "fake label for testing", + "id": 5095712487, + "name": "FakeLabel1", + "node_id": "LA_kwDOHkcrQs8AAAABL7pm5w", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels/FakeLabel1" + } + ], + "labels_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/14/labels{/name}", + "locked": false, + "milestone": null, + "node_id": "I_kwDOHkcrQs5c_SvC", + "number": 14, + "performed_via_github_app": null, + "reactions": { + "+1": 0, + "-1": 0, + "confused": 0, + "eyes": 0, + "heart": 0, + "hooray": 0, + "laugh": 0, + "rocket": 0, + "total_count": 0, + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/14/reactions" + }, + "repository_url": "https://api.github.com/repos/Azure/azure-sdk-fake", + "state": "open", + "state_reason": null, + "timeline_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/14/timeline", + "title": "New test issue to generate event payloads", + "updated_at": "2023-01-30T16:37:38Z", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/14", + "user": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + } + }, + "label": { + "color": "F75BB2", + "default": false, + "description": "", + "id": 5095715984, + "name": "Service Attention", + "node_id": "LA_kwDOHkcrQs8AAAABL7p0kA", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels/Service%20Attention" + }, + "repository": { + "allow_forking": true, + "archive_url": "https://api.github.com/repos/Azure/azure-sdk-fake/{archive_format}{/ref}", + "archived": false, + "assignees_url": "https://api.github.com/repos/Azure/azure-sdk-fake/assignees{/user}", + "blobs_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/blobs{/sha}", + "branches_url": "https://api.github.com/repos/Azure/azure-sdk-fake/branches{/branch}", + "clone_url": "https://github.com/Azure/azure-sdk-fake.git", + "collaborators_url": "https://api.github.com/repos/Azure/azure-sdk-fake/collaborators{/collaborator}", + "comments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/comments{/number}", + "commits_url": "https://api.github.com/repos/Azure/azure-sdk-fake/commits{/sha}", + "compare_url": "https://api.github.com/repos/Azure/azure-sdk-fake/compare/{base}...{head}", + "contents_url": "https://api.github.com/repos/Azure/azure-sdk-fake/contents/{+path}", + "contributors_url": "https://api.github.com/repos/Azure/azure-sdk-fake/contributors", + "created_at": "2022-06-27T16:19:29Z", + "default_branch": "main", + "deployments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/deployments", + "description": "Tools repository leveraged by the Azure SDK team.", + "disabled": false, + "downloads_url": "https://api.github.com/repos/Azure/azure-sdk-fake/downloads", + "events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/events", + "fork": true, + "forks": 0, + "forks_count": 0, + "forks_url": "https://api.github.com/repos/Azure/azure-sdk-fake/forks", + "full_name": "Azure/azure-sdk-fake", + "git_commits_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/commits{/sha}", + "git_refs_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/refs{/sha}", + "git_tags_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/tags{/sha}", + "git_url": "git://github.com/Azure/azure-sdk-fake.git", + "has_discussions": false, + "has_downloads": true, + "has_issues": true, + "has_pages": false, + "has_projects": true, + "has_wiki": true, + "homepage": null, + "hooks_url": "https://api.github.com/repos/Azure/azure-sdk-fake/hooks", + "html_url": "https://github.com/Azure/azure-sdk-fake", + "id": 507980610, + "is_template": false, + "issue_comment_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/comments{/number}", + "issue_events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/events{/number}", + "issues_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues{/number}", + "keys_url": "https://api.github.com/repos/Azure/azure-sdk-fake/keys{/key_id}", + "labels_url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels{/name}", + "language": "C#", + "languages_url": "https://api.github.com/repos/Azure/azure-sdk-fake/languages", + "license": { + "key": "mit", + "name": "MIT License", + "node_id": "MDc6TGljZW5zZTEz", + "spdx_id": "MIT", + "url": "https://api.github.com/licenses/mit" + }, + "merges_url": "https://api.github.com/repos/Azure/azure-sdk-fake/merges", + "milestones_url": "https://api.github.com/repos/Azure/azure-sdk-fake/milestones{/number}", + "mirror_url": null, + "name": "azure-sdk-fake", + "node_id": "R_kgDOHkcrQg", + "notifications_url": "https://api.github.com/repos/Azure/azure-sdk-fake/notifications{?since,all,participating}", + "open_issues": 6, + "open_issues_count": 6, + "owner": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + }, + "private": false, + "pulls_url": "https://api.github.com/repos/Azure/azure-sdk-fake/pulls{/number}", + "pushed_at": "2023-01-27T16:33:00Z", + "releases_url": "https://api.github.com/repos/Azure/azure-sdk-fake/releases{/id}", + "size": 29098, + "ssh_url": "git@github.com:Azure/azure-sdk-fake.git", + "stargazers_count": 0, + "stargazers_url": "https://api.github.com/repos/Azure/azure-sdk-fake/stargazers", + "statuses_url": "https://api.github.com/repos/Azure/azure-sdk-fake/statuses/{sha}", + "subscribers_url": "https://api.github.com/repos/Azure/azure-sdk-fake/subscribers", + "subscription_url": "https://api.github.com/repos/Azure/azure-sdk-fake/subscription", + "svn_url": "https://github.com/Azure/azure-sdk-fake", + "tags_url": "https://api.github.com/repos/Azure/azure-sdk-fake/tags", + "teams_url": "https://api.github.com/repos/Azure/azure-sdk-fake/teams", + "topics": [], + "trees_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/trees{/sha}", + "updated_at": "2023-01-23T19:54:18Z", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake", + "visibility": "public", + "watchers": 0, + "watchers_count": 0, + "web_commit_signoff_required": false + }, + "sender": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + } +} diff --git a/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Tests.JsonEventPayloads/PullRequestTriage_pr_opened_no_labels.json b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Tests.JsonEventPayloads/PullRequestTriage_pr_opened_no_labels.json new file mode 100644 index 00000000000..6aee5329251 --- /dev/null +++ b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Tests.JsonEventPayloads/PullRequestTriage_pr_opened_no_labels.json @@ -0,0 +1,503 @@ +{ + "action": "opened", + "number": 8, + "pull_request": { + "_links": { + "comments": { + "href": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/8/comments" + }, + "commits": { + "href": "https://api.github.com/repos/Azure/azure-sdk-fake/pulls/8/commits" + }, + "html": { + "href": "https://github.com/Azure/azure-sdk-fake/pull/8" + }, + "issue": { + "href": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/8" + }, + "review_comment": { + "href": "https://api.github.com/repos/Azure/azure-sdk-fake/pulls/comments{/number}" + }, + "review_comments": { + "href": "https://api.github.com/repos/Azure/azure-sdk-fake/pulls/8/comments" + }, + "self": { + "href": "https://api.github.com/repos/Azure/azure-sdk-fake/pulls/8" + }, + "statuses": { + "href": "https://api.github.com/repos/Azure/azure-sdk-fake/statuses/827307d6715561ecea6ec0d5d64e5fb2578a6165" + } + }, + "active_lock_reason": null, + "additions": 1, + "assignee": null, + "assignees": [], + "author_association": "OWNER", + "auto_merge": null, + "base": { + "label": "FakeUser1:main", + "ref": "main", + "repo": { + "allow_auto_merge": false, + "allow_forking": true, + "allow_merge_commit": true, + "allow_rebase_merge": true, + "allow_squash_merge": true, + "allow_update_branch": false, + "archive_url": "https://api.github.com/repos/Azure/azure-sdk-fake/{archive_format}{/ref}", + "archived": false, + "assignees_url": "https://api.github.com/repos/Azure/azure-sdk-fake/assignees{/user}", + "blobs_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/blobs{/sha}", + "branches_url": "https://api.github.com/repos/Azure/azure-sdk-fake/branches{/branch}", + "clone_url": "https://github.com/Azure/azure-sdk-fake.git", + "collaborators_url": "https://api.github.com/repos/Azure/azure-sdk-fake/collaborators{/collaborator}", + "comments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/comments{/number}", + "commits_url": "https://api.github.com/repos/Azure/azure-sdk-fake/commits{/sha}", + "compare_url": "https://api.github.com/repos/Azure/azure-sdk-fake/compare/{base}...{head}", + "contents_url": "https://api.github.com/repos/Azure/azure-sdk-fake/contents/{+path}", + "contributors_url": "https://api.github.com/repos/Azure/azure-sdk-fake/contributors", + "created_at": "2022-06-27T16:19:29Z", + "default_branch": "main", + "delete_branch_on_merge": false, + "deployments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/deployments", + "description": "Tools repository leveraged by the Azure SDK team.", + "disabled": false, + "downloads_url": "https://api.github.com/repos/Azure/azure-sdk-fake/downloads", + "events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/events", + "fork": true, + "forks": 0, + "forks_count": 0, + "forks_url": "https://api.github.com/repos/Azure/azure-sdk-fake/forks", + "full_name": "Azure/azure-sdk-fake", + "git_commits_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/commits{/sha}", + "git_refs_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/refs{/sha}", + "git_tags_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/tags{/sha}", + "git_url": "git://github.com/Azure/azure-sdk-fake.git", + "has_downloads": true, + "has_issues": true, + "has_pages": false, + "has_projects": true, + "has_wiki": true, + "homepage": null, + "hooks_url": "https://api.github.com/repos/Azure/azure-sdk-fake/hooks", + "html_url": "https://github.com/Azure/azure-sdk-fake", + "id": 507980610, + "is_template": false, + "issue_comment_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/comments{/number}", + "issue_events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/events{/number}", + "issues_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues{/number}", + "keys_url": "https://api.github.com/repos/Azure/azure-sdk-fake/keys{/key_id}", + "labels_url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels{/name}", + "language": "C#", + "languages_url": "https://api.github.com/repos/Azure/azure-sdk-fake/languages", + "license": { + "key": "mit", + "name": "MIT License", + "node_id": "MDc6TGljZW5zZTEz", + "spdx_id": "MIT", + "url": "https://api.github.com/licenses/mit" + }, + "merge_commit_message": "PR_TITLE", + "merge_commit_title": "MERGE_MESSAGE", + "merges_url": "https://api.github.com/repos/Azure/azure-sdk-fake/merges", + "milestones_url": "https://api.github.com/repos/Azure/azure-sdk-fake/milestones{/number}", + "mirror_url": null, + "name": "azure-sdk-fake", + "node_id": "R_kgDOHkcrQg", + "notifications_url": "https://api.github.com/repos/Azure/azure-sdk-fake/notifications{?since,all,participating}", + "open_issues": 7, + "open_issues_count": 7, + "owner": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + }, + "private": false, + "pulls_url": "https://api.github.com/repos/Azure/azure-sdk-fake/pulls{/number}", + "pushed_at": "2022-11-01T20:27:41Z", + "releases_url": "https://api.github.com/repos/Azure/azure-sdk-fake/releases{/id}", + "size": 28964, + "squash_merge_commit_message": "COMMIT_MESSAGES", + "squash_merge_commit_title": "COMMIT_OR_PR_TITLE", + "ssh_url": "git@github.com:Azure/azure-sdk-fake.git", + "stargazers_count": 0, + "stargazers_url": "https://api.github.com/repos/Azure/azure-sdk-fake/stargazers", + "statuses_url": "https://api.github.com/repos/Azure/azure-sdk-fake/statuses/{sha}", + "subscribers_url": "https://api.github.com/repos/Azure/azure-sdk-fake/subscribers", + "subscription_url": "https://api.github.com/repos/Azure/azure-sdk-fake/subscription", + "svn_url": "https://github.com/Azure/azure-sdk-fake", + "tags_url": "https://api.github.com/repos/Azure/azure-sdk-fake/tags", + "teams_url": "https://api.github.com/repos/Azure/azure-sdk-fake/teams", + "topics": [], + "trees_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/trees{/sha}", + "updated_at": "2022-10-31T16:54:20Z", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake", + "use_squash_pr_title_as_default": false, + "visibility": "public", + "watchers": 0, + "watchers_count": 0, + "web_commit_signoff_required": false + }, + "sha": "36aab176cf9055be3bbac44a4134875dbb5e6319", + "user": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + } + }, + "body": "test comment", + "changed_files": 1, + "closed_at": null, + "comments": 0, + "comments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/8/comments", + "commits": 1, + "commits_url": "https://api.github.com/repos/Azure/azure-sdk-fake/pulls/8/commits", + "created_at": "2022-11-01T20:27:41Z", + "deletions": 0, + "diff_url": "https://github.com/Azure/azure-sdk-fake/pull/8.diff", + "draft": false, + "head": { + "label": "FakeUser1:TestBranch2", + "ref": "TestBranch2", + "repo": { + "allow_auto_merge": false, + "allow_forking": true, + "allow_merge_commit": true, + "allow_rebase_merge": true, + "allow_squash_merge": true, + "allow_update_branch": false, + "archive_url": "https://api.github.com/repos/Azure/azure-sdk-fake/{archive_format}{/ref}", + "archived": false, + "assignees_url": "https://api.github.com/repos/Azure/azure-sdk-fake/assignees{/user}", + "blobs_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/blobs{/sha}", + "branches_url": "https://api.github.com/repos/Azure/azure-sdk-fake/branches{/branch}", + "clone_url": "https://github.com/Azure/azure-sdk-fake.git", + "collaborators_url": "https://api.github.com/repos/Azure/azure-sdk-fake/collaborators{/collaborator}", + "comments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/comments{/number}", + "commits_url": "https://api.github.com/repos/Azure/azure-sdk-fake/commits{/sha}", + "compare_url": "https://api.github.com/repos/Azure/azure-sdk-fake/compare/{base}...{head}", + "contents_url": "https://api.github.com/repos/Azure/azure-sdk-fake/contents/{+path}", + "contributors_url": "https://api.github.com/repos/Azure/azure-sdk-fake/contributors", + "created_at": "2022-06-27T16:19:29Z", + "default_branch": "main", + "delete_branch_on_merge": false, + "deployments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/deployments", + "description": "Tools repository leveraged by the Azure SDK team.", + "disabled": false, + "downloads_url": "https://api.github.com/repos/Azure/azure-sdk-fake/downloads", + "events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/events", + "fork": true, + "forks": 0, + "forks_count": 0, + "forks_url": "https://api.github.com/repos/Azure/azure-sdk-fake/forks", + "full_name": "Azure/azure-sdk-fake", + "git_commits_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/commits{/sha}", + "git_refs_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/refs{/sha}", + "git_tags_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/tags{/sha}", + "git_url": "git://github.com/Azure/azure-sdk-fake.git", + "has_downloads": true, + "has_issues": true, + "has_pages": false, + "has_projects": true, + "has_wiki": true, + "homepage": null, + "hooks_url": "https://api.github.com/repos/Azure/azure-sdk-fake/hooks", + "html_url": "https://github.com/Azure/azure-sdk-fake", + "id": 507980610, + "is_template": false, + "issue_comment_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/comments{/number}", + "issue_events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/events{/number}", + "issues_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues{/number}", + "keys_url": "https://api.github.com/repos/Azure/azure-sdk-fake/keys{/key_id}", + "labels_url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels{/name}", + "language": "C#", + "languages_url": "https://api.github.com/repos/Azure/azure-sdk-fake/languages", + "license": { + "key": "mit", + "name": "MIT License", + "node_id": "MDc6TGljZW5zZTEz", + "spdx_id": "MIT", + "url": "https://api.github.com/licenses/mit" + }, + "merge_commit_message": "PR_TITLE", + "merge_commit_title": "MERGE_MESSAGE", + "merges_url": "https://api.github.com/repos/Azure/azure-sdk-fake/merges", + "milestones_url": "https://api.github.com/repos/Azure/azure-sdk-fake/milestones{/number}", + "mirror_url": null, + "name": "azure-sdk-fake", + "node_id": "R_kgDOHkcrQg", + "notifications_url": "https://api.github.com/repos/Azure/azure-sdk-fake/notifications{?since,all,participating}", + "open_issues": 7, + "open_issues_count": 7, + "owner": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + }, + "private": false, + "pulls_url": "https://api.github.com/repos/Azure/azure-sdk-fake/pulls{/number}", + "pushed_at": "2022-11-01T20:27:41Z", + "releases_url": "https://api.github.com/repos/Azure/azure-sdk-fake/releases{/id}", + "size": 28964, + "squash_merge_commit_message": "COMMIT_MESSAGES", + "squash_merge_commit_title": "COMMIT_OR_PR_TITLE", + "ssh_url": "git@github.com:Azure/azure-sdk-fake.git", + "stargazers_count": 0, + "stargazers_url": "https://api.github.com/repos/Azure/azure-sdk-fake/stargazers", + "statuses_url": "https://api.github.com/repos/Azure/azure-sdk-fake/statuses/{sha}", + "subscribers_url": "https://api.github.com/repos/Azure/azure-sdk-fake/subscribers", + "subscription_url": "https://api.github.com/repos/Azure/azure-sdk-fake/subscription", + "svn_url": "https://github.com/Azure/azure-sdk-fake", + "tags_url": "https://api.github.com/repos/Azure/azure-sdk-fake/tags", + "teams_url": "https://api.github.com/repos/Azure/azure-sdk-fake/teams", + "topics": [], + "trees_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/trees{/sha}", + "updated_at": "2022-10-31T16:54:20Z", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake", + "use_squash_pr_title_as_default": false, + "visibility": "public", + "watchers": 0, + "watchers_count": 0, + "web_commit_signoff_required": false + }, + "sha": "827307d6715561ecea6ec0d5d64e5fb2578a6165", + "user": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + } + }, + "html_url": "https://github.com/Azure/azure-sdk-fake/pull/8", + "id": 1107290828, + "issue_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/8", + "labels": [], + "locked": false, + "maintainer_can_modify": false, + "merge_commit_sha": null, + "mergeable": null, + "mergeable_state": "unknown", + "merged": false, + "merged_at": null, + "merged_by": null, + "milestone": null, + "node_id": "PR_kwDOHkcrQs5B_-rM", + "number": 8, + "patch_url": "https://github.com/Azure/azure-sdk-fake/pull/8.patch", + "rebaseable": null, + "requested_reviewers": [], + "requested_teams": [], + "review_comment_url": "https://api.github.com/repos/Azure/azure-sdk-fake/pulls/comments{/number}", + "review_comments": 0, + "review_comments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/pulls/8/comments", + "state": "open", + "statuses_url": "https://api.github.com/repos/Azure/azure-sdk-fake/statuses/827307d6715561ecea6ec0d5d64e5fb2578a6165", + "title": "This is just a test", + "updated_at": "2022-11-01T20:27:41Z", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/pulls/8", + "user": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + } + }, + "repository": { + "allow_forking": true, + "archive_url": "https://api.github.com/repos/Azure/azure-sdk-fake/{archive_format}{/ref}", + "archived": false, + "assignees_url": "https://api.github.com/repos/Azure/azure-sdk-fake/assignees{/user}", + "blobs_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/blobs{/sha}", + "branches_url": "https://api.github.com/repos/Azure/azure-sdk-fake/branches{/branch}", + "clone_url": "https://github.com/Azure/azure-sdk-fake.git", + "collaborators_url": "https://api.github.com/repos/Azure/azure-sdk-fake/collaborators{/collaborator}", + "comments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/comments{/number}", + "commits_url": "https://api.github.com/repos/Azure/azure-sdk-fake/commits{/sha}", + "compare_url": "https://api.github.com/repos/Azure/azure-sdk-fake/compare/{base}...{head}", + "contents_url": "https://api.github.com/repos/Azure/azure-sdk-fake/contents/{+path}", + "contributors_url": "https://api.github.com/repos/Azure/azure-sdk-fake/contributors", + "created_at": "2022-06-27T16:19:29Z", + "default_branch": "main", + "deployments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/deployments", + "description": "Tools repository leveraged by the Azure SDK team.", + "disabled": false, + "downloads_url": "https://api.github.com/repos/Azure/azure-sdk-fake/downloads", + "events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/events", + "fork": true, + "forks": 0, + "forks_count": 0, + "forks_url": "https://api.github.com/repos/Azure/azure-sdk-fake/forks", + "full_name": "Azure/azure-sdk-fake", + "git_commits_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/commits{/sha}", + "git_refs_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/refs{/sha}", + "git_tags_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/tags{/sha}", + "git_url": "git://github.com/Azure/azure-sdk-fake.git", + "has_downloads": true, + "has_issues": true, + "has_pages": false, + "has_projects": true, + "has_wiki": true, + "homepage": null, + "hooks_url": "https://api.github.com/repos/Azure/azure-sdk-fake/hooks", + "html_url": "https://github.com/Azure/azure-sdk-fake", + "id": 507980610, + "is_template": false, + "issue_comment_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/comments{/number}", + "issue_events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/events{/number}", + "issues_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues{/number}", + "keys_url": "https://api.github.com/repos/Azure/azure-sdk-fake/keys{/key_id}", + "labels_url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels{/name}", + "language": "C#", + "languages_url": "https://api.github.com/repos/Azure/azure-sdk-fake/languages", + "license": { + "key": "mit", + "name": "MIT License", + "node_id": "MDc6TGljZW5zZTEz", + "spdx_id": "MIT", + "url": "https://api.github.com/licenses/mit" + }, + "merges_url": "https://api.github.com/repos/Azure/azure-sdk-fake/merges", + "milestones_url": "https://api.github.com/repos/Azure/azure-sdk-fake/milestones{/number}", + "mirror_url": null, + "name": "azure-sdk-fake", + "node_id": "R_kgDOHkcrQg", + "notifications_url": "https://api.github.com/repos/Azure/azure-sdk-fake/notifications{?since,all,participating}", + "open_issues": 7, + "open_issues_count": 7, + "owner": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + }, + "private": false, + "pulls_url": "https://api.github.com/repos/Azure/azure-sdk-fake/pulls{/number}", + "pushed_at": "2022-11-01T20:27:41Z", + "releases_url": "https://api.github.com/repos/Azure/azure-sdk-fake/releases{/id}", + "size": 28964, + "ssh_url": "git@github.com:Azure/azure-sdk-fake.git", + "stargazers_count": 0, + "stargazers_url": "https://api.github.com/repos/Azure/azure-sdk-fake/stargazers", + "statuses_url": "https://api.github.com/repos/Azure/azure-sdk-fake/statuses/{sha}", + "subscribers_url": "https://api.github.com/repos/Azure/azure-sdk-fake/subscribers", + "subscription_url": "https://api.github.com/repos/Azure/azure-sdk-fake/subscription", + "svn_url": "https://github.com/Azure/azure-sdk-fake", + "tags_url": "https://api.github.com/repos/Azure/azure-sdk-fake/tags", + "teams_url": "https://api.github.com/repos/Azure/azure-sdk-fake/teams", + "topics": [], + "trees_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/trees{/sha}", + "updated_at": "2022-10-31T16:54:20Z", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake", + "visibility": "public", + "watchers": 0, + "watchers_count": 0, + "web_commit_signoff_required": false + }, + "sender": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + } +} \ No newline at end of file diff --git a/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Tests.JsonEventPayloads/ReopenIssue_issue_comment_created.json b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Tests.JsonEventPayloads/ReopenIssue_issue_comment_created.json new file mode 100644 index 00000000000..bb0f3ed4f2c --- /dev/null +++ b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Tests.JsonEventPayloads/ReopenIssue_issue_comment_created.json @@ -0,0 +1,252 @@ +{ + "action": "created", + "comment": { + "author_association": "OWNER", + "body": "Comment created for ReopenIssue payload", + "created_at": "2023-01-23T19:46:33Z", + "html_url": "https://github.com/Azure/azure-sdk-fake/issues/1#issuecomment-1400886297", + "id": 1400886297, + "issue_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/1", + "node_id": "IC_kwDOHkcrQs5Tf9QZ", + "performed_via_github_app": null, + "reactions": { + "+1": 0, + "-1": 0, + "confused": 0, + "eyes": 0, + "heart": 0, + "hooray": 0, + "laugh": 0, + "rocket": 0, + "total_count": 0, + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/comments/1400886297/reactions" + }, + "updated_at": "2023-01-23T19:46:33Z", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/comments/1400886297", + "user": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + } + }, + "issue": { + "active_lock_reason": null, + "assignee": null, + "assignees": [], + "author_association": "OWNER", + "body": "This is just a test issue", + "closed_at": "2022-12-09T16:48:56Z", + "comments": 5, + "comments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/1/comments", + "created_at": "2022-10-20T22:32:02Z", + "events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/1/events", + "html_url": "https://github.com/Azure/azure-sdk-fake/issues/1", + "id": 1417400997, + "labels": [ + { + "color": "94812F", + "default": false, + "description": "", + "id": 5070542662, + "name": "no-recent-activity", + "node_id": "LA_kwDOHkcrQs8AAAABLjpXRg", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels/no-recent-activity" + }, + { + "color": "CFDBFC", + "default": false, + "description": "", + "id": 5070852679, + "name": "needs-author-feedback", + "node_id": "LA_kwDOHkcrQs8AAAABLj8SRw", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels/needs-author-feedback" + } + ], + "labels_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/1/labels{/name}", + "locked": false, + "milestone": null, + "node_id": "I_kwDOHkcrQs5Ue9Kl", + "number": 1, + "performed_via_github_app": null, + "reactions": { + "+1": 0, + "-1": 0, + "confused": 0, + "eyes": 0, + "heart": 0, + "hooray": 0, + "laugh": 0, + "rocket": 0, + "total_count": 0, + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/1/reactions" + }, + "repository_url": "https://api.github.com/repos/Azure/azure-sdk-fake", + "state": "closed", + "state_reason": "completed", + "timeline_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/1/timeline", + "title": "This is just a test issue", + "updated_at": "2023-01-23T19:46:34Z", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/1", + "user": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + } + }, + "repository": { + "allow_forking": true, + "archive_url": "https://api.github.com/repos/Azure/azure-sdk-fake/{archive_format}{/ref}", + "archived": false, + "assignees_url": "https://api.github.com/repos/Azure/azure-sdk-fake/assignees{/user}", + "blobs_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/blobs{/sha}", + "branches_url": "https://api.github.com/repos/Azure/azure-sdk-fake/branches{/branch}", + "clone_url": "https://github.com/Azure/azure-sdk-fake.git", + "collaborators_url": "https://api.github.com/repos/Azure/azure-sdk-fake/collaborators{/collaborator}", + "comments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/comments{/number}", + "commits_url": "https://api.github.com/repos/Azure/azure-sdk-fake/commits{/sha}", + "compare_url": "https://api.github.com/repos/Azure/azure-sdk-fake/compare/{base}...{head}", + "contents_url": "https://api.github.com/repos/Azure/azure-sdk-fake/contents/{+path}", + "contributors_url": "https://api.github.com/repos/Azure/azure-sdk-fake/contributors", + "created_at": "2022-06-27T16:19:29Z", + "default_branch": "main", + "deployments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/deployments", + "description": "Tools repository leveraged by the Azure SDK team.", + "disabled": false, + "downloads_url": "https://api.github.com/repos/Azure/azure-sdk-fake/downloads", + "events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/events", + "fork": true, + "forks": 0, + "forks_count": 0, + "forks_url": "https://api.github.com/repos/Azure/azure-sdk-fake/forks", + "full_name": "Azure/azure-sdk-fake", + "git_commits_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/commits{/sha}", + "git_refs_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/refs{/sha}", + "git_tags_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/tags{/sha}", + "git_url": "git://github.com/Azure/azure-sdk-fake.git", + "has_discussions": false, + "has_downloads": true, + "has_issues": true, + "has_pages": false, + "has_projects": true, + "has_wiki": true, + "homepage": null, + "hooks_url": "https://api.github.com/repos/Azure/azure-sdk-fake/hooks", + "html_url": "https://github.com/Azure/azure-sdk-fake", + "id": 507980610, + "is_template": false, + "issue_comment_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/comments{/number}", + "issue_events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/events{/number}", + "issues_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues{/number}", + "keys_url": "https://api.github.com/repos/Azure/azure-sdk-fake/keys{/key_id}", + "labels_url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels{/name}", + "language": "C#", + "languages_url": "https://api.github.com/repos/Azure/azure-sdk-fake/languages", + "license": { + "key": "mit", + "name": "MIT License", + "node_id": "MDc6TGljZW5zZTEz", + "spdx_id": "MIT", + "url": "https://api.github.com/licenses/mit" + }, + "merges_url": "https://api.github.com/repos/Azure/azure-sdk-fake/merges", + "milestones_url": "https://api.github.com/repos/Azure/azure-sdk-fake/milestones{/number}", + "mirror_url": null, + "name": "azure-sdk-fake", + "node_id": "R_kgDOHkcrQg", + "notifications_url": "https://api.github.com/repos/Azure/azure-sdk-fake/notifications{?since,all,participating}", + "open_issues": 5, + "open_issues_count": 5, + "owner": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + }, + "private": false, + "pulls_url": "https://api.github.com/repos/Azure/azure-sdk-fake/pulls{/number}", + "pushed_at": "2023-01-23T18:19:17Z", + "releases_url": "https://api.github.com/repos/Azure/azure-sdk-fake/releases{/id}", + "size": 29043, + "ssh_url": "git@github.com:Azure/azure-sdk-fake.git", + "stargazers_count": 0, + "stargazers_url": "https://api.github.com/repos/Azure/azure-sdk-fake/stargazers", + "statuses_url": "https://api.github.com/repos/Azure/azure-sdk-fake/statuses/{sha}", + "subscribers_url": "https://api.github.com/repos/Azure/azure-sdk-fake/subscribers", + "subscription_url": "https://api.github.com/repos/Azure/azure-sdk-fake/subscription", + "svn_url": "https://github.com/Azure/azure-sdk-fake", + "tags_url": "https://api.github.com/repos/Azure/azure-sdk-fake/tags", + "teams_url": "https://api.github.com/repos/Azure/azure-sdk-fake/teams", + "topics": [], + "trees_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/trees{/sha}", + "updated_at": "2022-12-09T16:58:56Z", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake", + "visibility": "public", + "watchers": 0, + "watchers_count": 0, + "web_commit_signoff_required": false + }, + "sender": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + } +} diff --git a/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Tests.JsonEventPayloads/ReopenPullRequest_pr_comment_created_creator_is_author.json b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Tests.JsonEventPayloads/ReopenPullRequest_pr_comment_created_creator_is_author.json new file mode 100644 index 00000000000..3666133567b --- /dev/null +++ b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Tests.JsonEventPayloads/ReopenPullRequest_pr_comment_created_creator_is_author.json @@ -0,0 +1,291 @@ +{ + "action": "created", + "comment": { + "author_association": "OWNER", + "body": "/reopen This is comment to generate a payload for ReopenPullRequest static test.", + "created_at": "2023-01-24T20:50:21Z", + "html_url": "https://github.com/Azure/azure-sdk-fake/pull/7#issuecomment-1402636221", + "id": 1402636221, + "issue_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/7", + "node_id": "IC_kwDOHkcrQs5Tmoe9", + "performed_via_github_app": null, + "reactions": { + "+1": 0, + "-1": 0, + "confused": 0, + "eyes": 0, + "heart": 0, + "hooray": 0, + "laugh": 0, + "rocket": 0, + "total_count": 0, + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/comments/1402636221/reactions" + }, + "updated_at": "2023-01-24T20:50:21Z", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/comments/1402636221", + "user": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser2/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser2/followers", + "following_url": "https://api.github.com/users/FakeUser2/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser2/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser2", + "id": 13556087, + "login": "FakeUser2", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser2/orgs", + "received_events_url": "https://api.github.com/users/FakeUser2/received_events", + "repos_url": "https://api.github.com/users/FakeUser2/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser2/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser2/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser2" + } + }, + "issue": { + "active_lock_reason": null, + "assignee": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + }, + "assignees": [ + { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + } + ], + "author_association": "OWNER", + "body": "This will never be checked in", + "closed_at": "2022-11-01T20:24:26Z", + "comments": 3, + "comments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/7/comments", + "created_at": "2022-11-01T18:40:07Z", + "draft": false, + "events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/7/events", + "html_url": "https://github.com/Azure/azure-sdk-fake/pull/7", + "id": 1431900846, + "labels": [ + { + "color": "94812F", + "default": false, + "description": "", + "id": 5070542662, + "name": "no-recent-activity", + "node_id": "LA_kwDOHkcrQs8AAAABLjpXRg", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels/no-recent-activity" + } + ], + "labels_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/7/labels{/name}", + "locked": false, + "milestone": null, + "node_id": "PR_kwDOHkcrQs5B_eUa", + "number": 7, + "performed_via_github_app": null, + "pull_request": { + "diff_url": "https://github.com/Azure/azure-sdk-fake/pull/7.diff", + "html_url": "https://github.com/Azure/azure-sdk-fake/pull/7", + "merged_at": null, + "patch_url": "https://github.com/Azure/azure-sdk-fake/pull/7.patch", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/pulls/7" + }, + "reactions": { + "+1": 0, + "-1": 0, + "confused": 0, + "eyes": 0, + "heart": 0, + "hooray": 0, + "laugh": 0, + "rocket": 0, + "total_count": 0, + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/7/reactions" + }, + "repository_url": "https://api.github.com/repos/Azure/azure-sdk-fake", + "state": "closed", + "state_reason": null, + "timeline_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/7/timeline", + "title": "Will never be checked in", + "updated_at": "2023-01-24T20:50:22Z", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/7", + "user": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + } + }, + "repository": { + "allow_forking": true, + "archive_url": "https://api.github.com/repos/Azure/azure-sdk-fake/{archive_format}{/ref}", + "archived": false, + "assignees_url": "https://api.github.com/repos/Azure/azure-sdk-fake/assignees{/user}", + "blobs_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/blobs{/sha}", + "branches_url": "https://api.github.com/repos/Azure/azure-sdk-fake/branches{/branch}", + "clone_url": "https://github.com/Azure/azure-sdk-fake.git", + "collaborators_url": "https://api.github.com/repos/Azure/azure-sdk-fake/collaborators{/collaborator}", + "comments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/comments{/number}", + "commits_url": "https://api.github.com/repos/Azure/azure-sdk-fake/commits{/sha}", + "compare_url": "https://api.github.com/repos/Azure/azure-sdk-fake/compare/{base}...{head}", + "contents_url": "https://api.github.com/repos/Azure/azure-sdk-fake/contents/{+path}", + "contributors_url": "https://api.github.com/repos/Azure/azure-sdk-fake/contributors", + "created_at": "2022-06-27T16:19:29Z", + "default_branch": "main", + "deployments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/deployments", + "description": "Tools repository leveraged by the Azure SDK team.", + "disabled": false, + "downloads_url": "https://api.github.com/repos/Azure/azure-sdk-fake/downloads", + "events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/events", + "fork": true, + "forks": 0, + "forks_count": 0, + "forks_url": "https://api.github.com/repos/Azure/azure-sdk-fake/forks", + "full_name": "Azure/azure-sdk-fake", + "git_commits_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/commits{/sha}", + "git_refs_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/refs{/sha}", + "git_tags_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/tags{/sha}", + "git_url": "git://github.com/Azure/azure-sdk-fake.git", + "has_discussions": false, + "has_downloads": true, + "has_issues": true, + "has_pages": false, + "has_projects": true, + "has_wiki": true, + "homepage": null, + "hooks_url": "https://api.github.com/repos/Azure/azure-sdk-fake/hooks", + "html_url": "https://github.com/Azure/azure-sdk-fake", + "id": 507980610, + "is_template": false, + "issue_comment_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/comments{/number}", + "issue_events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/events{/number}", + "issues_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues{/number}", + "keys_url": "https://api.github.com/repos/Azure/azure-sdk-fake/keys{/key_id}", + "labels_url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels{/name}", + "language": "C#", + "languages_url": "https://api.github.com/repos/Azure/azure-sdk-fake/languages", + "license": { + "key": "mit", + "name": "MIT License", + "node_id": "MDc6TGljZW5zZTEz", + "spdx_id": "MIT", + "url": "https://api.github.com/licenses/mit" + }, + "merges_url": "https://api.github.com/repos/Azure/azure-sdk-fake/merges", + "milestones_url": "https://api.github.com/repos/Azure/azure-sdk-fake/milestones{/number}", + "mirror_url": null, + "name": "azure-sdk-fake", + "node_id": "R_kgDOHkcrQg", + "notifications_url": "https://api.github.com/repos/Azure/azure-sdk-fake/notifications{?since,all,participating}", + "open_issues": 5, + "open_issues_count": 5, + "owner": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + }, + "private": false, + "pulls_url": "https://api.github.com/repos/Azure/azure-sdk-fake/pulls{/number}", + "pushed_at": "2023-01-23T20:07:27Z", + "releases_url": "https://api.github.com/repos/Azure/azure-sdk-fake/releases{/id}", + "size": 29059, + "ssh_url": "git@github.com:Azure/azure-sdk-fake.git", + "stargazers_count": 0, + "stargazers_url": "https://api.github.com/repos/Azure/azure-sdk-fake/stargazers", + "statuses_url": "https://api.github.com/repos/Azure/azure-sdk-fake/statuses/{sha}", + "subscribers_url": "https://api.github.com/repos/Azure/azure-sdk-fake/subscribers", + "subscription_url": "https://api.github.com/repos/Azure/azure-sdk-fake/subscription", + "svn_url": "https://github.com/Azure/azure-sdk-fake", + "tags_url": "https://api.github.com/repos/Azure/azure-sdk-fake/tags", + "teams_url": "https://api.github.com/repos/Azure/azure-sdk-fake/teams", + "topics": [], + "trees_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/trees{/sha}", + "updated_at": "2023-01-23T19:54:18Z", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake", + "visibility": "public", + "watchers": 0, + "watchers_count": 0, + "web_commit_signoff_required": false + }, + "sender": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + } +} diff --git a/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Tests.JsonEventPayloads/ReopenPullRequest_pr_comment_created_creator_is_not_author.json b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Tests.JsonEventPayloads/ReopenPullRequest_pr_comment_created_creator_is_not_author.json new file mode 100644 index 00000000000..a7ed4e7c791 --- /dev/null +++ b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Tests.JsonEventPayloads/ReopenPullRequest_pr_comment_created_creator_is_not_author.json @@ -0,0 +1,291 @@ +{ + "action": "created", + "comment": { + "author_association": "OWNER", + "body": "/reopen This is comment to generate a payload for ReopenPullRequest static test.", + "created_at": "2023-01-24T20:50:21Z", + "html_url": "https://github.com/Azure/azure-sdk-fake/pull/7#issuecomment-1402636221", + "id": 1402636221, + "issue_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/7", + "node_id": "IC_kwDOHkcrQs5Tmoe9", + "performed_via_github_app": null, + "reactions": { + "+1": 0, + "-1": 0, + "confused": 0, + "eyes": 0, + "heart": 0, + "hooray": 0, + "laugh": 0, + "rocket": 0, + "total_count": 0, + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/comments/1402636221/reactions" + }, + "updated_at": "2023-01-24T20:50:21Z", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/comments/1402636221", + "user": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser2/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser2/followers", + "following_url": "https://api.github.com/users/FakeUser2/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser2/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser2", + "id": 13556087, + "login": "FakeUser2", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser2/orgs", + "received_events_url": "https://api.github.com/users/FakeUser2/received_events", + "repos_url": "https://api.github.com/users/FakeUser2/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser2/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser2/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser2" + } + }, + "issue": { + "active_lock_reason": null, + "assignee": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + }, + "assignees": [ + { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + } + ], + "author_association": "OWNER", + "body": "This will never be checked in", + "closed_at": "2022-11-01T20:24:26Z", + "comments": 3, + "comments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/7/comments", + "created_at": "2022-11-01T18:40:07Z", + "draft": false, + "events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/7/events", + "html_url": "https://github.com/Azure/azure-sdk-fake/pull/7", + "id": 1431900846, + "labels": [ + { + "color": "94812F", + "default": false, + "description": "", + "id": 5070542662, + "name": "no-recent-activity", + "node_id": "LA_kwDOHkcrQs8AAAABLjpXRg", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels/no-recent-activity" + } + ], + "labels_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/7/labels{/name}", + "locked": false, + "milestone": null, + "node_id": "PR_kwDOHkcrQs5B_eUa", + "number": 7, + "performed_via_github_app": null, + "pull_request": { + "diff_url": "https://github.com/Azure/azure-sdk-fake/pull/7.diff", + "html_url": "https://github.com/Azure/azure-sdk-fake/pull/7", + "merged_at": null, + "patch_url": "https://github.com/Azure/azure-sdk-fake/pull/7.patch", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/pulls/7" + }, + "reactions": { + "+1": 0, + "-1": 0, + "confused": 0, + "eyes": 0, + "heart": 0, + "hooray": 0, + "laugh": 0, + "rocket": 0, + "total_count": 0, + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/7/reactions" + }, + "repository_url": "https://api.github.com/repos/Azure/azure-sdk-fake", + "state": "closed", + "state_reason": null, + "timeline_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/7/timeline", + "title": "Will never be checked in", + "updated_at": "2023-01-24T20:50:22Z", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/7", + "user": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + } + }, + "repository": { + "allow_forking": true, + "archive_url": "https://api.github.com/repos/Azure/azure-sdk-fake/{archive_format}{/ref}", + "archived": false, + "assignees_url": "https://api.github.com/repos/Azure/azure-sdk-fake/assignees{/user}", + "blobs_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/blobs{/sha}", + "branches_url": "https://api.github.com/repos/Azure/azure-sdk-fake/branches{/branch}", + "clone_url": "https://github.com/Azure/azure-sdk-fake.git", + "collaborators_url": "https://api.github.com/repos/Azure/azure-sdk-fake/collaborators{/collaborator}", + "comments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/comments{/number}", + "commits_url": "https://api.github.com/repos/Azure/azure-sdk-fake/commits{/sha}", + "compare_url": "https://api.github.com/repos/Azure/azure-sdk-fake/compare/{base}...{head}", + "contents_url": "https://api.github.com/repos/Azure/azure-sdk-fake/contents/{+path}", + "contributors_url": "https://api.github.com/repos/Azure/azure-sdk-fake/contributors", + "created_at": "2022-06-27T16:19:29Z", + "default_branch": "main", + "deployments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/deployments", + "description": "Tools repository leveraged by the Azure SDK team.", + "disabled": false, + "downloads_url": "https://api.github.com/repos/Azure/azure-sdk-fake/downloads", + "events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/events", + "fork": true, + "forks": 0, + "forks_count": 0, + "forks_url": "https://api.github.com/repos/Azure/azure-sdk-fake/forks", + "full_name": "Azure/azure-sdk-fake", + "git_commits_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/commits{/sha}", + "git_refs_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/refs{/sha}", + "git_tags_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/tags{/sha}", + "git_url": "git://github.com/Azure/azure-sdk-fake.git", + "has_discussions": false, + "has_downloads": true, + "has_issues": true, + "has_pages": false, + "has_projects": true, + "has_wiki": true, + "homepage": null, + "hooks_url": "https://api.github.com/repos/Azure/azure-sdk-fake/hooks", + "html_url": "https://github.com/Azure/azure-sdk-fake", + "id": 507980610, + "is_template": false, + "issue_comment_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/comments{/number}", + "issue_events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/events{/number}", + "issues_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues{/number}", + "keys_url": "https://api.github.com/repos/Azure/azure-sdk-fake/keys{/key_id}", + "labels_url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels{/name}", + "language": "C#", + "languages_url": "https://api.github.com/repos/Azure/azure-sdk-fake/languages", + "license": { + "key": "mit", + "name": "MIT License", + "node_id": "MDc6TGljZW5zZTEz", + "spdx_id": "MIT", + "url": "https://api.github.com/licenses/mit" + }, + "merges_url": "https://api.github.com/repos/Azure/azure-sdk-fake/merges", + "milestones_url": "https://api.github.com/repos/Azure/azure-sdk-fake/milestones{/number}", + "mirror_url": null, + "name": "azure-sdk-fake", + "node_id": "R_kgDOHkcrQg", + "notifications_url": "https://api.github.com/repos/Azure/azure-sdk-fake/notifications{?since,all,participating}", + "open_issues": 5, + "open_issues_count": 5, + "owner": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + }, + "private": false, + "pulls_url": "https://api.github.com/repos/Azure/azure-sdk-fake/pulls{/number}", + "pushed_at": "2023-01-23T20:07:27Z", + "releases_url": "https://api.github.com/repos/Azure/azure-sdk-fake/releases{/id}", + "size": 29059, + "ssh_url": "git@github.com:Azure/azure-sdk-fake.git", + "stargazers_count": 0, + "stargazers_url": "https://api.github.com/repos/Azure/azure-sdk-fake/stargazers", + "statuses_url": "https://api.github.com/repos/Azure/azure-sdk-fake/statuses/{sha}", + "subscribers_url": "https://api.github.com/repos/Azure/azure-sdk-fake/subscribers", + "subscription_url": "https://api.github.com/repos/Azure/azure-sdk-fake/subscription", + "svn_url": "https://github.com/Azure/azure-sdk-fake", + "tags_url": "https://api.github.com/repos/Azure/azure-sdk-fake/tags", + "teams_url": "https://api.github.com/repos/Azure/azure-sdk-fake/teams", + "topics": [], + "trees_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/trees{/sha}", + "updated_at": "2023-01-23T19:54:18Z", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake", + "visibility": "public", + "watchers": 0, + "watchers_count": 0, + "web_commit_signoff_required": false + }, + "sender": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser2/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser2/followers", + "following_url": "https://api.github.com/users/FakeUser2/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser2/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser2", + "id": 13556087, + "login": "FakeUser2", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser2/orgs", + "received_events_url": "https://api.github.com/users/FakeUser2/received_events", + "repos_url": "https://api.github.com/users/FakeUser2/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser2/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser2/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser2" + } +} diff --git a/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Tests.JsonEventPayloads/RequireAttentionForNonMilestone_issue_labeled.json b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Tests.JsonEventPayloads/RequireAttentionForNonMilestone_issue_labeled.json new file mode 100644 index 00000000000..6d4c740b828 --- /dev/null +++ b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Tests.JsonEventPayloads/RequireAttentionForNonMilestone_issue_labeled.json @@ -0,0 +1,266 @@ +{ + "action": "labeled", + "issue": { + "active_lock_reason": null, + "assignee": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + }, + "assignees": [ + { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + } + ], + "author_association": "OWNER", + "body": null, + "closed_at": null, + "comments": 0, + "comments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/14/comments", + "created_at": "2023-01-27T17:01:30Z", + "events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/14/events", + "html_url": "https://github.com/Azure/azure-sdk-fake/issues/14", + "id": 1560095682, + "labels": [ + { + "color": "d73a4a", + "default": true, + "description": "Something isn't working", + "id": 4273699693, + "name": "bug", + "node_id": "LA_kwDOHkcrQs7-u3tt", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels/bug" + }, + { + "color": "ededed", + "default": false, + "description": null, + "id": 4976488245, + "name": "customer-reported", + "node_id": "LA_kwDOHkcrQs8AAAABKJ8vNQ", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels/customer-reported" + }, + { + "color": "9C7082", + "default": false, + "description": "fake label for testing", + "id": 5095712487, + "name": "FakeLabel1", + "node_id": "LA_kwDOHkcrQs8AAAABL7pm5w", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels/FakeLabel1" + } + ], + "labels_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/14/labels{/name}", + "locked": false, + "milestone": null, + "node_id": "I_kwDOHkcrQs5c_SvC", + "number": 14, + "performed_via_github_app": null, + "reactions": { + "+1": 0, + "-1": 0, + "confused": 0, + "eyes": 0, + "heart": 0, + "hooray": 0, + "laugh": 0, + "rocket": 0, + "total_count": 0, + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/14/reactions" + }, + "repository_url": "https://api.github.com/repos/Azure/azure-sdk-fake", + "state": "open", + "state_reason": null, + "timeline_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/14/timeline", + "title": "New issue to generate event payloads for static tests", + "updated_at": "2023-01-30T16:56:45Z", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/14", + "user": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + } + }, + "label": { + "color": "ededed", + "default": false, + "description": null, + "id": 4976488245, + "name": "customer-reported", + "node_id": "LA_kwDOHkcrQs8AAAABKJ8vNQ", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels/customer-reported" + }, + "repository": { + "allow_forking": true, + "archive_url": "https://api.github.com/repos/Azure/azure-sdk-fake/{archive_format}{/ref}", + "archived": false, + "assignees_url": "https://api.github.com/repos/Azure/azure-sdk-fake/assignees{/user}", + "blobs_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/blobs{/sha}", + "branches_url": "https://api.github.com/repos/Azure/azure-sdk-fake/branches{/branch}", + "clone_url": "https://github.com/Azure/azure-sdk-fake.git", + "collaborators_url": "https://api.github.com/repos/Azure/azure-sdk-fake/collaborators{/collaborator}", + "comments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/comments{/number}", + "commits_url": "https://api.github.com/repos/Azure/azure-sdk-fake/commits{/sha}", + "compare_url": "https://api.github.com/repos/Azure/azure-sdk-fake/compare/{base}...{head}", + "contents_url": "https://api.github.com/repos/Azure/azure-sdk-fake/contents/{+path}", + "contributors_url": "https://api.github.com/repos/Azure/azure-sdk-fake/contributors", + "created_at": "2022-06-27T16:19:29Z", + "default_branch": "main", + "deployments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/deployments", + "description": "Tools repository leveraged by the Azure SDK team.", + "disabled": false, + "downloads_url": "https://api.github.com/repos/Azure/azure-sdk-fake/downloads", + "events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/events", + "fork": true, + "forks": 0, + "forks_count": 0, + "forks_url": "https://api.github.com/repos/Azure/azure-sdk-fake/forks", + "full_name": "Azure/azure-sdk-fake", + "git_commits_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/commits{/sha}", + "git_refs_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/refs{/sha}", + "git_tags_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/tags{/sha}", + "git_url": "git://github.com/Azure/azure-sdk-fake.git", + "has_discussions": false, + "has_downloads": true, + "has_issues": true, + "has_pages": false, + "has_projects": true, + "has_wiki": true, + "homepage": null, + "hooks_url": "https://api.github.com/repos/Azure/azure-sdk-fake/hooks", + "html_url": "https://github.com/Azure/azure-sdk-fake", + "id": 507980610, + "is_template": false, + "issue_comment_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/comments{/number}", + "issue_events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/events{/number}", + "issues_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues{/number}", + "keys_url": "https://api.github.com/repos/Azure/azure-sdk-fake/keys{/key_id}", + "labels_url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels{/name}", + "language": "C#", + "languages_url": "https://api.github.com/repos/Azure/azure-sdk-fake/languages", + "license": { + "key": "mit", + "name": "MIT License", + "node_id": "MDc6TGljZW5zZTEz", + "spdx_id": "MIT", + "url": "https://api.github.com/licenses/mit" + }, + "merges_url": "https://api.github.com/repos/Azure/azure-sdk-fake/merges", + "milestones_url": "https://api.github.com/repos/Azure/azure-sdk-fake/milestones{/number}", + "mirror_url": null, + "name": "azure-sdk-fake", + "node_id": "R_kgDOHkcrQg", + "notifications_url": "https://api.github.com/repos/Azure/azure-sdk-fake/notifications{?since,all,participating}", + "open_issues": 6, + "open_issues_count": 6, + "owner": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + }, + "private": false, + "pulls_url": "https://api.github.com/repos/Azure/azure-sdk-fake/pulls{/number}", + "pushed_at": "2023-01-27T16:33:00Z", + "releases_url": "https://api.github.com/repos/Azure/azure-sdk-fake/releases{/id}", + "size": 29098, + "ssh_url": "git@github.com:Azure/azure-sdk-fake.git", + "stargazers_count": 0, + "stargazers_url": "https://api.github.com/repos/Azure/azure-sdk-fake/stargazers", + "statuses_url": "https://api.github.com/repos/Azure/azure-sdk-fake/statuses/{sha}", + "subscribers_url": "https://api.github.com/repos/Azure/azure-sdk-fake/subscribers", + "subscription_url": "https://api.github.com/repos/Azure/azure-sdk-fake/subscription", + "svn_url": "https://github.com/Azure/azure-sdk-fake", + "tags_url": "https://api.github.com/repos/Azure/azure-sdk-fake/tags", + "teams_url": "https://api.github.com/repos/Azure/azure-sdk-fake/teams", + "topics": [], + "trees_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/trees{/sha}", + "updated_at": "2023-01-23T19:54:18Z", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake", + "visibility": "public", + "watchers": 0, + "watchers_count": 0, + "web_commit_signoff_required": false + }, + "sender": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + } +} \ No newline at end of file diff --git a/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Tests.JsonEventPayloads/RequireAttentionForNonMilestone_issue_unlabeled.json b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Tests.JsonEventPayloads/RequireAttentionForNonMilestone_issue_unlabeled.json new file mode 100644 index 00000000000..8f2a066c0bb --- /dev/null +++ b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Tests.JsonEventPayloads/RequireAttentionForNonMilestone_issue_unlabeled.json @@ -0,0 +1,266 @@ +{ + "action": "labeled", + "issue": { + "active_lock_reason": null, + "assignee": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + }, + "assignees": [ + { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + } + ], + "author_association": "OWNER", + "body": null, + "closed_at": null, + "comments": 0, + "comments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/14/comments", + "created_at": "2023-01-27T17:01:30Z", + "events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/14/events", + "html_url": "https://github.com/Azure/azure-sdk-fake/issues/14", + "id": 1560095682, + "labels": [ + { + "color": "d73a4a", + "default": true, + "description": "Something isn't working", + "id": 4273699693, + "name": "bug", + "node_id": "LA_kwDOHkcrQs7-u3tt", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels/bug" + }, + { + "color": "ededed", + "default": false, + "description": null, + "id": 4976488245, + "name": "customer-reported", + "node_id": "LA_kwDOHkcrQs8AAAABKJ8vNQ", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels/customer-reported" + }, + { + "color": "9C7082", + "default": false, + "description": "fake label for testing", + "id": 5095712487, + "name": "FakeLabel1", + "node_id": "LA_kwDOHkcrQs8AAAABL7pm5w", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels/FakeLabel1" + } + ], + "labels_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/14/labels{/name}", + "locked": false, + "milestone": null, + "node_id": "I_kwDOHkcrQs5c_SvC", + "number": 14, + "performed_via_github_app": null, + "reactions": { + "+1": 0, + "-1": 0, + "confused": 0, + "eyes": 0, + "heart": 0, + "hooray": 0, + "laugh": 0, + "rocket": 0, + "total_count": 0, + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/14/reactions" + }, + "repository_url": "https://api.github.com/repos/Azure/azure-sdk-fake", + "state": "open", + "state_reason": null, + "timeline_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/14/timeline", + "title": "New issue to generate event payloads for static tests", + "updated_at": "2023-01-30T16:56:45Z", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/14", + "user": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + } + }, + "label": { + "color": "ededed", + "default": false, + "description": null, + "id": 4976488245, + "name": "customer-reported", + "node_id": "LA_kwDOHkcrQs8AAAABKJ8vNQ", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels/customer-reported" + }, + "repository": { + "allow_forking": true, + "archive_url": "https://api.github.com/repos/Azure/azure-sdk-fake/{archive_format}{/ref}", + "archived": false, + "assignees_url": "https://api.github.com/repos/Azure/azure-sdk-fake/assignees{/user}", + "blobs_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/blobs{/sha}", + "branches_url": "https://api.github.com/repos/Azure/azure-sdk-fake/branches{/branch}", + "clone_url": "https://github.com/Azure/azure-sdk-fake.git", + "collaborators_url": "https://api.github.com/repos/Azure/azure-sdk-fake/collaborators{/collaborator}", + "comments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/comments{/number}", + "commits_url": "https://api.github.com/repos/Azure/azure-sdk-fake/commits{/sha}", + "compare_url": "https://api.github.com/repos/Azure/azure-sdk-fake/compare/{base}...{head}", + "contents_url": "https://api.github.com/repos/Azure/azure-sdk-fake/contents/{+path}", + "contributors_url": "https://api.github.com/repos/Azure/azure-sdk-fake/contributors", + "created_at": "2022-06-27T16:19:29Z", + "default_branch": "main", + "deployments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/deployments", + "description": "Tools repository leveraged by the Azure SDK team.", + "disabled": false, + "downloads_url": "https://api.github.com/repos/Azure/azure-sdk-fake/downloads", + "events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/events", + "fork": true, + "forks": 0, + "forks_count": 0, + "forks_url": "https://api.github.com/repos/Azure/azure-sdk-fake/forks", + "full_name": "Azure/azure-sdk-fake", + "git_commits_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/commits{/sha}", + "git_refs_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/refs{/sha}", + "git_tags_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/tags{/sha}", + "git_url": "git://github.com/Azure/azure-sdk-fake.git", + "has_discussions": false, + "has_downloads": true, + "has_issues": true, + "has_pages": false, + "has_projects": true, + "has_wiki": true, + "homepage": null, + "hooks_url": "https://api.github.com/repos/Azure/azure-sdk-fake/hooks", + "html_url": "https://github.com/Azure/azure-sdk-fake", + "id": 507980610, + "is_template": false, + "issue_comment_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/comments{/number}", + "issue_events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/events{/number}", + "issues_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues{/number}", + "keys_url": "https://api.github.com/repos/Azure/azure-sdk-fake/keys{/key_id}", + "labels_url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels{/name}", + "language": "C#", + "languages_url": "https://api.github.com/repos/Azure/azure-sdk-fake/languages", + "license": { + "key": "mit", + "name": "MIT License", + "node_id": "MDc6TGljZW5zZTEz", + "spdx_id": "MIT", + "url": "https://api.github.com/licenses/mit" + }, + "merges_url": "https://api.github.com/repos/Azure/azure-sdk-fake/merges", + "milestones_url": "https://api.github.com/repos/Azure/azure-sdk-fake/milestones{/number}", + "mirror_url": null, + "name": "azure-sdk-fake", + "node_id": "R_kgDOHkcrQg", + "notifications_url": "https://api.github.com/repos/Azure/azure-sdk-fake/notifications{?since,all,participating}", + "open_issues": 6, + "open_issues_count": 6, + "owner": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + }, + "private": false, + "pulls_url": "https://api.github.com/repos/Azure/azure-sdk-fake/pulls{/number}", + "pushed_at": "2023-01-27T16:33:00Z", + "releases_url": "https://api.github.com/repos/Azure/azure-sdk-fake/releases{/id}", + "size": 29098, + "ssh_url": "git@github.com:Azure/azure-sdk-fake.git", + "stargazers_count": 0, + "stargazers_url": "https://api.github.com/repos/Azure/azure-sdk-fake/stargazers", + "statuses_url": "https://api.github.com/repos/Azure/azure-sdk-fake/statuses/{sha}", + "subscribers_url": "https://api.github.com/repos/Azure/azure-sdk-fake/subscribers", + "subscription_url": "https://api.github.com/repos/Azure/azure-sdk-fake/subscription", + "svn_url": "https://github.com/Azure/azure-sdk-fake", + "tags_url": "https://api.github.com/repos/Azure/azure-sdk-fake/tags", + "teams_url": "https://api.github.com/repos/Azure/azure-sdk-fake/teams", + "topics": [], + "trees_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/trees{/sha}", + "updated_at": "2023-01-23T19:54:18Z", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake", + "visibility": "public", + "watchers": 0, + "watchers_count": 0, + "web_commit_signoff_required": false + }, + "sender": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + } +} diff --git a/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Tests.JsonEventPayloads/ResetApprovalsForUntrustedChanges_pr_synchronize.json b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Tests.JsonEventPayloads/ResetApprovalsForUntrustedChanges_pr_synchronize.json new file mode 100644 index 00000000000..9b29bfcdb2c --- /dev/null +++ b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Tests.JsonEventPayloads/ResetApprovalsForUntrustedChanges_pr_synchronize.json @@ -0,0 +1,591 @@ +{ + "action": "synchronize", + "after": "bd1285954758a643c931cec5c9879e7a0b287cba", + "before": "3e6a3aeebb53b27ae0d77bd4de0bca269e38d6db", + "number": 10, + "pull_request": { + "_links": { + "comments": { + "href": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/10/comments" + }, + "commits": { + "href": "https://api.github.com/repos/Azure/azure-sdk-fake/pulls/10/commits" + }, + "html": { + "href": "https://github.com/Azure/azure-sdk-fake/pull/10" + }, + "issue": { + "href": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/10" + }, + "review_comment": { + "href": "https://api.github.com/repos/Azure/azure-sdk-fake/pulls/comments{/number}" + }, + "review_comments": { + "href": "https://api.github.com/repos/Azure/azure-sdk-fake/pulls/10/comments" + }, + "self": { + "href": "https://api.github.com/repos/Azure/azure-sdk-fake/pulls/10" + }, + "statuses": { + "href": "https://api.github.com/repos/Azure/azure-sdk-fake/statuses/bd1285954758a643c931cec5c9879e7a0b287cba" + } + }, + "active_lock_reason": null, + "additions": 1, + "assignee": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + }, + "assignees": [ + { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + } + ], + "author_association": "OWNER", + "auto_merge": { + "commit_message": "PR for event testing only", + "commit_title": "Merge pull request #10 from FakeUser1/AnotherTestPR", + "enabled_by": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + }, + "merge_method": "merge" + }, + "base": { + "label": "FakeUser1:main", + "ref": "main", + "repo": { + "allow_auto_merge": false, + "allow_forking": true, + "allow_merge_commit": true, + "allow_rebase_merge": true, + "allow_squash_merge": true, + "allow_update_branch": false, + "archive_url": "https://api.github.com/repos/Azure/azure-sdk-fake/{archive_format}{/ref}", + "archived": false, + "assignees_url": "https://api.github.com/repos/Azure/azure-sdk-fake/assignees{/user}", + "blobs_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/blobs{/sha}", + "branches_url": "https://api.github.com/repos/Azure/azure-sdk-fake/branches{/branch}", + "clone_url": "https://github.com/Azure/azure-sdk-fake.git", + "collaborators_url": "https://api.github.com/repos/Azure/azure-sdk-fake/collaborators{/collaborator}", + "comments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/comments{/number}", + "commits_url": "https://api.github.com/repos/Azure/azure-sdk-fake/commits{/sha}", + "compare_url": "https://api.github.com/repos/Azure/azure-sdk-fake/compare/{base}...{head}", + "contents_url": "https://api.github.com/repos/Azure/azure-sdk-fake/contents/{+path}", + "contributors_url": "https://api.github.com/repos/Azure/azure-sdk-fake/contributors", + "created_at": "2022-06-27T16:19:29Z", + "default_branch": "main", + "delete_branch_on_merge": false, + "deployments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/deployments", + "description": "Tools repository leveraged by the Azure SDK team.", + "disabled": false, + "downloads_url": "https://api.github.com/repos/Azure/azure-sdk-fake/downloads", + "events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/events", + "fork": true, + "forks": 0, + "forks_count": 0, + "forks_url": "https://api.github.com/repos/Azure/azure-sdk-fake/forks", + "full_name": "Azure/azure-sdk-fake", + "git_commits_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/commits{/sha}", + "git_refs_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/refs{/sha}", + "git_tags_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/tags{/sha}", + "git_url": "git://github.com/Azure/azure-sdk-fake.git", + "has_discussions": false, + "has_downloads": true, + "has_issues": true, + "has_pages": false, + "has_projects": true, + "has_wiki": true, + "homepage": null, + "hooks_url": "https://api.github.com/repos/Azure/azure-sdk-fake/hooks", + "html_url": "https://github.com/Azure/azure-sdk-fake", + "id": 507980610, + "is_template": false, + "issue_comment_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/comments{/number}", + "issue_events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/events{/number}", + "issues_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues{/number}", + "keys_url": "https://api.github.com/repos/Azure/azure-sdk-fake/keys{/key_id}", + "labels_url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels{/name}", + "language": "C#", + "languages_url": "https://api.github.com/repos/Azure/azure-sdk-fake/languages", + "license": { + "key": "mit", + "name": "MIT License", + "node_id": "MDc6TGljZW5zZTEz", + "spdx_id": "MIT", + "url": "https://api.github.com/licenses/mit" + }, + "merge_commit_message": "PR_TITLE", + "merge_commit_title": "MERGE_MESSAGE", + "merges_url": "https://api.github.com/repos/Azure/azure-sdk-fake/merges", + "milestones_url": "https://api.github.com/repos/Azure/azure-sdk-fake/milestones{/number}", + "mirror_url": null, + "name": "azure-sdk-fake", + "node_id": "R_kgDOHkcrQg", + "notifications_url": "https://api.github.com/repos/Azure/azure-sdk-fake/notifications{?since,all,participating}", + "open_issues": 7, + "open_issues_count": 7, + "owner": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + }, + "private": false, + "pulls_url": "https://api.github.com/repos/Azure/azure-sdk-fake/pulls{/number}", + "pushed_at": "2022-11-11T17:02:46Z", + "releases_url": "https://api.github.com/repos/Azure/azure-sdk-fake/releases{/id}", + "size": 28964, + "squash_merge_commit_message": "COMMIT_MESSAGES", + "squash_merge_commit_title": "COMMIT_OR_PR_TITLE", + "ssh_url": "git@github.com:Azure/azure-sdk-fake.git", + "stargazers_count": 0, + "stargazers_url": "https://api.github.com/repos/Azure/azure-sdk-fake/stargazers", + "statuses_url": "https://api.github.com/repos/Azure/azure-sdk-fake/statuses/{sha}", + "subscribers_url": "https://api.github.com/repos/Azure/azure-sdk-fake/subscribers", + "subscription_url": "https://api.github.com/repos/Azure/azure-sdk-fake/subscription", + "svn_url": "https://github.com/Azure/azure-sdk-fake", + "tags_url": "https://api.github.com/repos/Azure/azure-sdk-fake/tags", + "teams_url": "https://api.github.com/repos/Azure/azure-sdk-fake/teams", + "topics": [], + "trees_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/trees{/sha}", + "updated_at": "2022-10-31T16:54:20Z", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake", + "use_squash_pr_title_as_default": false, + "visibility": "public", + "watchers": 0, + "watchers_count": 0, + "web_commit_signoff_required": false + }, + "sha": "1116f5a0f2ec285febd3a584b3f759cab57d7e03", + "user": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + } + }, + "body": "This PR is for testing purposes only", + "changed_files": 1, + "closed_at": null, + "comments": 0, + "comments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/10/comments", + "commits": 2, + "commits_url": "https://api.github.com/repos/Azure/azure-sdk-fake/pulls/10/commits", + "created_at": "2022-11-11T17:00:28Z", + "deletions": 1, + "diff_url": "https://github.com/Azure/azure-sdk-fake/pull/10.diff", + "draft": false, + "head": { + "label": "FakeUser1:AnotherTestPR", + "ref": "AnotherTestPR", + "repo": { + "allow_auto_merge": false, + "allow_forking": true, + "allow_merge_commit": true, + "allow_rebase_merge": true, + "allow_squash_merge": true, + "allow_update_branch": false, + "archive_url": "https://api.github.com/repos/Azure/azure-sdk-fake/{archive_format}{/ref}", + "archived": false, + "assignees_url": "https://api.github.com/repos/Azure/azure-sdk-fake/assignees{/user}", + "blobs_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/blobs{/sha}", + "branches_url": "https://api.github.com/repos/Azure/azure-sdk-fake/branches{/branch}", + "clone_url": "https://github.com/Azure/azure-sdk-fake.git", + "collaborators_url": "https://api.github.com/repos/Azure/azure-sdk-fake/collaborators{/collaborator}", + "comments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/comments{/number}", + "commits_url": "https://api.github.com/repos/Azure/azure-sdk-fake/commits{/sha}", + "compare_url": "https://api.github.com/repos/Azure/azure-sdk-fake/compare/{base}...{head}", + "contents_url": "https://api.github.com/repos/Azure/azure-sdk-fake/contents/{+path}", + "contributors_url": "https://api.github.com/repos/Azure/azure-sdk-fake/contributors", + "created_at": "2022-06-27T16:19:29Z", + "default_branch": "main", + "delete_branch_on_merge": false, + "deployments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/deployments", + "description": "Tools repository leveraged by the Azure SDK team.", + "disabled": false, + "downloads_url": "https://api.github.com/repos/Azure/azure-sdk-fake/downloads", + "events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/events", + "fork": true, + "forks": 0, + "forks_count": 0, + "forks_url": "https://api.github.com/repos/Azure/azure-sdk-fake/forks", + "full_name": "Azure/azure-sdk-fake", + "git_commits_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/commits{/sha}", + "git_refs_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/refs{/sha}", + "git_tags_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/tags{/sha}", + "git_url": "git://github.com/Azure/azure-sdk-fake.git", + "has_discussions": false, + "has_downloads": true, + "has_issues": true, + "has_pages": false, + "has_projects": true, + "has_wiki": true, + "homepage": null, + "hooks_url": "https://api.github.com/repos/Azure/azure-sdk-fake/hooks", + "html_url": "https://github.com/Azure/azure-sdk-fake", + "id": 507980610, + "is_template": false, + "issue_comment_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/comments{/number}", + "issue_events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/events{/number}", + "issues_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues{/number}", + "keys_url": "https://api.github.com/repos/Azure/azure-sdk-fake/keys{/key_id}", + "labels_url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels{/name}", + "language": "C#", + "languages_url": "https://api.github.com/repos/Azure/azure-sdk-fake/languages", + "license": { + "key": "mit", + "name": "MIT License", + "node_id": "MDc6TGljZW5zZTEz", + "spdx_id": "MIT", + "url": "https://api.github.com/licenses/mit" + }, + "merge_commit_message": "PR_TITLE", + "merge_commit_title": "MERGE_MESSAGE", + "merges_url": "https://api.github.com/repos/Azure/azure-sdk-fake/merges", + "milestones_url": "https://api.github.com/repos/Azure/azure-sdk-fake/milestones{/number}", + "mirror_url": null, + "name": "azure-sdk-fake", + "node_id": "R_kgDOHkcrQg", + "notifications_url": "https://api.github.com/repos/Azure/azure-sdk-fake/notifications{?since,all,participating}", + "open_issues": 7, + "open_issues_count": 7, + "owner": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + }, + "private": false, + "pulls_url": "https://api.github.com/repos/Azure/azure-sdk-fake/pulls{/number}", + "pushed_at": "2022-11-11T17:02:46Z", + "releases_url": "https://api.github.com/repos/Azure/azure-sdk-fake/releases{/id}", + "size": 28964, + "squash_merge_commit_message": "COMMIT_MESSAGES", + "squash_merge_commit_title": "COMMIT_OR_PR_TITLE", + "ssh_url": "git@github.com:Azure/azure-sdk-fake.git", + "stargazers_count": 0, + "stargazers_url": "https://api.github.com/repos/Azure/azure-sdk-fake/stargazers", + "statuses_url": "https://api.github.com/repos/Azure/azure-sdk-fake/statuses/{sha}", + "subscribers_url": "https://api.github.com/repos/Azure/azure-sdk-fake/subscribers", + "subscription_url": "https://api.github.com/repos/Azure/azure-sdk-fake/subscription", + "svn_url": "https://github.com/Azure/azure-sdk-fake", + "tags_url": "https://api.github.com/repos/Azure/azure-sdk-fake/tags", + "teams_url": "https://api.github.com/repos/Azure/azure-sdk-fake/teams", + "topics": [], + "trees_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/trees{/sha}", + "updated_at": "2022-10-31T16:54:20Z", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake", + "use_squash_pr_title_as_default": false, + "visibility": "public", + "watchers": 0, + "watchers_count": 0, + "web_commit_signoff_required": false + }, + "sha": "bd1285954758a643c931cec5c9879e7a0b287cba", + "user": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + } + }, + "html_url": "https://github.com/Azure/azure-sdk-fake/pull/10", + "id": 1119343007, + "issue_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/10", + "labels": [ + { + "color": "d73a4a", + "default": true, + "description": "Something isn't working", + "id": 4273699693, + "name": "bug", + "node_id": "LA_kwDOHkcrQs7-u3tt", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels/bug" + }, + { + "color": "94812F", + "default": false, + "description": "", + "id": 5070542662, + "name": "no-recent-activity", + "node_id": "LA_kwDOHkcrQs8AAAABLjpXRg", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels/no-recent-activity" + } + ], + "locked": false, + "maintainer_can_modify": false, + "merge_commit_sha": "670cc9260666ea6d46bfda573fee3285e9fab2cf", + "mergeable": null, + "mergeable_state": "unknown", + "merged": false, + "merged_at": null, + "merged_by": null, + "milestone": null, + "node_id": "PR_kwDOHkcrQs5Ct9Gf", + "number": 10, + "patch_url": "https://github.com/Azure/azure-sdk-fake/pull/10.patch", + "rebaseable": null, + "requested_reviewers": [], + "requested_teams": [], + "review_comment_url": "https://api.github.com/repos/Azure/azure-sdk-fake/pulls/comments{/number}", + "review_comments": 0, + "review_comments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/pulls/10/comments", + "state": "open", + "statuses_url": "https://api.github.com/repos/Azure/azure-sdk-fake/statuses/bd1285954758a643c931cec5c9879e7a0b287cba", + "title": "PR for event testing only", + "updated_at": "2022-11-11T17:02:45Z", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/pulls/10", + "user": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + } + }, + "repository": { + "allow_forking": true, + "archive_url": "https://api.github.com/repos/Azure/azure-sdk-fake/{archive_format}{/ref}", + "archived": false, + "assignees_url": "https://api.github.com/repos/Azure/azure-sdk-fake/assignees{/user}", + "blobs_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/blobs{/sha}", + "branches_url": "https://api.github.com/repos/Azure/azure-sdk-fake/branches{/branch}", + "clone_url": "https://github.com/Azure/azure-sdk-fake.git", + "collaborators_url": "https://api.github.com/repos/Azure/azure-sdk-fake/collaborators{/collaborator}", + "comments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/comments{/number}", + "commits_url": "https://api.github.com/repos/Azure/azure-sdk-fake/commits{/sha}", + "compare_url": "https://api.github.com/repos/Azure/azure-sdk-fake/compare/{base}...{head}", + "contents_url": "https://api.github.com/repos/Azure/azure-sdk-fake/contents/{+path}", + "contributors_url": "https://api.github.com/repos/Azure/azure-sdk-fake/contributors", + "created_at": "2022-06-27T16:19:29Z", + "default_branch": "main", + "deployments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/deployments", + "description": "Tools repository leveraged by the Azure SDK team.", + "disabled": false, + "downloads_url": "https://api.github.com/repos/Azure/azure-sdk-fake/downloads", + "events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/events", + "fork": true, + "forks": 0, + "forks_count": 0, + "forks_url": "https://api.github.com/repos/Azure/azure-sdk-fake/forks", + "full_name": "Azure/azure-sdk-fake", + "git_commits_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/commits{/sha}", + "git_refs_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/refs{/sha}", + "git_tags_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/tags{/sha}", + "git_url": "git://github.com/Azure/azure-sdk-fake.git", + "has_discussions": false, + "has_downloads": true, + "has_issues": true, + "has_pages": false, + "has_projects": true, + "has_wiki": true, + "homepage": null, + "hooks_url": "https://api.github.com/repos/Azure/azure-sdk-fake/hooks", + "html_url": "https://github.com/Azure/azure-sdk-fake", + "id": 507980610, + "is_template": false, + "issue_comment_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/comments{/number}", + "issue_events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/events{/number}", + "issues_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues{/number}", + "keys_url": "https://api.github.com/repos/Azure/azure-sdk-fake/keys{/key_id}", + "labels_url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels{/name}", + "language": "C#", + "languages_url": "https://api.github.com/repos/Azure/azure-sdk-fake/languages", + "license": { + "key": "mit", + "name": "MIT License", + "node_id": "MDc6TGljZW5zZTEz", + "spdx_id": "MIT", + "url": "https://api.github.com/licenses/mit" + }, + "merges_url": "https://api.github.com/repos/Azure/azure-sdk-fake/merges", + "milestones_url": "https://api.github.com/repos/Azure/azure-sdk-fake/milestones{/number}", + "mirror_url": null, + "name": "azure-sdk-fake", + "node_id": "R_kgDOHkcrQg", + "notifications_url": "https://api.github.com/repos/Azure/azure-sdk-fake/notifications{?since,all,participating}", + "open_issues": 7, + "open_issues_count": 7, + "owner": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + }, + "private": false, + "pulls_url": "https://api.github.com/repos/Azure/azure-sdk-fake/pulls{/number}", + "pushed_at": "2022-11-11T17:02:46Z", + "releases_url": "https://api.github.com/repos/Azure/azure-sdk-fake/releases{/id}", + "size": 28964, + "ssh_url": "git@github.com:Azure/azure-sdk-fake.git", + "stargazers_count": 0, + "stargazers_url": "https://api.github.com/repos/Azure/azure-sdk-fake/stargazers", + "statuses_url": "https://api.github.com/repos/Azure/azure-sdk-fake/statuses/{sha}", + "subscribers_url": "https://api.github.com/repos/Azure/azure-sdk-fake/subscribers", + "subscription_url": "https://api.github.com/repos/Azure/azure-sdk-fake/subscription", + "svn_url": "https://github.com/Azure/azure-sdk-fake", + "tags_url": "https://api.github.com/repos/Azure/azure-sdk-fake/tags", + "teams_url": "https://api.github.com/repos/Azure/azure-sdk-fake/teams", + "topics": [], + "trees_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/trees{/sha}", + "updated_at": "2022-10-31T16:54:20Z", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake", + "visibility": "public", + "watchers": 0, + "watchers_count": 0, + "web_commit_signoff_required": false + }, + "sender": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + } +} diff --git a/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Tests.JsonEventPayloads/ResetIssueActivity_issue_comment_created.json b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Tests.JsonEventPayloads/ResetIssueActivity_issue_comment_created.json new file mode 100644 index 00000000000..673c28d8800 --- /dev/null +++ b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Tests.JsonEventPayloads/ResetIssueActivity_issue_comment_created.json @@ -0,0 +1,261 @@ +{ + "action": "created", + "comment": { + "author_association": "OWNER", + "body": "Issue Comment for ResetIssueActivity comment created testing", + "created_at": "2023-01-23T18:28:39Z", + "html_url": "https://github.com/Azure/azure-sdk-fake/issues/2#issuecomment-1400792371", + "id": 1400792371, + "issue_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/2", + "node_id": "IC_kwDOHkcrQs5TfmUz", + "performed_via_github_app": null, + "reactions": { + "+1": 0, + "-1": 0, + "confused": 0, + "eyes": 0, + "heart": 0, + "hooray": 0, + "laugh": 0, + "rocket": 0, + "total_count": 0, + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/comments/1400792371/reactions" + }, + "updated_at": "2023-01-23T18:28:39Z", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/comments/1400792371", + "user": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + } + }, + "issue": { + "active_lock_reason": null, + "assignee": null, + "assignees": [], + "author_association": "OWNER", + "body": null, + "closed_at": null, + "comments": 1, + "comments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/2/comments", + "created_at": "2022-10-24T16:12:11Z", + "events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/2/events", + "html_url": "https://github.com/Azure/azure-sdk-fake/issues/2", + "id": 1421080742, + "labels": [ + { + "color": "d73a4a", + "default": true, + "description": "Something isn't working", + "id": 4273699693, + "name": "bug", + "node_id": "LA_kwDOHkcrQs7-u3tt", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels/bug" + }, + { + "color": "ededed", + "default": false, + "description": null, + "id": 4704569627, + "name": "needs-triage", + "node_id": "LA_kwDOHkcrQs8AAAABGGoJGw", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels/needs-triage" + }, + { + "color": "94812F", + "default": false, + "description": "", + "id": 5070542662, + "name": "no-recent-activity", + "node_id": "LA_kwDOHkcrQs8AAAABLjpXRg", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels/no-recent-activity" + } + ], + "labels_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/2/labels{/name}", + "locked": false, + "milestone": null, + "node_id": "I_kwDOHkcrQs5Us_im", + "number": 2, + "performed_via_github_app": null, + "reactions": { + "+1": 0, + "-1": 0, + "confused": 0, + "eyes": 0, + "heart": 0, + "hooray": 0, + "laugh": 0, + "rocket": 0, + "total_count": 0, + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/2/reactions" + }, + "repository_url": "https://api.github.com/repos/Azure/azure-sdk-fake", + "state": "open", + "state_reason": "reopened", + "timeline_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/2/timeline", + "title": "This is a second new issue, with labels on create", + "updated_at": "2023-01-23T18:28:39Z", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/2", + "user": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + } + }, + "repository": { + "allow_forking": true, + "archive_url": "https://api.github.com/repos/Azure/azure-sdk-fake/{archive_format}{/ref}", + "archived": false, + "assignees_url": "https://api.github.com/repos/Azure/azure-sdk-fake/assignees{/user}", + "blobs_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/blobs{/sha}", + "branches_url": "https://api.github.com/repos/Azure/azure-sdk-fake/branches{/branch}", + "clone_url": "https://github.com/Azure/azure-sdk-fake.git", + "collaborators_url": "https://api.github.com/repos/Azure/azure-sdk-fake/collaborators{/collaborator}", + "comments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/comments{/number}", + "commits_url": "https://api.github.com/repos/Azure/azure-sdk-fake/commits{/sha}", + "compare_url": "https://api.github.com/repos/Azure/azure-sdk-fake/compare/{base}...{head}", + "contents_url": "https://api.github.com/repos/Azure/azure-sdk-fake/contents/{+path}", + "contributors_url": "https://api.github.com/repos/Azure/azure-sdk-fake/contributors", + "created_at": "2022-06-27T16:19:29Z", + "default_branch": "main", + "deployments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/deployments", + "description": "Tools repository leveraged by the Azure SDK team.", + "disabled": false, + "downloads_url": "https://api.github.com/repos/Azure/azure-sdk-fake/downloads", + "events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/events", + "fork": true, + "forks": 0, + "forks_count": 0, + "forks_url": "https://api.github.com/repos/Azure/azure-sdk-fake/forks", + "full_name": "Azure/azure-sdk-fake", + "git_commits_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/commits{/sha}", + "git_refs_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/refs{/sha}", + "git_tags_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/tags{/sha}", + "git_url": "git://github.com/Azure/azure-sdk-fake.git", + "has_discussions": false, + "has_downloads": true, + "has_issues": true, + "has_pages": false, + "has_projects": true, + "has_wiki": true, + "homepage": null, + "hooks_url": "https://api.github.com/repos/Azure/azure-sdk-fake/hooks", + "html_url": "https://github.com/Azure/azure-sdk-fake", + "id": 507980610, + "is_template": false, + "issue_comment_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/comments{/number}", + "issue_events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/events{/number}", + "issues_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues{/number}", + "keys_url": "https://api.github.com/repos/Azure/azure-sdk-fake/keys{/key_id}", + "labels_url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels{/name}", + "language": "C#", + "languages_url": "https://api.github.com/repos/Azure/azure-sdk-fake/languages", + "license": { + "key": "mit", + "name": "MIT License", + "node_id": "MDc6TGljZW5zZTEz", + "spdx_id": "MIT", + "url": "https://api.github.com/licenses/mit" + }, + "merges_url": "https://api.github.com/repos/Azure/azure-sdk-fake/merges", + "milestones_url": "https://api.github.com/repos/Azure/azure-sdk-fake/milestones{/number}", + "mirror_url": null, + "name": "azure-sdk-fake", + "node_id": "R_kgDOHkcrQg", + "notifications_url": "https://api.github.com/repos/Azure/azure-sdk-fake/notifications{?since,all,participating}", + "open_issues": 5, + "open_issues_count": 5, + "owner": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + }, + "private": false, + "pulls_url": "https://api.github.com/repos/Azure/azure-sdk-fake/pulls{/number}", + "pushed_at": "2023-01-23T18:19:17Z", + "releases_url": "https://api.github.com/repos/Azure/azure-sdk-fake/releases{/id}", + "size": 29063, + "ssh_url": "git@github.com:Azure/azure-sdk-fake.git", + "stargazers_count": 0, + "stargazers_url": "https://api.github.com/repos/Azure/azure-sdk-fake/stargazers", + "statuses_url": "https://api.github.com/repos/Azure/azure-sdk-fake/statuses/{sha}", + "subscribers_url": "https://api.github.com/repos/Azure/azure-sdk-fake/subscribers", + "subscription_url": "https://api.github.com/repos/Azure/azure-sdk-fake/subscription", + "svn_url": "https://github.com/Azure/azure-sdk-fake", + "tags_url": "https://api.github.com/repos/Azure/azure-sdk-fake/tags", + "teams_url": "https://api.github.com/repos/Azure/azure-sdk-fake/teams", + "topics": [], + "trees_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/trees{/sha}", + "updated_at": "2022-12-09T16:58:56Z", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake", + "visibility": "public", + "watchers": 0, + "watchers_count": 0, + "web_commit_signoff_required": false + }, + "sender": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + } +} diff --git a/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Tests.JsonEventPayloads/ResetIssueActivity_issue_edited.json b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Tests.JsonEventPayloads/ResetIssueActivity_issue_edited.json new file mode 100644 index 00000000000..859d5f3fddf --- /dev/null +++ b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Tests.JsonEventPayloads/ResetIssueActivity_issue_edited.json @@ -0,0 +1,222 @@ +{ + "action": "edited", + "changes": { + "title": { + "from": "This is a second new issue, with labels on create" + } + }, + "issue": { + "active_lock_reason": null, + "assignee": null, + "assignees": [], + "author_association": "OWNER", + "body": null, + "closed_at": null, + "comments": 1, + "comments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/2/comments", + "created_at": "2022-10-24T16:12:11Z", + "events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/2/events", + "html_url": "https://github.com/Azure/azure-sdk-fake/issues/2", + "id": 1421080742, + "labels": [ + { + "color": "d73a4a", + "default": true, + "description": "Something isn't working", + "id": 4273699693, + "name": "bug", + "node_id": "LA_kwDOHkcrQs7-u3tt", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels/bug" + }, + { + "color": "ededed", + "default": false, + "description": null, + "id": 4704569627, + "name": "needs-triage", + "node_id": "LA_kwDOHkcrQs8AAAABGGoJGw", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels/needs-triage" + }, + { + "color": "94812F", + "default": false, + "description": "", + "id": 5070542662, + "name": "no-recent-activity", + "node_id": "LA_kwDOHkcrQs8AAAABLjpXRg", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels/no-recent-activity" + } + ], + "labels_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/2/labels{/name}", + "locked": false, + "milestone": null, + "node_id": "I_kwDOHkcrQs5Us_im", + "number": 2, + "performed_via_github_app": null, + "reactions": { + "+1": 0, + "-1": 0, + "confused": 0, + "eyes": 0, + "heart": 0, + "hooray": 0, + "laugh": 0, + "rocket": 0, + "total_count": 0, + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/2/reactions" + }, + "repository_url": "https://api.github.com/repos/Azure/azure-sdk-fake", + "state": "open", + "state_reason": "reopened", + "timeline_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/2/timeline", + "title": "This is a second new issue, with labels on create.", + "updated_at": "2023-01-23T18:32:03Z", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/2", + "user": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + } + }, + "repository": { + "allow_forking": true, + "archive_url": "https://api.github.com/repos/Azure/azure-sdk-fake/{archive_format}{/ref}", + "archived": false, + "assignees_url": "https://api.github.com/repos/Azure/azure-sdk-fake/assignees{/user}", + "blobs_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/blobs{/sha}", + "branches_url": "https://api.github.com/repos/Azure/azure-sdk-fake/branches{/branch}", + "clone_url": "https://github.com/Azure/azure-sdk-fake.git", + "collaborators_url": "https://api.github.com/repos/Azure/azure-sdk-fake/collaborators{/collaborator}", + "comments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/comments{/number}", + "commits_url": "https://api.github.com/repos/Azure/azure-sdk-fake/commits{/sha}", + "compare_url": "https://api.github.com/repos/Azure/azure-sdk-fake/compare/{base}...{head}", + "contents_url": "https://api.github.com/repos/Azure/azure-sdk-fake/contents/{+path}", + "contributors_url": "https://api.github.com/repos/Azure/azure-sdk-fake/contributors", + "created_at": "2022-06-27T16:19:29Z", + "default_branch": "main", + "deployments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/deployments", + "description": "Tools repository leveraged by the Azure SDK team.", + "disabled": false, + "downloads_url": "https://api.github.com/repos/Azure/azure-sdk-fake/downloads", + "events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/events", + "fork": true, + "forks": 0, + "forks_count": 0, + "forks_url": "https://api.github.com/repos/Azure/azure-sdk-fake/forks", + "full_name": "Azure/azure-sdk-fake", + "git_commits_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/commits{/sha}", + "git_refs_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/refs{/sha}", + "git_tags_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/tags{/sha}", + "git_url": "git://github.com/Azure/azure-sdk-fake.git", + "has_discussions": false, + "has_downloads": true, + "has_issues": true, + "has_pages": false, + "has_projects": true, + "has_wiki": true, + "homepage": null, + "hooks_url": "https://api.github.com/repos/Azure/azure-sdk-fake/hooks", + "html_url": "https://github.com/Azure/azure-sdk-fake", + "id": 507980610, + "is_template": false, + "issue_comment_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/comments{/number}", + "issue_events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/events{/number}", + "issues_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues{/number}", + "keys_url": "https://api.github.com/repos/Azure/azure-sdk-fake/keys{/key_id}", + "labels_url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels{/name}", + "language": "C#", + "languages_url": "https://api.github.com/repos/Azure/azure-sdk-fake/languages", + "license": { + "key": "mit", + "name": "MIT License", + "node_id": "MDc6TGljZW5zZTEz", + "spdx_id": "MIT", + "url": "https://api.github.com/licenses/mit" + }, + "merges_url": "https://api.github.com/repos/Azure/azure-sdk-fake/merges", + "milestones_url": "https://api.github.com/repos/Azure/azure-sdk-fake/milestones{/number}", + "mirror_url": null, + "name": "azure-sdk-fake", + "node_id": "R_kgDOHkcrQg", + "notifications_url": "https://api.github.com/repos/Azure/azure-sdk-fake/notifications{?since,all,participating}", + "open_issues": 5, + "open_issues_count": 5, + "owner": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + }, + "private": false, + "pulls_url": "https://api.github.com/repos/Azure/azure-sdk-fake/pulls{/number}", + "pushed_at": "2023-01-23T18:19:17Z", + "releases_url": "https://api.github.com/repos/Azure/azure-sdk-fake/releases{/id}", + "size": 29063, + "ssh_url": "git@github.com:Azure/azure-sdk-fake.git", + "stargazers_count": 0, + "stargazers_url": "https://api.github.com/repos/Azure/azure-sdk-fake/stargazers", + "statuses_url": "https://api.github.com/repos/Azure/azure-sdk-fake/statuses/{sha}", + "subscribers_url": "https://api.github.com/repos/Azure/azure-sdk-fake/subscribers", + "subscription_url": "https://api.github.com/repos/Azure/azure-sdk-fake/subscription", + "svn_url": "https://github.com/Azure/azure-sdk-fake", + "tags_url": "https://api.github.com/repos/Azure/azure-sdk-fake/tags", + "teams_url": "https://api.github.com/repos/Azure/azure-sdk-fake/teams", + "topics": [], + "trees_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/trees{/sha}", + "updated_at": "2022-12-09T16:58:56Z", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake", + "visibility": "public", + "watchers": 0, + "watchers_count": 0, + "web_commit_signoff_required": false + }, + "sender": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + } +} diff --git a/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Tests.JsonEventPayloads/ResetIssueActivity_issue_reopened.json b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Tests.JsonEventPayloads/ResetIssueActivity_issue_reopened.json new file mode 100644 index 00000000000..b148a114b32 --- /dev/null +++ b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Tests.JsonEventPayloads/ResetIssueActivity_issue_reopened.json @@ -0,0 +1,217 @@ +{ + "action": "reopened", + "issue": { + "active_lock_reason": null, + "assignee": null, + "assignees": [], + "author_association": "OWNER", + "body": null, + "closed_at": null, + "comments": 0, + "comments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/2/comments", + "created_at": "2022-10-24T16:12:11Z", + "events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/2/events", + "html_url": "https://github.com/Azure/azure-sdk-fake/issues/2", + "id": 1421080742, + "labels": [ + { + "color": "d73a4a", + "default": true, + "description": "Something isn't working", + "id": 4273699693, + "name": "bug", + "node_id": "LA_kwDOHkcrQs7-u3tt", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels/bug" + }, + { + "color": "ededed", + "default": false, + "description": null, + "id": 4704569627, + "name": "needs-triage", + "node_id": "LA_kwDOHkcrQs8AAAABGGoJGw", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels/needs-triage" + }, + { + "color": "94812F", + "default": false, + "description": "", + "id": 5070542662, + "name": "no-recent-activity", + "node_id": "LA_kwDOHkcrQs8AAAABLjpXRg", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels/no-recent-activity" + } + ], + "labels_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/2/labels{/name}", + "locked": false, + "milestone": null, + "node_id": "I_kwDOHkcrQs5Us_im", + "number": 2, + "performed_via_github_app": null, + "reactions": { + "+1": 0, + "-1": 0, + "confused": 0, + "eyes": 0, + "heart": 0, + "hooray": 0, + "laugh": 0, + "rocket": 0, + "total_count": 0, + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/2/reactions" + }, + "repository_url": "https://api.github.com/repos/Azure/azure-sdk-fake", + "state": "open", + "state_reason": "reopened", + "timeline_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/2/timeline", + "title": "This is a second new issue, with labels on create", + "updated_at": "2023-01-23T18:21:03Z", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/2", + "user": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + } + }, + "repository": { + "allow_forking": true, + "archive_url": "https://api.github.com/repos/Azure/azure-sdk-fake/{archive_format}{/ref}", + "archived": false, + "assignees_url": "https://api.github.com/repos/Azure/azure-sdk-fake/assignees{/user}", + "blobs_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/blobs{/sha}", + "branches_url": "https://api.github.com/repos/Azure/azure-sdk-fake/branches{/branch}", + "clone_url": "https://github.com/Azure/azure-sdk-fake.git", + "collaborators_url": "https://api.github.com/repos/Azure/azure-sdk-fake/collaborators{/collaborator}", + "comments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/comments{/number}", + "commits_url": "https://api.github.com/repos/Azure/azure-sdk-fake/commits{/sha}", + "compare_url": "https://api.github.com/repos/Azure/azure-sdk-fake/compare/{base}...{head}", + "contents_url": "https://api.github.com/repos/Azure/azure-sdk-fake/contents/{+path}", + "contributors_url": "https://api.github.com/repos/Azure/azure-sdk-fake/contributors", + "created_at": "2022-06-27T16:19:29Z", + "default_branch": "main", + "deployments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/deployments", + "description": "Tools repository leveraged by the Azure SDK team.", + "disabled": false, + "downloads_url": "https://api.github.com/repos/Azure/azure-sdk-fake/downloads", + "events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/events", + "fork": true, + "forks": 0, + "forks_count": 0, + "forks_url": "https://api.github.com/repos/Azure/azure-sdk-fake/forks", + "full_name": "Azure/azure-sdk-fake", + "git_commits_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/commits{/sha}", + "git_refs_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/refs{/sha}", + "git_tags_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/tags{/sha}", + "git_url": "git://github.com/Azure/azure-sdk-fake.git", + "has_discussions": false, + "has_downloads": true, + "has_issues": true, + "has_pages": false, + "has_projects": true, + "has_wiki": true, + "homepage": null, + "hooks_url": "https://api.github.com/repos/Azure/azure-sdk-fake/hooks", + "html_url": "https://github.com/Azure/azure-sdk-fake", + "id": 507980610, + "is_template": false, + "issue_comment_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/comments{/number}", + "issue_events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/events{/number}", + "issues_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues{/number}", + "keys_url": "https://api.github.com/repos/Azure/azure-sdk-fake/keys{/key_id}", + "labels_url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels{/name}", + "language": "C#", + "languages_url": "https://api.github.com/repos/Azure/azure-sdk-fake/languages", + "license": { + "key": "mit", + "name": "MIT License", + "node_id": "MDc6TGljZW5zZTEz", + "spdx_id": "MIT", + "url": "https://api.github.com/licenses/mit" + }, + "merges_url": "https://api.github.com/repos/Azure/azure-sdk-fake/merges", + "milestones_url": "https://api.github.com/repos/Azure/azure-sdk-fake/milestones{/number}", + "mirror_url": null, + "name": "azure-sdk-fake", + "node_id": "R_kgDOHkcrQg", + "notifications_url": "https://api.github.com/repos/Azure/azure-sdk-fake/notifications{?since,all,participating}", + "open_issues": 5, + "open_issues_count": 5, + "owner": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + }, + "private": false, + "pulls_url": "https://api.github.com/repos/Azure/azure-sdk-fake/pulls{/number}", + "pushed_at": "2023-01-23T18:19:17Z", + "releases_url": "https://api.github.com/repos/Azure/azure-sdk-fake/releases{/id}", + "size": 29063, + "ssh_url": "git@github.com:Azure/azure-sdk-fake.git", + "stargazers_count": 0, + "stargazers_url": "https://api.github.com/repos/Azure/azure-sdk-fake/stargazers", + "statuses_url": "https://api.github.com/repos/Azure/azure-sdk-fake/statuses/{sha}", + "subscribers_url": "https://api.github.com/repos/Azure/azure-sdk-fake/subscribers", + "subscription_url": "https://api.github.com/repos/Azure/azure-sdk-fake/subscription", + "svn_url": "https://github.com/Azure/azure-sdk-fake", + "tags_url": "https://api.github.com/repos/Azure/azure-sdk-fake/tags", + "teams_url": "https://api.github.com/repos/Azure/azure-sdk-fake/teams", + "topics": [], + "trees_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/trees{/sha}", + "updated_at": "2022-12-09T16:58:56Z", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake", + "visibility": "public", + "watchers": 0, + "watchers_count": 0, + "web_commit_signoff_required": false + }, + "sender": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + } +} diff --git a/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Tests.JsonEventPayloads/ResetPullRequestActivity_pr_closed_merged.json b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Tests.JsonEventPayloads/ResetPullRequestActivity_pr_closed_merged.json new file mode 100644 index 00000000000..28a9a145bfc --- /dev/null +++ b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Tests.JsonEventPayloads/ResetPullRequestActivity_pr_closed_merged.json @@ -0,0 +1,596 @@ +{ + "action": "closed", + "number": 13, + "pull_request": { + "_links": { + "comments": { + "href": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/13/comments" + }, + "commits": { + "href": "https://api.github.com/repos/Azure/azure-sdk-fake/pulls/13/commits" + }, + "html": { + "href": "https://github.com/Azure/azure-sdk-fake/pull/13" + }, + "issue": { + "href": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/13" + }, + "review_comment": { + "href": "https://api.github.com/repos/Azure/azure-sdk-fake/pulls/comments{/number}" + }, + "review_comments": { + "href": "https://api.github.com/repos/Azure/azure-sdk-fake/pulls/13/comments" + }, + "self": { + "href": "https://api.github.com/repos/Azure/azure-sdk-fake/pulls/13" + }, + "statuses": { + "href": "https://api.github.com/repos/Azure/azure-sdk-fake/statuses/c85b6a86e9702fc03e890506ab1858feec1bb86c" + } + }, + "active_lock_reason": null, + "additions": 1, + "assignee": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + }, + "assignees": [ + { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + } + ], + "author_association": "OWNER", + "auto_merge": null, + "base": { + "label": "FakeUser1:main", + "ref": "main", + "repo": { + "allow_auto_merge": true, + "allow_forking": true, + "allow_merge_commit": true, + "allow_rebase_merge": true, + "allow_squash_merge": true, + "allow_update_branch": false, + "archive_url": "https://api.github.com/repos/Azure/azure-sdk-fake/{archive_format}{/ref}", + "archived": false, + "assignees_url": "https://api.github.com/repos/Azure/azure-sdk-fake/assignees{/user}", + "blobs_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/blobs{/sha}", + "branches_url": "https://api.github.com/repos/Azure/azure-sdk-fake/branches{/branch}", + "clone_url": "https://github.com/Azure/azure-sdk-fake.git", + "collaborators_url": "https://api.github.com/repos/Azure/azure-sdk-fake/collaborators{/collaborator}", + "comments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/comments{/number}", + "commits_url": "https://api.github.com/repos/Azure/azure-sdk-fake/commits{/sha}", + "compare_url": "https://api.github.com/repos/Azure/azure-sdk-fake/compare/{base}...{head}", + "contents_url": "https://api.github.com/repos/Azure/azure-sdk-fake/contents/{+path}", + "contributors_url": "https://api.github.com/repos/Azure/azure-sdk-fake/contributors", + "created_at": "2022-06-27T16:19:29Z", + "default_branch": "main", + "delete_branch_on_merge": false, + "deployments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/deployments", + "description": "Tools repository leveraged by the Azure SDK team.", + "disabled": false, + "downloads_url": "https://api.github.com/repos/Azure/azure-sdk-fake/downloads", + "events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/events", + "fork": true, + "forks": 0, + "forks_count": 0, + "forks_url": "https://api.github.com/repos/Azure/azure-sdk-fake/forks", + "full_name": "Azure/azure-sdk-fake", + "git_commits_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/commits{/sha}", + "git_refs_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/refs{/sha}", + "git_tags_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/tags{/sha}", + "git_url": "git://github.com/Azure/azure-sdk-fake.git", + "has_discussions": false, + "has_downloads": true, + "has_issues": true, + "has_pages": false, + "has_projects": true, + "has_wiki": true, + "homepage": null, + "hooks_url": "https://api.github.com/repos/Azure/azure-sdk-fake/hooks", + "html_url": "https://github.com/Azure/azure-sdk-fake", + "id": 507980610, + "is_template": false, + "issue_comment_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/comments{/number}", + "issue_events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/events{/number}", + "issues_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues{/number}", + "keys_url": "https://api.github.com/repos/Azure/azure-sdk-fake/keys{/key_id}", + "labels_url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels{/name}", + "language": "C#", + "languages_url": "https://api.github.com/repos/Azure/azure-sdk-fake/languages", + "license": { + "key": "mit", + "name": "MIT License", + "node_id": "MDc6TGljZW5zZTEz", + "spdx_id": "MIT", + "url": "https://api.github.com/licenses/mit" + }, + "merge_commit_message": "PR_TITLE", + "merge_commit_title": "MERGE_MESSAGE", + "merges_url": "https://api.github.com/repos/Azure/azure-sdk-fake/merges", + "milestones_url": "https://api.github.com/repos/Azure/azure-sdk-fake/milestones{/number}", + "mirror_url": null, + "name": "azure-sdk-fake", + "node_id": "R_kgDOHkcrQg", + "notifications_url": "https://api.github.com/repos/Azure/azure-sdk-fake/notifications{?since,all,participating}", + "open_issues": 5, + "open_issues_count": 5, + "owner": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + }, + "private": false, + "pulls_url": "https://api.github.com/repos/Azure/azure-sdk-fake/pulls{/number}", + "pushed_at": "2023-01-26T17:28:03Z", + "releases_url": "https://api.github.com/repos/Azure/azure-sdk-fake/releases{/id}", + "size": 29084, + "squash_merge_commit_message": "COMMIT_MESSAGES", + "squash_merge_commit_title": "COMMIT_OR_PR_TITLE", + "ssh_url": "git@github.com:Azure/azure-sdk-fake.git", + "stargazers_count": 0, + "stargazers_url": "https://api.github.com/repos/Azure/azure-sdk-fake/stargazers", + "statuses_url": "https://api.github.com/repos/Azure/azure-sdk-fake/statuses/{sha}", + "subscribers_url": "https://api.github.com/repos/Azure/azure-sdk-fake/subscribers", + "subscription_url": "https://api.github.com/repos/Azure/azure-sdk-fake/subscription", + "svn_url": "https://github.com/Azure/azure-sdk-fake", + "tags_url": "https://api.github.com/repos/Azure/azure-sdk-fake/tags", + "teams_url": "https://api.github.com/repos/Azure/azure-sdk-fake/teams", + "topics": [], + "trees_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/trees{/sha}", + "updated_at": "2023-01-23T19:54:18Z", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake", + "use_squash_pr_title_as_default": false, + "visibility": "public", + "watchers": 0, + "watchers_count": 0, + "web_commit_signoff_required": false + }, + "sha": "8f28522d325b58204d844a6ae87c814e703d0afe", + "user": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + } + }, + "body": "Just a PR targeting the Azure/azure-sdk-fake fork to produce a merged event payload", + "changed_files": 1, + "closed_at": "2023-01-26T17:28:03Z", + "comments": 0, + "comments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/13/comments", + "commits": 1, + "commits_url": "https://api.github.com/repos/Azure/azure-sdk-fake/pulls/13/commits", + "created_at": "2023-01-26T17:26:42Z", + "deletions": 1, + "diff_url": "https://github.com/Azure/azure-sdk-fake/pull/13.diff", + "draft": false, + "head": { + "label": "FakeUser1:MergeTest", + "ref": "MergeTest", + "repo": { + "allow_auto_merge": true, + "allow_forking": true, + "allow_merge_commit": true, + "allow_rebase_merge": true, + "allow_squash_merge": true, + "allow_update_branch": false, + "archive_url": "https://api.github.com/repos/Azure/azure-sdk-fake/{archive_format}{/ref}", + "archived": false, + "assignees_url": "https://api.github.com/repos/Azure/azure-sdk-fake/assignees{/user}", + "blobs_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/blobs{/sha}", + "branches_url": "https://api.github.com/repos/Azure/azure-sdk-fake/branches{/branch}", + "clone_url": "https://github.com/Azure/azure-sdk-fake.git", + "collaborators_url": "https://api.github.com/repos/Azure/azure-sdk-fake/collaborators{/collaborator}", + "comments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/comments{/number}", + "commits_url": "https://api.github.com/repos/Azure/azure-sdk-fake/commits{/sha}", + "compare_url": "https://api.github.com/repos/Azure/azure-sdk-fake/compare/{base}...{head}", + "contents_url": "https://api.github.com/repos/Azure/azure-sdk-fake/contents/{+path}", + "contributors_url": "https://api.github.com/repos/Azure/azure-sdk-fake/contributors", + "created_at": "2022-06-27T16:19:29Z", + "default_branch": "main", + "delete_branch_on_merge": false, + "deployments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/deployments", + "description": "Tools repository leveraged by the Azure SDK team.", + "disabled": false, + "downloads_url": "https://api.github.com/repos/Azure/azure-sdk-fake/downloads", + "events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/events", + "fork": true, + "forks": 0, + "forks_count": 0, + "forks_url": "https://api.github.com/repos/Azure/azure-sdk-fake/forks", + "full_name": "Azure/azure-sdk-fake", + "git_commits_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/commits{/sha}", + "git_refs_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/refs{/sha}", + "git_tags_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/tags{/sha}", + "git_url": "git://github.com/Azure/azure-sdk-fake.git", + "has_discussions": false, + "has_downloads": true, + "has_issues": true, + "has_pages": false, + "has_projects": true, + "has_wiki": true, + "homepage": null, + "hooks_url": "https://api.github.com/repos/Azure/azure-sdk-fake/hooks", + "html_url": "https://github.com/Azure/azure-sdk-fake", + "id": 507980610, + "is_template": false, + "issue_comment_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/comments{/number}", + "issue_events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/events{/number}", + "issues_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues{/number}", + "keys_url": "https://api.github.com/repos/Azure/azure-sdk-fake/keys{/key_id}", + "labels_url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels{/name}", + "language": "C#", + "languages_url": "https://api.github.com/repos/Azure/azure-sdk-fake/languages", + "license": { + "key": "mit", + "name": "MIT License", + "node_id": "MDc6TGljZW5zZTEz", + "spdx_id": "MIT", + "url": "https://api.github.com/licenses/mit" + }, + "merge_commit_message": "PR_TITLE", + "merge_commit_title": "MERGE_MESSAGE", + "merges_url": "https://api.github.com/repos/Azure/azure-sdk-fake/merges", + "milestones_url": "https://api.github.com/repos/Azure/azure-sdk-fake/milestones{/number}", + "mirror_url": null, + "name": "azure-sdk-fake", + "node_id": "R_kgDOHkcrQg", + "notifications_url": "https://api.github.com/repos/Azure/azure-sdk-fake/notifications{?since,all,participating}", + "open_issues": 5, + "open_issues_count": 5, + "owner": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + }, + "private": false, + "pulls_url": "https://api.github.com/repos/Azure/azure-sdk-fake/pulls{/number}", + "pushed_at": "2023-01-26T17:28:03Z", + "releases_url": "https://api.github.com/repos/Azure/azure-sdk-fake/releases{/id}", + "size": 29084, + "squash_merge_commit_message": "COMMIT_MESSAGES", + "squash_merge_commit_title": "COMMIT_OR_PR_TITLE", + "ssh_url": "git@github.com:Azure/azure-sdk-fake.git", + "stargazers_count": 0, + "stargazers_url": "https://api.github.com/repos/Azure/azure-sdk-fake/stargazers", + "statuses_url": "https://api.github.com/repos/Azure/azure-sdk-fake/statuses/{sha}", + "subscribers_url": "https://api.github.com/repos/Azure/azure-sdk-fake/subscribers", + "subscription_url": "https://api.github.com/repos/Azure/azure-sdk-fake/subscription", + "svn_url": "https://github.com/Azure/azure-sdk-fake", + "tags_url": "https://api.github.com/repos/Azure/azure-sdk-fake/tags", + "teams_url": "https://api.github.com/repos/Azure/azure-sdk-fake/teams", + "topics": [], + "trees_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/trees{/sha}", + "updated_at": "2023-01-23T19:54:18Z", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake", + "use_squash_pr_title_as_default": false, + "visibility": "public", + "watchers": 0, + "watchers_count": 0, + "web_commit_signoff_required": false + }, + "sha": "c85b6a86e9702fc03e890506ab1858feec1bb86c", + "user": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + } + }, + "html_url": "https://github.com/Azure/azure-sdk-fake/pull/13", + "id": 1218197127, + "issue_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/13", + "labels": [ + { + "color": "94812F", + "default": false, + "description": "", + "id": 5070542662, + "name": "no-recent-activity", + "node_id": "LA_kwDOHkcrQs8AAAABLjpXRg", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels/no-recent-activity" + } + ], + "locked": false, + "maintainer_can_modify": false, + "merge_commit_sha": "9ddf41af2d1aeec63f7bb82dd9494dcbd34a3abf", + "mergeable": null, + "mergeable_state": "unknown", + "merged": true, + "merged_at": "2023-01-26T17:28:03Z", + "merged_by": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + }, + "milestone": null, + "node_id": "PR_kwDOHkcrQs5InDaH", + "number": 13, + "patch_url": "https://github.com/Azure/azure-sdk-fake/pull/13.patch", + "rebaseable": null, + "requested_reviewers": [ + { + "avatar_url": "https://avatars.githubusercontent.com/u/913445?v=4", + "events_url": "https://api.github.com/users/FakeUser2/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser2/followers", + "following_url": "https://api.github.com/users/FakeUser2/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser2/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser2", + "id": 913445, + "login": "FakeUser2", + "node_id": "MDQ6VXNlcjkxMzQ0NQ==", + "organizations_url": "https://api.github.com/users/FakeUser2/orgs", + "received_events_url": "https://api.github.com/users/FakeUser2/received_events", + "repos_url": "https://api.github.com/users/FakeUser2/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser2/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser2/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser2" + } + ], + "requested_teams": [], + "review_comment_url": "https://api.github.com/repos/Azure/azure-sdk-fake/pulls/comments{/number}", + "review_comments": 0, + "review_comments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/pulls/13/comments", + "state": "closed", + "statuses_url": "https://api.github.com/repos/Azure/azure-sdk-fake/statuses/c85b6a86e9702fc03e890506ab1858feec1bb86c", + "title": "PR to create merge payload", + "updated_at": "2023-01-26T17:28:03Z", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/pulls/13", + "user": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + } + }, + "repository": { + "allow_forking": true, + "archive_url": "https://api.github.com/repos/Azure/azure-sdk-fake/{archive_format}{/ref}", + "archived": false, + "assignees_url": "https://api.github.com/repos/Azure/azure-sdk-fake/assignees{/user}", + "blobs_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/blobs{/sha}", + "branches_url": "https://api.github.com/repos/Azure/azure-sdk-fake/branches{/branch}", + "clone_url": "https://github.com/Azure/azure-sdk-fake.git", + "collaborators_url": "https://api.github.com/repos/Azure/azure-sdk-fake/collaborators{/collaborator}", + "comments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/comments{/number}", + "commits_url": "https://api.github.com/repos/Azure/azure-sdk-fake/commits{/sha}", + "compare_url": "https://api.github.com/repos/Azure/azure-sdk-fake/compare/{base}...{head}", + "contents_url": "https://api.github.com/repos/Azure/azure-sdk-fake/contents/{+path}", + "contributors_url": "https://api.github.com/repos/Azure/azure-sdk-fake/contributors", + "created_at": "2022-06-27T16:19:29Z", + "default_branch": "main", + "deployments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/deployments", + "description": "Tools repository leveraged by the Azure SDK team.", + "disabled": false, + "downloads_url": "https://api.github.com/repos/Azure/azure-sdk-fake/downloads", + "events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/events", + "fork": true, + "forks": 0, + "forks_count": 0, + "forks_url": "https://api.github.com/repos/Azure/azure-sdk-fake/forks", + "full_name": "Azure/azure-sdk-fake", + "git_commits_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/commits{/sha}", + "git_refs_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/refs{/sha}", + "git_tags_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/tags{/sha}", + "git_url": "git://github.com/Azure/azure-sdk-fake.git", + "has_discussions": false, + "has_downloads": true, + "has_issues": true, + "has_pages": false, + "has_projects": true, + "has_wiki": true, + "homepage": null, + "hooks_url": "https://api.github.com/repos/Azure/azure-sdk-fake/hooks", + "html_url": "https://github.com/Azure/azure-sdk-fake", + "id": 507980610, + "is_template": false, + "issue_comment_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/comments{/number}", + "issue_events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/events{/number}", + "issues_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues{/number}", + "keys_url": "https://api.github.com/repos/Azure/azure-sdk-fake/keys{/key_id}", + "labels_url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels{/name}", + "language": "C#", + "languages_url": "https://api.github.com/repos/Azure/azure-sdk-fake/languages", + "license": { + "key": "mit", + "name": "MIT License", + "node_id": "MDc6TGljZW5zZTEz", + "spdx_id": "MIT", + "url": "https://api.github.com/licenses/mit" + }, + "merges_url": "https://api.github.com/repos/Azure/azure-sdk-fake/merges", + "milestones_url": "https://api.github.com/repos/Azure/azure-sdk-fake/milestones{/number}", + "mirror_url": null, + "name": "azure-sdk-fake", + "node_id": "R_kgDOHkcrQg", + "notifications_url": "https://api.github.com/repos/Azure/azure-sdk-fake/notifications{?since,all,participating}", + "open_issues": 5, + "open_issues_count": 5, + "owner": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + }, + "private": false, + "pulls_url": "https://api.github.com/repos/Azure/azure-sdk-fake/pulls{/number}", + "pushed_at": "2023-01-26T17:28:03Z", + "releases_url": "https://api.github.com/repos/Azure/azure-sdk-fake/releases{/id}", + "size": 29084, + "ssh_url": "git@github.com:Azure/azure-sdk-fake.git", + "stargazers_count": 0, + "stargazers_url": "https://api.github.com/repos/Azure/azure-sdk-fake/stargazers", + "statuses_url": "https://api.github.com/repos/Azure/azure-sdk-fake/statuses/{sha}", + "subscribers_url": "https://api.github.com/repos/Azure/azure-sdk-fake/subscribers", + "subscription_url": "https://api.github.com/repos/Azure/azure-sdk-fake/subscription", + "svn_url": "https://github.com/Azure/azure-sdk-fake", + "tags_url": "https://api.github.com/repos/Azure/azure-sdk-fake/tags", + "teams_url": "https://api.github.com/repos/Azure/azure-sdk-fake/teams", + "topics": [], + "trees_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/trees{/sha}", + "updated_at": "2023-01-23T19:54:18Z", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake", + "visibility": "public", + "watchers": 0, + "watchers_count": 0, + "web_commit_signoff_required": false + }, + "sender": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + } +} diff --git a/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Tests.JsonEventPayloads/ResetPullRequestActivity_pr_comment_created_creator_is_author.json b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Tests.JsonEventPayloads/ResetPullRequestActivity_pr_comment_created_creator_is_author.json new file mode 100644 index 00000000000..9d3dcaa6aac --- /dev/null +++ b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Tests.JsonEventPayloads/ResetPullRequestActivity_pr_comment_created_creator_is_author.json @@ -0,0 +1,291 @@ +{ + "action": "created", + "comment": { + "author_association": "OWNER", + "body": "This is a comment to generate a payload for ResetPullRequestActivity static test", + "created_at": "2023-01-24T20:10:25Z", + "html_url": "https://github.com/Azure/azure-sdk-fake/pull/7#issuecomment-1402562524", + "id": 1402562524, + "issue_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/7", + "node_id": "IC_kwDOHkcrQs5TmWfc", + "performed_via_github_app": null, + "reactions": { + "+1": 0, + "-1": 0, + "confused": 0, + "eyes": 0, + "heart": 0, + "hooray": 0, + "laugh": 0, + "rocket": 0, + "total_count": 0, + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/comments/1402562524/reactions" + }, + "updated_at": "2023-01-24T20:10:25Z", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/comments/1402562524", + "user": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser2/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser2/followers", + "following_url": "https://api.github.com/users/FakeUser2/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser2/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser2", + "id": 13556087, + "login": "FakeUser2", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser2/orgs", + "received_events_url": "https://api.github.com/users/FakeUser2/received_events", + "repos_url": "https://api.github.com/users/FakeUser2/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser2/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser2/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser2" + } + }, + "issue": { + "active_lock_reason": null, + "assignee": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + }, + "assignees": [ + { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + } + ], + "author_association": "OWNER", + "body": "This will never be checked in", + "closed_at": "2022-11-01T20:24:26Z", + "comments": 2, + "comments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/7/comments", + "created_at": "2022-11-01T18:40:07Z", + "draft": false, + "events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/7/events", + "html_url": "https://github.com/Azure/azure-sdk-fake/pull/7", + "id": 1431900846, + "labels": [ + { + "color": "94812F", + "default": false, + "description": "", + "id": 5070542662, + "name": "no-recent-activity", + "node_id": "LA_kwDOHkcrQs8AAAABLjpXRg", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels/no-recent-activity" + } + ], + "labels_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/7/labels{/name}", + "locked": false, + "milestone": null, + "node_id": "PR_kwDOHkcrQs5B_eUa", + "number": 7, + "performed_via_github_app": null, + "pull_request": { + "diff_url": "https://github.com/Azure/azure-sdk-fake/pull/7.diff", + "html_url": "https://github.com/Azure/azure-sdk-fake/pull/7", + "merged_at": null, + "patch_url": "https://github.com/Azure/azure-sdk-fake/pull/7.patch", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/pulls/7" + }, + "reactions": { + "+1": 0, + "-1": 0, + "confused": 0, + "eyes": 0, + "heart": 0, + "hooray": 0, + "laugh": 0, + "rocket": 0, + "total_count": 0, + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/7/reactions" + }, + "repository_url": "https://api.github.com/repos/Azure/azure-sdk-fake", + "state": "open", + "state_reason": null, + "timeline_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/7/timeline", + "title": "Will never be checked in", + "updated_at": "2023-01-24T20:10:25Z", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/7", + "user": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + } + }, + "repository": { + "allow_forking": true, + "archive_url": "https://api.github.com/repos/Azure/azure-sdk-fake/{archive_format}{/ref}", + "archived": false, + "assignees_url": "https://api.github.com/repos/Azure/azure-sdk-fake/assignees{/user}", + "blobs_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/blobs{/sha}", + "branches_url": "https://api.github.com/repos/Azure/azure-sdk-fake/branches{/branch}", + "clone_url": "https://github.com/Azure/azure-sdk-fake.git", + "collaborators_url": "https://api.github.com/repos/Azure/azure-sdk-fake/collaborators{/collaborator}", + "comments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/comments{/number}", + "commits_url": "https://api.github.com/repos/Azure/azure-sdk-fake/commits{/sha}", + "compare_url": "https://api.github.com/repos/Azure/azure-sdk-fake/compare/{base}...{head}", + "contents_url": "https://api.github.com/repos/Azure/azure-sdk-fake/contents/{+path}", + "contributors_url": "https://api.github.com/repos/Azure/azure-sdk-fake/contributors", + "created_at": "2022-06-27T16:19:29Z", + "default_branch": "main", + "deployments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/deployments", + "description": "Tools repository leveraged by the Azure SDK team.", + "disabled": false, + "downloads_url": "https://api.github.com/repos/Azure/azure-sdk-fake/downloads", + "events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/events", + "fork": true, + "forks": 0, + "forks_count": 0, + "forks_url": "https://api.github.com/repos/Azure/azure-sdk-fake/forks", + "full_name": "Azure/azure-sdk-fake", + "git_commits_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/commits{/sha}", + "git_refs_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/refs{/sha}", + "git_tags_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/tags{/sha}", + "git_url": "git://github.com/Azure/azure-sdk-fake.git", + "has_discussions": false, + "has_downloads": true, + "has_issues": true, + "has_pages": false, + "has_projects": true, + "has_wiki": true, + "homepage": null, + "hooks_url": "https://api.github.com/repos/Azure/azure-sdk-fake/hooks", + "html_url": "https://github.com/Azure/azure-sdk-fake", + "id": 507980610, + "is_template": false, + "issue_comment_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/comments{/number}", + "issue_events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/events{/number}", + "issues_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues{/number}", + "keys_url": "https://api.github.com/repos/Azure/azure-sdk-fake/keys{/key_id}", + "labels_url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels{/name}", + "language": "C#", + "languages_url": "https://api.github.com/repos/Azure/azure-sdk-fake/languages", + "license": { + "key": "mit", + "name": "MIT License", + "node_id": "MDc6TGljZW5zZTEz", + "spdx_id": "MIT", + "url": "https://api.github.com/licenses/mit" + }, + "merges_url": "https://api.github.com/repos/Azure/azure-sdk-fake/merges", + "milestones_url": "https://api.github.com/repos/Azure/azure-sdk-fake/milestones{/number}", + "mirror_url": null, + "name": "azure-sdk-fake", + "node_id": "R_kgDOHkcrQg", + "notifications_url": "https://api.github.com/repos/Azure/azure-sdk-fake/notifications{?since,all,participating}", + "open_issues": 5, + "open_issues_count": 5, + "owner": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + }, + "private": false, + "pulls_url": "https://api.github.com/repos/Azure/azure-sdk-fake/pulls{/number}", + "pushed_at": "2023-01-23T20:07:27Z", + "releases_url": "https://api.github.com/repos/Azure/azure-sdk-fake/releases{/id}", + "size": 29059, + "ssh_url": "git@github.com:Azure/azure-sdk-fake.git", + "stargazers_count": 0, + "stargazers_url": "https://api.github.com/repos/Azure/azure-sdk-fake/stargazers", + "statuses_url": "https://api.github.com/repos/Azure/azure-sdk-fake/statuses/{sha}", + "subscribers_url": "https://api.github.com/repos/Azure/azure-sdk-fake/subscribers", + "subscription_url": "https://api.github.com/repos/Azure/azure-sdk-fake/subscription", + "svn_url": "https://github.com/Azure/azure-sdk-fake", + "tags_url": "https://api.github.com/repos/Azure/azure-sdk-fake/tags", + "teams_url": "https://api.github.com/repos/Azure/azure-sdk-fake/teams", + "topics": [], + "trees_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/trees{/sha}", + "updated_at": "2023-01-23T19:54:18Z", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake", + "visibility": "public", + "watchers": 0, + "watchers_count": 0, + "web_commit_signoff_required": false + }, + "sender": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + } +} \ No newline at end of file diff --git a/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Tests.JsonEventPayloads/ResetPullRequestActivity_pr_comment_created_creator_is_not_author.json b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Tests.JsonEventPayloads/ResetPullRequestActivity_pr_comment_created_creator_is_not_author.json new file mode 100644 index 00000000000..8892f0d5cd6 --- /dev/null +++ b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Tests.JsonEventPayloads/ResetPullRequestActivity_pr_comment_created_creator_is_not_author.json @@ -0,0 +1,291 @@ +{ + "action": "created", + "comment": { + "author_association": "OWNER", + "body": "This is a comment to generate a payload for ResetPullRequestActivity static test", + "created_at": "2023-01-24T20:10:25Z", + "html_url": "https://github.com/Azure/azure-sdk-fake/pull/7#issuecomment-1402562524", + "id": 1402562524, + "issue_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/7", + "node_id": "IC_kwDOHkcrQs5TmWfc", + "performed_via_github_app": null, + "reactions": { + "+1": 0, + "-1": 0, + "confused": 0, + "eyes": 0, + "heart": 0, + "hooray": 0, + "laugh": 0, + "rocket": 0, + "total_count": 0, + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/comments/1402562524/reactions" + }, + "updated_at": "2023-01-24T20:10:25Z", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/comments/1402562524", + "user": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser2/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser2/followers", + "following_url": "https://api.github.com/users/FakeUser2/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser2/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser2", + "id": 13556087, + "login": "FakeUser2", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser2/orgs", + "received_events_url": "https://api.github.com/users/FakeUser2/received_events", + "repos_url": "https://api.github.com/users/FakeUser2/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser2/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser2/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser2" + } + }, + "issue": { + "active_lock_reason": null, + "assignee": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + }, + "assignees": [ + { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + } + ], + "author_association": "OWNER", + "body": "This will never be checked in", + "closed_at": "2022-11-01T20:24:26Z", + "comments": 2, + "comments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/7/comments", + "created_at": "2022-11-01T18:40:07Z", + "draft": false, + "events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/7/events", + "html_url": "https://github.com/Azure/azure-sdk-fake/pull/7", + "id": 1431900846, + "labels": [ + { + "color": "94812F", + "default": false, + "description": "", + "id": 5070542662, + "name": "no-recent-activity", + "node_id": "LA_kwDOHkcrQs8AAAABLjpXRg", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels/no-recent-activity" + } + ], + "labels_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/7/labels{/name}", + "locked": false, + "milestone": null, + "node_id": "PR_kwDOHkcrQs5B_eUa", + "number": 7, + "performed_via_github_app": null, + "pull_request": { + "diff_url": "https://github.com/Azure/azure-sdk-fake/pull/7.diff", + "html_url": "https://github.com/Azure/azure-sdk-fake/pull/7", + "merged_at": null, + "patch_url": "https://github.com/Azure/azure-sdk-fake/pull/7.patch", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/pulls/7" + }, + "reactions": { + "+1": 0, + "-1": 0, + "confused": 0, + "eyes": 0, + "heart": 0, + "hooray": 0, + "laugh": 0, + "rocket": 0, + "total_count": 0, + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/7/reactions" + }, + "repository_url": "https://api.github.com/repos/Azure/azure-sdk-fake", + "state": "open", + "state_reason": null, + "timeline_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/7/timeline", + "title": "Will never be checked in", + "updated_at": "2023-01-24T20:10:25Z", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/7", + "user": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + } + }, + "repository": { + "allow_forking": true, + "archive_url": "https://api.github.com/repos/Azure/azure-sdk-fake/{archive_format}{/ref}", + "archived": false, + "assignees_url": "https://api.github.com/repos/Azure/azure-sdk-fake/assignees{/user}", + "blobs_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/blobs{/sha}", + "branches_url": "https://api.github.com/repos/Azure/azure-sdk-fake/branches{/branch}", + "clone_url": "https://github.com/Azure/azure-sdk-fake.git", + "collaborators_url": "https://api.github.com/repos/Azure/azure-sdk-fake/collaborators{/collaborator}", + "comments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/comments{/number}", + "commits_url": "https://api.github.com/repos/Azure/azure-sdk-fake/commits{/sha}", + "compare_url": "https://api.github.com/repos/Azure/azure-sdk-fake/compare/{base}...{head}", + "contents_url": "https://api.github.com/repos/Azure/azure-sdk-fake/contents/{+path}", + "contributors_url": "https://api.github.com/repos/Azure/azure-sdk-fake/contributors", + "created_at": "2022-06-27T16:19:29Z", + "default_branch": "main", + "deployments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/deployments", + "description": "Tools repository leveraged by the Azure SDK team.", + "disabled": false, + "downloads_url": "https://api.github.com/repos/Azure/azure-sdk-fake/downloads", + "events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/events", + "fork": true, + "forks": 0, + "forks_count": 0, + "forks_url": "https://api.github.com/repos/Azure/azure-sdk-fake/forks", + "full_name": "Azure/azure-sdk-fake", + "git_commits_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/commits{/sha}", + "git_refs_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/refs{/sha}", + "git_tags_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/tags{/sha}", + "git_url": "git://github.com/Azure/azure-sdk-fake.git", + "has_discussions": false, + "has_downloads": true, + "has_issues": true, + "has_pages": false, + "has_projects": true, + "has_wiki": true, + "homepage": null, + "hooks_url": "https://api.github.com/repos/Azure/azure-sdk-fake/hooks", + "html_url": "https://github.com/Azure/azure-sdk-fake", + "id": 507980610, + "is_template": false, + "issue_comment_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/comments{/number}", + "issue_events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/events{/number}", + "issues_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues{/number}", + "keys_url": "https://api.github.com/repos/Azure/azure-sdk-fake/keys{/key_id}", + "labels_url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels{/name}", + "language": "C#", + "languages_url": "https://api.github.com/repos/Azure/azure-sdk-fake/languages", + "license": { + "key": "mit", + "name": "MIT License", + "node_id": "MDc6TGljZW5zZTEz", + "spdx_id": "MIT", + "url": "https://api.github.com/licenses/mit" + }, + "merges_url": "https://api.github.com/repos/Azure/azure-sdk-fake/merges", + "milestones_url": "https://api.github.com/repos/Azure/azure-sdk-fake/milestones{/number}", + "mirror_url": null, + "name": "azure-sdk-fake", + "node_id": "R_kgDOHkcrQg", + "notifications_url": "https://api.github.com/repos/Azure/azure-sdk-fake/notifications{?since,all,participating}", + "open_issues": 5, + "open_issues_count": 5, + "owner": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + }, + "private": false, + "pulls_url": "https://api.github.com/repos/Azure/azure-sdk-fake/pulls{/number}", + "pushed_at": "2023-01-23T20:07:27Z", + "releases_url": "https://api.github.com/repos/Azure/azure-sdk-fake/releases{/id}", + "size": 29059, + "ssh_url": "git@github.com:Azure/azure-sdk-fake.git", + "stargazers_count": 0, + "stargazers_url": "https://api.github.com/repos/Azure/azure-sdk-fake/stargazers", + "statuses_url": "https://api.github.com/repos/Azure/azure-sdk-fake/statuses/{sha}", + "subscribers_url": "https://api.github.com/repos/Azure/azure-sdk-fake/subscribers", + "subscription_url": "https://api.github.com/repos/Azure/azure-sdk-fake/subscription", + "svn_url": "https://github.com/Azure/azure-sdk-fake", + "tags_url": "https://api.github.com/repos/Azure/azure-sdk-fake/tags", + "teams_url": "https://api.github.com/repos/Azure/azure-sdk-fake/teams", + "topics": [], + "trees_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/trees{/sha}", + "updated_at": "2023-01-23T19:54:18Z", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake", + "visibility": "public", + "watchers": 0, + "watchers_count": 0, + "web_commit_signoff_required": false + }, + "sender": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser2/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser2/followers", + "following_url": "https://api.github.com/users/FakeUser2/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser2/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser2", + "id": 13556087, + "login": "FakeUser2", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser2/orgs", + "received_events_url": "https://api.github.com/users/FakeUser2/received_events", + "repos_url": "https://api.github.com/users/FakeUser2/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser2/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser2/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser2" + } +} \ No newline at end of file diff --git a/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Tests.JsonEventPayloads/ResetPullRequestActivity_pr_reopened.json b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Tests.JsonEventPayloads/ResetPullRequestActivity_pr_reopened.json new file mode 100644 index 00000000000..a7782701d51 --- /dev/null +++ b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Tests.JsonEventPayloads/ResetPullRequestActivity_pr_reopened.json @@ -0,0 +1,586 @@ +{ + "action": "reopened", + "number": 10, + "pull_request": { + "_links": { + "comments": { + "href": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/10/comments" + }, + "commits": { + "href": "https://api.github.com/repos/Azure/azure-sdk-fake/pulls/10/commits" + }, + "html": { + "href": "https://github.com/Azure/azure-sdk-fake/pull/10" + }, + "issue": { + "href": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/10" + }, + "review_comment": { + "href": "https://api.github.com/repos/Azure/azure-sdk-fake/pulls/comments{/number}" + }, + "review_comments": { + "href": "https://api.github.com/repos/Azure/azure-sdk-fake/pulls/10/comments" + }, + "self": { + "href": "https://api.github.com/repos/Azure/azure-sdk-fake/pulls/10" + }, + "statuses": { + "href": "https://api.github.com/repos/Azure/azure-sdk-fake/statuses/7567393d7d487c62c85ce2c58fb47a4ff52b2f2c" + } + }, + "active_lock_reason": null, + "additions": 1, + "assignee": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + }, + "assignees": [ + { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + } + ], + "author_association": "OWNER", + "auto_merge": null, + "base": { + "label": "FakeUser1:main", + "ref": "main", + "repo": { + "allow_auto_merge": true, + "allow_forking": true, + "allow_merge_commit": true, + "allow_rebase_merge": true, + "allow_squash_merge": true, + "allow_update_branch": false, + "archive_url": "https://api.github.com/repos/Azure/azure-sdk-fake/{archive_format}{/ref}", + "archived": false, + "assignees_url": "https://api.github.com/repos/Azure/azure-sdk-fake/assignees{/user}", + "blobs_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/blobs{/sha}", + "branches_url": "https://api.github.com/repos/Azure/azure-sdk-fake/branches{/branch}", + "clone_url": "https://github.com/Azure/azure-sdk-fake.git", + "collaborators_url": "https://api.github.com/repos/Azure/azure-sdk-fake/collaborators{/collaborator}", + "comments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/comments{/number}", + "commits_url": "https://api.github.com/repos/Azure/azure-sdk-fake/commits{/sha}", + "compare_url": "https://api.github.com/repos/Azure/azure-sdk-fake/compare/{base}...{head}", + "contents_url": "https://api.github.com/repos/Azure/azure-sdk-fake/contents/{+path}", + "contributors_url": "https://api.github.com/repos/Azure/azure-sdk-fake/contributors", + "created_at": "2022-06-27T16:19:29Z", + "default_branch": "main", + "delete_branch_on_merge": false, + "deployments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/deployments", + "description": "Tools repository leveraged by the Azure SDK team.", + "disabled": false, + "downloads_url": "https://api.github.com/repos/Azure/azure-sdk-fake/downloads", + "events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/events", + "fork": true, + "forks": 0, + "forks_count": 0, + "forks_url": "https://api.github.com/repos/Azure/azure-sdk-fake/forks", + "full_name": "Azure/azure-sdk-fake", + "git_commits_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/commits{/sha}", + "git_refs_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/refs{/sha}", + "git_tags_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/tags{/sha}", + "git_url": "git://github.com/Azure/azure-sdk-fake.git", + "has_discussions": false, + "has_downloads": true, + "has_issues": true, + "has_pages": false, + "has_projects": true, + "has_wiki": true, + "homepage": null, + "hooks_url": "https://api.github.com/repos/Azure/azure-sdk-fake/hooks", + "html_url": "https://github.com/Azure/azure-sdk-fake", + "id": 507980610, + "is_template": false, + "issue_comment_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/comments{/number}", + "issue_events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/events{/number}", + "issues_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues{/number}", + "keys_url": "https://api.github.com/repos/Azure/azure-sdk-fake/keys{/key_id}", + "labels_url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels{/name}", + "language": "C#", + "languages_url": "https://api.github.com/repos/Azure/azure-sdk-fake/languages", + "license": { + "key": "mit", + "name": "MIT License", + "node_id": "MDc6TGljZW5zZTEz", + "spdx_id": "MIT", + "url": "https://api.github.com/licenses/mit" + }, + "merge_commit_message": "PR_TITLE", + "merge_commit_title": "MERGE_MESSAGE", + "merges_url": "https://api.github.com/repos/Azure/azure-sdk-fake/merges", + "milestones_url": "https://api.github.com/repos/Azure/azure-sdk-fake/milestones{/number}", + "mirror_url": null, + "name": "azure-sdk-fake", + "node_id": "R_kgDOHkcrQg", + "notifications_url": "https://api.github.com/repos/Azure/azure-sdk-fake/notifications{?since,all,participating}", + "open_issues": 5, + "open_issues_count": 5, + "owner": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + }, + "private": false, + "pulls_url": "https://api.github.com/repos/Azure/azure-sdk-fake/pulls{/number}", + "pushed_at": "2023-01-23T20:07:27Z", + "releases_url": "https://api.github.com/repos/Azure/azure-sdk-fake/releases{/id}", + "size": 29059, + "squash_merge_commit_message": "COMMIT_MESSAGES", + "squash_merge_commit_title": "COMMIT_OR_PR_TITLE", + "ssh_url": "git@github.com:Azure/azure-sdk-fake.git", + "stargazers_count": 0, + "stargazers_url": "https://api.github.com/repos/Azure/azure-sdk-fake/stargazers", + "statuses_url": "https://api.github.com/repos/Azure/azure-sdk-fake/statuses/{sha}", + "subscribers_url": "https://api.github.com/repos/Azure/azure-sdk-fake/subscribers", + "subscription_url": "https://api.github.com/repos/Azure/azure-sdk-fake/subscription", + "svn_url": "https://github.com/Azure/azure-sdk-fake", + "tags_url": "https://api.github.com/repos/Azure/azure-sdk-fake/tags", + "teams_url": "https://api.github.com/repos/Azure/azure-sdk-fake/teams", + "topics": [], + "trees_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/trees{/sha}", + "updated_at": "2023-01-23T19:54:18Z", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake", + "use_squash_pr_title_as_default": false, + "visibility": "public", + "watchers": 0, + "watchers_count": 0, + "web_commit_signoff_required": false + }, + "sha": "1116f5a0f2ec285febd3a584b3f759cab57d7e03", + "user": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + } + }, + "body": "This PR is for testing purposes only", + "changed_files": 1, + "closed_at": null, + "comments": 0, + "comments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/10/comments", + "commits": 3, + "commits_url": "https://api.github.com/repos/Azure/azure-sdk-fake/pulls/10/commits", + "created_at": "2022-11-11T17:00:28Z", + "deletions": 1, + "diff_url": "https://github.com/Azure/azure-sdk-fake/pull/10.diff", + "draft": false, + "head": { + "label": "FakeUser1:AnotherTestPR", + "ref": "AnotherTestPR", + "repo": { + "allow_auto_merge": true, + "allow_forking": true, + "allow_merge_commit": true, + "allow_rebase_merge": true, + "allow_squash_merge": true, + "allow_update_branch": false, + "archive_url": "https://api.github.com/repos/Azure/azure-sdk-fake/{archive_format}{/ref}", + "archived": false, + "assignees_url": "https://api.github.com/repos/Azure/azure-sdk-fake/assignees{/user}", + "blobs_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/blobs{/sha}", + "branches_url": "https://api.github.com/repos/Azure/azure-sdk-fake/branches{/branch}", + "clone_url": "https://github.com/Azure/azure-sdk-fake.git", + "collaborators_url": "https://api.github.com/repos/Azure/azure-sdk-fake/collaborators{/collaborator}", + "comments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/comments{/number}", + "commits_url": "https://api.github.com/repos/Azure/azure-sdk-fake/commits{/sha}", + "compare_url": "https://api.github.com/repos/Azure/azure-sdk-fake/compare/{base}...{head}", + "contents_url": "https://api.github.com/repos/Azure/azure-sdk-fake/contents/{+path}", + "contributors_url": "https://api.github.com/repos/Azure/azure-sdk-fake/contributors", + "created_at": "2022-06-27T16:19:29Z", + "default_branch": "main", + "delete_branch_on_merge": false, + "deployments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/deployments", + "description": "Tools repository leveraged by the Azure SDK team.", + "disabled": false, + "downloads_url": "https://api.github.com/repos/Azure/azure-sdk-fake/downloads", + "events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/events", + "fork": true, + "forks": 0, + "forks_count": 0, + "forks_url": "https://api.github.com/repos/Azure/azure-sdk-fake/forks", + "full_name": "Azure/azure-sdk-fake", + "git_commits_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/commits{/sha}", + "git_refs_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/refs{/sha}", + "git_tags_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/tags{/sha}", + "git_url": "git://github.com/Azure/azure-sdk-fake.git", + "has_discussions": false, + "has_downloads": true, + "has_issues": true, + "has_pages": false, + "has_projects": true, + "has_wiki": true, + "homepage": null, + "hooks_url": "https://api.github.com/repos/Azure/azure-sdk-fake/hooks", + "html_url": "https://github.com/Azure/azure-sdk-fake", + "id": 507980610, + "is_template": false, + "issue_comment_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/comments{/number}", + "issue_events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/events{/number}", + "issues_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues{/number}", + "keys_url": "https://api.github.com/repos/Azure/azure-sdk-fake/keys{/key_id}", + "labels_url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels{/name}", + "language": "C#", + "languages_url": "https://api.github.com/repos/Azure/azure-sdk-fake/languages", + "license": { + "key": "mit", + "name": "MIT License", + "node_id": "MDc6TGljZW5zZTEz", + "spdx_id": "MIT", + "url": "https://api.github.com/licenses/mit" + }, + "merge_commit_message": "PR_TITLE", + "merge_commit_title": "MERGE_MESSAGE", + "merges_url": "https://api.github.com/repos/Azure/azure-sdk-fake/merges", + "milestones_url": "https://api.github.com/repos/Azure/azure-sdk-fake/milestones{/number}", + "mirror_url": null, + "name": "azure-sdk-fake", + "node_id": "R_kgDOHkcrQg", + "notifications_url": "https://api.github.com/repos/Azure/azure-sdk-fake/notifications{?since,all,participating}", + "open_issues": 5, + "open_issues_count": 5, + "owner": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + }, + "private": false, + "pulls_url": "https://api.github.com/repos/Azure/azure-sdk-fake/pulls{/number}", + "pushed_at": "2023-01-23T20:07:27Z", + "releases_url": "https://api.github.com/repos/Azure/azure-sdk-fake/releases{/id}", + "size": 29059, + "squash_merge_commit_message": "COMMIT_MESSAGES", + "squash_merge_commit_title": "COMMIT_OR_PR_TITLE", + "ssh_url": "git@github.com:Azure/azure-sdk-fake.git", + "stargazers_count": 0, + "stargazers_url": "https://api.github.com/repos/Azure/azure-sdk-fake/stargazers", + "statuses_url": "https://api.github.com/repos/Azure/azure-sdk-fake/statuses/{sha}", + "subscribers_url": "https://api.github.com/repos/Azure/azure-sdk-fake/subscribers", + "subscription_url": "https://api.github.com/repos/Azure/azure-sdk-fake/subscription", + "svn_url": "https://github.com/Azure/azure-sdk-fake", + "tags_url": "https://api.github.com/repos/Azure/azure-sdk-fake/tags", + "teams_url": "https://api.github.com/repos/Azure/azure-sdk-fake/teams", + "topics": [], + "trees_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/trees{/sha}", + "updated_at": "2023-01-23T19:54:18Z", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake", + "use_squash_pr_title_as_default": false, + "visibility": "public", + "watchers": 0, + "watchers_count": 0, + "web_commit_signoff_required": false + }, + "sha": "7567393d7d487c62c85ce2c58fb47a4ff52b2f2c", + "user": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + } + }, + "html_url": "https://github.com/Azure/azure-sdk-fake/pull/10", + "id": 1119343007, + "issue_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/10", + "labels": [ + { + "color": "d73a4a", + "default": true, + "description": "Something isn't working", + "id": 4273699693, + "name": "bug", + "node_id": "LA_kwDOHkcrQs7-u3tt", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels/bug" + }, + { + "color": "94812F", + "default": false, + "description": "", + "id": 5070542662, + "name": "no-recent-activity", + "node_id": "LA_kwDOHkcrQs8AAAABLjpXRg", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels/no-recent-activity" + } + ], + "locked": false, + "maintainer_can_modify": false, + "merge_commit_sha": "d207bc4195108de7ae3212fab28d69552361b02d", + "mergeable": null, + "mergeable_state": "unknown", + "merged": false, + "merged_at": null, + "merged_by": null, + "milestone": null, + "node_id": "PR_kwDOHkcrQs5Ct9Gf", + "number": 10, + "patch_url": "https://github.com/Azure/azure-sdk-fake/pull/10.patch", + "rebaseable": null, + "requested_reviewers": [ + { + "avatar_url": "https://avatars.githubusercontent.com/u/913445?v=4", + "events_url": "https://api.github.com/users/FakeUser2/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser2/followers", + "following_url": "https://api.github.com/users/FakeUser2/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser2/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser2", + "id": 913445, + "login": "FakeUser2", + "node_id": "MDQ6VXNlcjkxMzQ0NQ==", + "organizations_url": "https://api.github.com/users/FakeUser2/orgs", + "received_events_url": "https://api.github.com/users/FakeUser2/received_events", + "repos_url": "https://api.github.com/users/FakeUser2/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser2/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser2/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser2" + } + ], + "requested_teams": [], + "review_comment_url": "https://api.github.com/repos/Azure/azure-sdk-fake/pulls/comments{/number}", + "review_comments": 1, + "review_comments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/pulls/10/comments", + "state": "open", + "statuses_url": "https://api.github.com/repos/Azure/azure-sdk-fake/statuses/7567393d7d487c62c85ce2c58fb47a4ff52b2f2c", + "title": "PR for event testing only", + "updated_at": "2023-01-24T23:13:00Z", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/pulls/10", + "user": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + } + }, + "repository": { + "allow_forking": true, + "archive_url": "https://api.github.com/repos/Azure/azure-sdk-fake/{archive_format}{/ref}", + "archived": false, + "assignees_url": "https://api.github.com/repos/Azure/azure-sdk-fake/assignees{/user}", + "blobs_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/blobs{/sha}", + "branches_url": "https://api.github.com/repos/Azure/azure-sdk-fake/branches{/branch}", + "clone_url": "https://github.com/Azure/azure-sdk-fake.git", + "collaborators_url": "https://api.github.com/repos/Azure/azure-sdk-fake/collaborators{/collaborator}", + "comments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/comments{/number}", + "commits_url": "https://api.github.com/repos/Azure/azure-sdk-fake/commits{/sha}", + "compare_url": "https://api.github.com/repos/Azure/azure-sdk-fake/compare/{base}...{head}", + "contents_url": "https://api.github.com/repos/Azure/azure-sdk-fake/contents/{+path}", + "contributors_url": "https://api.github.com/repos/Azure/azure-sdk-fake/contributors", + "created_at": "2022-06-27T16:19:29Z", + "default_branch": "main", + "deployments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/deployments", + "description": "Tools repository leveraged by the Azure SDK team.", + "disabled": false, + "downloads_url": "https://api.github.com/repos/Azure/azure-sdk-fake/downloads", + "events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/events", + "fork": true, + "forks": 0, + "forks_count": 0, + "forks_url": "https://api.github.com/repos/Azure/azure-sdk-fake/forks", + "full_name": "Azure/azure-sdk-fake", + "git_commits_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/commits{/sha}", + "git_refs_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/refs{/sha}", + "git_tags_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/tags{/sha}", + "git_url": "git://github.com/Azure/azure-sdk-fake.git", + "has_discussions": false, + "has_downloads": true, + "has_issues": true, + "has_pages": false, + "has_projects": true, + "has_wiki": true, + "homepage": null, + "hooks_url": "https://api.github.com/repos/Azure/azure-sdk-fake/hooks", + "html_url": "https://github.com/Azure/azure-sdk-fake", + "id": 507980610, + "is_template": false, + "issue_comment_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/comments{/number}", + "issue_events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/events{/number}", + "issues_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues{/number}", + "keys_url": "https://api.github.com/repos/Azure/azure-sdk-fake/keys{/key_id}", + "labels_url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels{/name}", + "language": "C#", + "languages_url": "https://api.github.com/repos/Azure/azure-sdk-fake/languages", + "license": { + "key": "mit", + "name": "MIT License", + "node_id": "MDc6TGljZW5zZTEz", + "spdx_id": "MIT", + "url": "https://api.github.com/licenses/mit" + }, + "merges_url": "https://api.github.com/repos/Azure/azure-sdk-fake/merges", + "milestones_url": "https://api.github.com/repos/Azure/azure-sdk-fake/milestones{/number}", + "mirror_url": null, + "name": "azure-sdk-fake", + "node_id": "R_kgDOHkcrQg", + "notifications_url": "https://api.github.com/repos/Azure/azure-sdk-fake/notifications{?since,all,participating}", + "open_issues": 5, + "open_issues_count": 5, + "owner": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + }, + "private": false, + "pulls_url": "https://api.github.com/repos/Azure/azure-sdk-fake/pulls{/number}", + "pushed_at": "2023-01-23T20:07:27Z", + "releases_url": "https://api.github.com/repos/Azure/azure-sdk-fake/releases{/id}", + "size": 29059, + "ssh_url": "git@github.com:Azure/azure-sdk-fake.git", + "stargazers_count": 0, + "stargazers_url": "https://api.github.com/repos/Azure/azure-sdk-fake/stargazers", + "statuses_url": "https://api.github.com/repos/Azure/azure-sdk-fake/statuses/{sha}", + "subscribers_url": "https://api.github.com/repos/Azure/azure-sdk-fake/subscribers", + "subscription_url": "https://api.github.com/repos/Azure/azure-sdk-fake/subscription", + "svn_url": "https://github.com/Azure/azure-sdk-fake", + "tags_url": "https://api.github.com/repos/Azure/azure-sdk-fake/tags", + "teams_url": "https://api.github.com/repos/Azure/azure-sdk-fake/teams", + "topics": [], + "trees_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/trees{/sha}", + "updated_at": "2023-01-23T19:54:18Z", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake", + "visibility": "public", + "watchers": 0, + "watchers_count": 0, + "web_commit_signoff_required": false + }, + "sender": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + } +} diff --git a/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Tests.JsonEventPayloads/ResetPullRequestActivity_pr_review_requested.json b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Tests.JsonEventPayloads/ResetPullRequestActivity_pr_review_requested.json new file mode 100644 index 00000000000..f5cb763fe31 --- /dev/null +++ b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Tests.JsonEventPayloads/ResetPullRequestActivity_pr_review_requested.json @@ -0,0 +1,626 @@ +{ + "action": "review_requested", + "number": 10, + "pull_request": { + "_links": { + "comments": { + "href": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/10/comments" + }, + "commits": { + "href": "https://api.github.com/repos/Azure/azure-sdk-fake/pulls/10/commits" + }, + "html": { + "href": "https://github.com/Azure/azure-sdk-fake/pull/10" + }, + "issue": { + "href": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/10" + }, + "review_comment": { + "href": "https://api.github.com/repos/Azure/azure-sdk-fake/pulls/comments{/number}" + }, + "review_comments": { + "href": "https://api.github.com/repos/Azure/azure-sdk-fake/pulls/10/comments" + }, + "self": { + "href": "https://api.github.com/repos/Azure/azure-sdk-fake/pulls/10" + }, + "statuses": { + "href": "https://api.github.com/repos/Azure/azure-sdk-fake/statuses/7567393d7d487c62c85ce2c58fb47a4ff52b2f2c" + } + }, + "active_lock_reason": null, + "additions": 1, + "assignee": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + }, + "assignees": [ + { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + } + ], + "author_association": "OWNER", + "auto_merge": null, + "base": { + "label": "FakeUser1:main", + "ref": "main", + "repo": { + "allow_auto_merge": true, + "allow_forking": true, + "allow_merge_commit": true, + "allow_rebase_merge": true, + "allow_squash_merge": true, + "allow_update_branch": false, + "archive_url": "https://api.github.com/repos/Azure/azure-sdk-fake/{archive_format}{/ref}", + "archived": false, + "assignees_url": "https://api.github.com/repos/Azure/azure-sdk-fake/assignees{/user}", + "blobs_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/blobs{/sha}", + "branches_url": "https://api.github.com/repos/Azure/azure-sdk-fake/branches{/branch}", + "clone_url": "https://github.com/Azure/azure-sdk-fake.git", + "collaborators_url": "https://api.github.com/repos/Azure/azure-sdk-fake/collaborators{/collaborator}", + "comments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/comments{/number}", + "commits_url": "https://api.github.com/repos/Azure/azure-sdk-fake/commits{/sha}", + "compare_url": "https://api.github.com/repos/Azure/azure-sdk-fake/compare/{base}...{head}", + "contents_url": "https://api.github.com/repos/Azure/azure-sdk-fake/contents/{+path}", + "contributors_url": "https://api.github.com/repos/Azure/azure-sdk-fake/contributors", + "created_at": "2022-06-27T16:19:29Z", + "default_branch": "main", + "delete_branch_on_merge": false, + "deployments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/deployments", + "description": "Tools repository leveraged by the Azure SDK team.", + "disabled": false, + "downloads_url": "https://api.github.com/repos/Azure/azure-sdk-fake/downloads", + "events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/events", + "fork": true, + "forks": 0, + "forks_count": 0, + "forks_url": "https://api.github.com/repos/Azure/azure-sdk-fake/forks", + "full_name": "Azure/azure-sdk-fake", + "git_commits_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/commits{/sha}", + "git_refs_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/refs{/sha}", + "git_tags_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/tags{/sha}", + "git_url": "git://github.com/Azure/azure-sdk-fake.git", + "has_discussions": false, + "has_downloads": true, + "has_issues": true, + "has_pages": false, + "has_projects": true, + "has_wiki": true, + "homepage": null, + "hooks_url": "https://api.github.com/repos/Azure/azure-sdk-fake/hooks", + "html_url": "https://github.com/Azure/azure-sdk-fake", + "id": 507980610, + "is_template": false, + "issue_comment_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/comments{/number}", + "issue_events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/events{/number}", + "issues_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues{/number}", + "keys_url": "https://api.github.com/repos/Azure/azure-sdk-fake/keys{/key_id}", + "labels_url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels{/name}", + "language": "C#", + "languages_url": "https://api.github.com/repos/Azure/azure-sdk-fake/languages", + "license": { + "key": "mit", + "name": "MIT License", + "node_id": "MDc6TGljZW5zZTEz", + "spdx_id": "MIT", + "url": "https://api.github.com/licenses/mit" + }, + "merge_commit_message": "PR_TITLE", + "merge_commit_title": "MERGE_MESSAGE", + "merges_url": "https://api.github.com/repos/Azure/azure-sdk-fake/merges", + "milestones_url": "https://api.github.com/repos/Azure/azure-sdk-fake/milestones{/number}", + "mirror_url": null, + "name": "azure-sdk-fake", + "node_id": "R_kgDOHkcrQg", + "notifications_url": "https://api.github.com/repos/Azure/azure-sdk-fake/notifications{?since,all,participating}", + "open_issues": 5, + "open_issues_count": 5, + "owner": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + }, + "private": false, + "pulls_url": "https://api.github.com/repos/Azure/azure-sdk-fake/pulls{/number}", + "pushed_at": "2023-01-23T20:07:27Z", + "releases_url": "https://api.github.com/repos/Azure/azure-sdk-fake/releases{/id}", + "size": 29059, + "squash_merge_commit_message": "COMMIT_MESSAGES", + "squash_merge_commit_title": "COMMIT_OR_PR_TITLE", + "ssh_url": "git@github.com:Azure/azure-sdk-fake.git", + "stargazers_count": 0, + "stargazers_url": "https://api.github.com/repos/Azure/azure-sdk-fake/stargazers", + "statuses_url": "https://api.github.com/repos/Azure/azure-sdk-fake/statuses/{sha}", + "subscribers_url": "https://api.github.com/repos/Azure/azure-sdk-fake/subscribers", + "subscription_url": "https://api.github.com/repos/Azure/azure-sdk-fake/subscription", + "svn_url": "https://github.com/Azure/azure-sdk-fake", + "tags_url": "https://api.github.com/repos/Azure/azure-sdk-fake/tags", + "teams_url": "https://api.github.com/repos/Azure/azure-sdk-fake/teams", + "topics": [], + "trees_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/trees{/sha}", + "updated_at": "2023-01-23T19:54:18Z", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake", + "use_squash_pr_title_as_default": false, + "visibility": "public", + "watchers": 0, + "watchers_count": 0, + "web_commit_signoff_required": false + }, + "sha": "1116f5a0f2ec285febd3a584b3f759cab57d7e03", + "user": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + } + }, + "body": "This PR is for testing purposes only", + "changed_files": 1, + "closed_at": null, + "comments": 0, + "comments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/10/comments", + "commits": 3, + "commits_url": "https://api.github.com/repos/Azure/azure-sdk-fake/pulls/10/commits", + "created_at": "2022-11-11T17:00:28Z", + "deletions": 1, + "diff_url": "https://github.com/Azure/azure-sdk-fake/pull/10.diff", + "draft": false, + "head": { + "label": "FakeUser1:AnotherTestPR", + "ref": "AnotherTestPR", + "repo": { + "allow_auto_merge": true, + "allow_forking": true, + "allow_merge_commit": true, + "allow_rebase_merge": true, + "allow_squash_merge": true, + "allow_update_branch": false, + "archive_url": "https://api.github.com/repos/Azure/azure-sdk-fake/{archive_format}{/ref}", + "archived": false, + "assignees_url": "https://api.github.com/repos/Azure/azure-sdk-fake/assignees{/user}", + "blobs_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/blobs{/sha}", + "branches_url": "https://api.github.com/repos/Azure/azure-sdk-fake/branches{/branch}", + "clone_url": "https://github.com/Azure/azure-sdk-fake.git", + "collaborators_url": "https://api.github.com/repos/Azure/azure-sdk-fake/collaborators{/collaborator}", + "comments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/comments{/number}", + "commits_url": "https://api.github.com/repos/Azure/azure-sdk-fake/commits{/sha}", + "compare_url": "https://api.github.com/repos/Azure/azure-sdk-fake/compare/{base}...{head}", + "contents_url": "https://api.github.com/repos/Azure/azure-sdk-fake/contents/{+path}", + "contributors_url": "https://api.github.com/repos/Azure/azure-sdk-fake/contributors", + "created_at": "2022-06-27T16:19:29Z", + "default_branch": "main", + "delete_branch_on_merge": false, + "deployments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/deployments", + "description": "Tools repository leveraged by the Azure SDK team.", + "disabled": false, + "downloads_url": "https://api.github.com/repos/Azure/azure-sdk-fake/downloads", + "events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/events", + "fork": true, + "forks": 0, + "forks_count": 0, + "forks_url": "https://api.github.com/repos/Azure/azure-sdk-fake/forks", + "full_name": "Azure/azure-sdk-fake", + "git_commits_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/commits{/sha}", + "git_refs_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/refs{/sha}", + "git_tags_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/tags{/sha}", + "git_url": "git://github.com/Azure/azure-sdk-fake.git", + "has_discussions": false, + "has_downloads": true, + "has_issues": true, + "has_pages": false, + "has_projects": true, + "has_wiki": true, + "homepage": null, + "hooks_url": "https://api.github.com/repos/Azure/azure-sdk-fake/hooks", + "html_url": "https://github.com/Azure/azure-sdk-fake", + "id": 507980610, + "is_template": false, + "issue_comment_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/comments{/number}", + "issue_events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/events{/number}", + "issues_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues{/number}", + "keys_url": "https://api.github.com/repos/Azure/azure-sdk-fake/keys{/key_id}", + "labels_url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels{/name}", + "language": "C#", + "languages_url": "https://api.github.com/repos/Azure/azure-sdk-fake/languages", + "license": { + "key": "mit", + "name": "MIT License", + "node_id": "MDc6TGljZW5zZTEz", + "spdx_id": "MIT", + "url": "https://api.github.com/licenses/mit" + }, + "merge_commit_message": "PR_TITLE", + "merge_commit_title": "MERGE_MESSAGE", + "merges_url": "https://api.github.com/repos/Azure/azure-sdk-fake/merges", + "milestones_url": "https://api.github.com/repos/Azure/azure-sdk-fake/milestones{/number}", + "mirror_url": null, + "name": "azure-sdk-fake", + "node_id": "R_kgDOHkcrQg", + "notifications_url": "https://api.github.com/repos/Azure/azure-sdk-fake/notifications{?since,all,participating}", + "open_issues": 5, + "open_issues_count": 5, + "owner": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + }, + "private": false, + "pulls_url": "https://api.github.com/repos/Azure/azure-sdk-fake/pulls{/number}", + "pushed_at": "2023-01-23T20:07:27Z", + "releases_url": "https://api.github.com/repos/Azure/azure-sdk-fake/releases{/id}", + "size": 29059, + "squash_merge_commit_message": "COMMIT_MESSAGES", + "squash_merge_commit_title": "COMMIT_OR_PR_TITLE", + "ssh_url": "git@github.com:Azure/azure-sdk-fake.git", + "stargazers_count": 0, + "stargazers_url": "https://api.github.com/repos/Azure/azure-sdk-fake/stargazers", + "statuses_url": "https://api.github.com/repos/Azure/azure-sdk-fake/statuses/{sha}", + "subscribers_url": "https://api.github.com/repos/Azure/azure-sdk-fake/subscribers", + "subscription_url": "https://api.github.com/repos/Azure/azure-sdk-fake/subscription", + "svn_url": "https://github.com/Azure/azure-sdk-fake", + "tags_url": "https://api.github.com/repos/Azure/azure-sdk-fake/tags", + "teams_url": "https://api.github.com/repos/Azure/azure-sdk-fake/teams", + "topics": [], + "trees_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/trees{/sha}", + "updated_at": "2023-01-23T19:54:18Z", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake", + "use_squash_pr_title_as_default": false, + "visibility": "public", + "watchers": 0, + "watchers_count": 0, + "web_commit_signoff_required": false + }, + "sha": "7567393d7d487c62c85ce2c58fb47a4ff52b2f2c", + "user": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + } + }, + "html_url": "https://github.com/Azure/azure-sdk-fake/pull/10", + "id": 1119343007, + "issue_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/10", + "labels": [ + { + "color": "d73a4a", + "default": true, + "description": "Something isn't working", + "id": 4273699693, + "name": "bug", + "node_id": "LA_kwDOHkcrQs7-u3tt", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels/bug" + }, + { + "color": "94812F", + "default": false, + "description": "", + "id": 5070542662, + "name": "no-recent-activity", + "node_id": "LA_kwDOHkcrQs8AAAABLjpXRg", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels/no-recent-activity" + } + ], + "locked": false, + "maintainer_can_modify": false, + "merge_commit_sha": "d207bc4195108de7ae3212fab28d69552361b02d", + "mergeable": true, + "mergeable_state": "unstable", + "merged": false, + "merged_at": null, + "merged_by": null, + "milestone": null, + "node_id": "PR_kwDOHkcrQs5Ct9Gf", + "number": 10, + "patch_url": "https://github.com/Azure/azure-sdk-fake/pull/10.patch", + "rebaseable": true, + "requested_reviewers": [ + { + "avatar_url": "https://avatars.githubusercontent.com/u/913445?v=4", + "events_url": "https://api.github.com/users/FakeUser2/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser2/followers", + "following_url": "https://api.github.com/users/FakeUser2/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser2/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser2", + "id": 913445, + "login": "FakeUser2", + "node_id": "MDQ6VXNlcjkxMzQ0NQ==", + "organizations_url": "https://api.github.com/users/FakeUser2/orgs", + "received_events_url": "https://api.github.com/users/FakeUser2/received_events", + "repos_url": "https://api.github.com/users/FakeUser2/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser2/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser2/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser2" + }, + { + "avatar_url": "https://avatars.githubusercontent.com/u/1020379?v=4", + "events_url": "https://api.github.com/users/FakeUser3/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser3/followers", + "following_url": "https://api.github.com/users/FakeUser3/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser3/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser3", + "id": 1020379, + "login": "FakeUser3", + "node_id": "MDQ6VXNlcjEwMjAzNzk=", + "organizations_url": "https://api.github.com/users/FakeUser3/orgs", + "received_events_url": "https://api.github.com/users/FakeUser3/received_events", + "repos_url": "https://api.github.com/users/FakeUser3/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser3/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser3/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser3" + } + ], + "requested_teams": [], + "review_comment_url": "https://api.github.com/repos/Azure/azure-sdk-fake/pulls/comments{/number}", + "review_comments": 1, + "review_comments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/pulls/10/comments", + "state": "open", + "statuses_url": "https://api.github.com/repos/Azure/azure-sdk-fake/statuses/7567393d7d487c62c85ce2c58fb47a4ff52b2f2c", + "title": "PR for event testing only", + "updated_at": "2023-01-24T22:15:41Z", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/pulls/10", + "user": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + } + }, + "repository": { + "allow_forking": true, + "archive_url": "https://api.github.com/repos/Azure/azure-sdk-fake/{archive_format}{/ref}", + "archived": false, + "assignees_url": "https://api.github.com/repos/Azure/azure-sdk-fake/assignees{/user}", + "blobs_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/blobs{/sha}", + "branches_url": "https://api.github.com/repos/Azure/azure-sdk-fake/branches{/branch}", + "clone_url": "https://github.com/Azure/azure-sdk-fake.git", + "collaborators_url": "https://api.github.com/repos/Azure/azure-sdk-fake/collaborators{/collaborator}", + "comments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/comments{/number}", + "commits_url": "https://api.github.com/repos/Azure/azure-sdk-fake/commits{/sha}", + "compare_url": "https://api.github.com/repos/Azure/azure-sdk-fake/compare/{base}...{head}", + "contents_url": "https://api.github.com/repos/Azure/azure-sdk-fake/contents/{+path}", + "contributors_url": "https://api.github.com/repos/Azure/azure-sdk-fake/contributors", + "created_at": "2022-06-27T16:19:29Z", + "default_branch": "main", + "deployments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/deployments", + "description": "Tools repository leveraged by the Azure SDK team.", + "disabled": false, + "downloads_url": "https://api.github.com/repos/Azure/azure-sdk-fake/downloads", + "events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/events", + "fork": true, + "forks": 0, + "forks_count": 0, + "forks_url": "https://api.github.com/repos/Azure/azure-sdk-fake/forks", + "full_name": "Azure/azure-sdk-fake", + "git_commits_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/commits{/sha}", + "git_refs_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/refs{/sha}", + "git_tags_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/tags{/sha}", + "git_url": "git://github.com/Azure/azure-sdk-fake.git", + "has_discussions": false, + "has_downloads": true, + "has_issues": true, + "has_pages": false, + "has_projects": true, + "has_wiki": true, + "homepage": null, + "hooks_url": "https://api.github.com/repos/Azure/azure-sdk-fake/hooks", + "html_url": "https://github.com/Azure/azure-sdk-fake", + "id": 507980610, + "is_template": false, + "issue_comment_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/comments{/number}", + "issue_events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/events{/number}", + "issues_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues{/number}", + "keys_url": "https://api.github.com/repos/Azure/azure-sdk-fake/keys{/key_id}", + "labels_url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels{/name}", + "language": "C#", + "languages_url": "https://api.github.com/repos/Azure/azure-sdk-fake/languages", + "license": { + "key": "mit", + "name": "MIT License", + "node_id": "MDc6TGljZW5zZTEz", + "spdx_id": "MIT", + "url": "https://api.github.com/licenses/mit" + }, + "merges_url": "https://api.github.com/repos/Azure/azure-sdk-fake/merges", + "milestones_url": "https://api.github.com/repos/Azure/azure-sdk-fake/milestones{/number}", + "mirror_url": null, + "name": "azure-sdk-fake", + "node_id": "R_kgDOHkcrQg", + "notifications_url": "https://api.github.com/repos/Azure/azure-sdk-fake/notifications{?since,all,participating}", + "open_issues": 5, + "open_issues_count": 5, + "owner": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + }, + "private": false, + "pulls_url": "https://api.github.com/repos/Azure/azure-sdk-fake/pulls{/number}", + "pushed_at": "2023-01-23T20:07:27Z", + "releases_url": "https://api.github.com/repos/Azure/azure-sdk-fake/releases{/id}", + "size": 29059, + "ssh_url": "git@github.com:Azure/azure-sdk-fake.git", + "stargazers_count": 0, + "stargazers_url": "https://api.github.com/repos/Azure/azure-sdk-fake/stargazers", + "statuses_url": "https://api.github.com/repos/Azure/azure-sdk-fake/statuses/{sha}", + "subscribers_url": "https://api.github.com/repos/Azure/azure-sdk-fake/subscribers", + "subscription_url": "https://api.github.com/repos/Azure/azure-sdk-fake/subscription", + "svn_url": "https://github.com/Azure/azure-sdk-fake", + "tags_url": "https://api.github.com/repos/Azure/azure-sdk-fake/tags", + "teams_url": "https://api.github.com/repos/Azure/azure-sdk-fake/teams", + "topics": [], + "trees_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/trees{/sha}", + "updated_at": "2023-01-23T19:54:18Z", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake", + "visibility": "public", + "watchers": 0, + "watchers_count": 0, + "web_commit_signoff_required": false + }, + "requested_reviewer": { + "avatar_url": "https://avatars.githubusercontent.com/u/1020379?v=4", + "events_url": "https://api.github.com/users/FakeUser3/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser3/followers", + "following_url": "https://api.github.com/users/FakeUser3/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser3/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser3", + "id": 1020379, + "login": "FakeUser3", + "node_id": "MDQ6VXNlcjEwMjAzNzk=", + "organizations_url": "https://api.github.com/users/FakeUser3/orgs", + "received_events_url": "https://api.github.com/users/FakeUser3/received_events", + "repos_url": "https://api.github.com/users/FakeUser3/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser3/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser3/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser3" + }, + "sender": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + } +} diff --git a/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Tests.JsonEventPayloads/ResetPullRequestActivity_pr_reviewed.json b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Tests.JsonEventPayloads/ResetPullRequestActivity_pr_reviewed.json new file mode 100644 index 00000000000..07d10fef117 --- /dev/null +++ b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Tests.JsonEventPayloads/ResetPullRequestActivity_pr_reviewed.json @@ -0,0 +1,612 @@ +{ + "action": "submitted", + "pull_request": { + "_links": { + "comments": { + "href": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/10/comments" + }, + "commits": { + "href": "https://api.github.com/repos/Azure/azure-sdk-fake/pulls/10/commits" + }, + "html": { + "href": "https://github.com/Azure/azure-sdk-fake/pull/10" + }, + "issue": { + "href": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/10" + }, + "review_comment": { + "href": "https://api.github.com/repos/Azure/azure-sdk-fake/pulls/comments{/number}" + }, + "review_comments": { + "href": "https://api.github.com/repos/Azure/azure-sdk-fake/pulls/10/comments" + }, + "self": { + "href": "https://api.github.com/repos/Azure/azure-sdk-fake/pulls/10" + }, + "statuses": { + "href": "https://api.github.com/repos/Azure/azure-sdk-fake/statuses/7567393d7d487c62c85ce2c58fb47a4ff52b2f2c" + } + }, + "active_lock_reason": null, + "assignee": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + }, + "assignees": [ + { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + } + ], + "author_association": "OWNER", + "auto_merge": null, + "base": { + "label": "FakeUser1:main", + "ref": "main", + "repo": { + "allow_auto_merge": true, + "allow_forking": true, + "allow_merge_commit": true, + "allow_rebase_merge": true, + "allow_squash_merge": true, + "allow_update_branch": false, + "archive_url": "https://api.github.com/repos/Azure/azure-sdk-fake/{archive_format}{/ref}", + "archived": false, + "assignees_url": "https://api.github.com/repos/Azure/azure-sdk-fake/assignees{/user}", + "blobs_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/blobs{/sha}", + "branches_url": "https://api.github.com/repos/Azure/azure-sdk-fake/branches{/branch}", + "clone_url": "https://github.com/Azure/azure-sdk-fake.git", + "collaborators_url": "https://api.github.com/repos/Azure/azure-sdk-fake/collaborators{/collaborator}", + "comments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/comments{/number}", + "commits_url": "https://api.github.com/repos/Azure/azure-sdk-fake/commits{/sha}", + "compare_url": "https://api.github.com/repos/Azure/azure-sdk-fake/compare/{base}...{head}", + "contents_url": "https://api.github.com/repos/Azure/azure-sdk-fake/contents/{+path}", + "contributors_url": "https://api.github.com/repos/Azure/azure-sdk-fake/contributors", + "created_at": "2022-06-27T16:19:29Z", + "default_branch": "main", + "delete_branch_on_merge": false, + "deployments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/deployments", + "description": "Tools repository leveraged by the Azure SDK team.", + "disabled": false, + "downloads_url": "https://api.github.com/repos/Azure/azure-sdk-fake/downloads", + "events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/events", + "fork": true, + "forks": 0, + "forks_count": 0, + "forks_url": "https://api.github.com/repos/Azure/azure-sdk-fake/forks", + "full_name": "Azure/azure-sdk-fake", + "git_commits_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/commits{/sha}", + "git_refs_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/refs{/sha}", + "git_tags_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/tags{/sha}", + "git_url": "git://github.com/Azure/azure-sdk-fake.git", + "has_discussions": false, + "has_downloads": true, + "has_issues": true, + "has_pages": false, + "has_projects": true, + "has_wiki": true, + "homepage": null, + "hooks_url": "https://api.github.com/repos/Azure/azure-sdk-fake/hooks", + "html_url": "https://github.com/Azure/azure-sdk-fake", + "id": 507980610, + "is_template": false, + "issue_comment_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/comments{/number}", + "issue_events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/events{/number}", + "issues_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues{/number}", + "keys_url": "https://api.github.com/repos/Azure/azure-sdk-fake/keys{/key_id}", + "labels_url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels{/name}", + "language": "C#", + "languages_url": "https://api.github.com/repos/Azure/azure-sdk-fake/languages", + "license": { + "key": "mit", + "name": "MIT License", + "node_id": "MDc6TGljZW5zZTEz", + "spdx_id": "MIT", + "url": "https://api.github.com/licenses/mit" + }, + "merge_commit_message": "PR_TITLE", + "merge_commit_title": "MERGE_MESSAGE", + "merges_url": "https://api.github.com/repos/Azure/azure-sdk-fake/merges", + "milestones_url": "https://api.github.com/repos/Azure/azure-sdk-fake/milestones{/number}", + "mirror_url": null, + "name": "azure-sdk-fake", + "node_id": "R_kgDOHkcrQg", + "notifications_url": "https://api.github.com/repos/Azure/azure-sdk-fake/notifications{?since,all,participating}", + "open_issues": 5, + "open_issues_count": 5, + "owner": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + }, + "private": false, + "pulls_url": "https://api.github.com/repos/Azure/azure-sdk-fake/pulls{/number}", + "pushed_at": "2023-01-23T20:07:27Z", + "releases_url": "https://api.github.com/repos/Azure/azure-sdk-fake/releases{/id}", + "size": 29059, + "squash_merge_commit_message": "COMMIT_MESSAGES", + "squash_merge_commit_title": "COMMIT_OR_PR_TITLE", + "ssh_url": "git@github.com:Azure/azure-sdk-fake.git", + "stargazers_count": 0, + "stargazers_url": "https://api.github.com/repos/Azure/azure-sdk-fake/stargazers", + "statuses_url": "https://api.github.com/repos/Azure/azure-sdk-fake/statuses/{sha}", + "subscribers_url": "https://api.github.com/repos/Azure/azure-sdk-fake/subscribers", + "subscription_url": "https://api.github.com/repos/Azure/azure-sdk-fake/subscription", + "svn_url": "https://github.com/Azure/azure-sdk-fake", + "tags_url": "https://api.github.com/repos/Azure/azure-sdk-fake/tags", + "teams_url": "https://api.github.com/repos/Azure/azure-sdk-fake/teams", + "topics": [], + "trees_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/trees{/sha}", + "updated_at": "2023-01-23T19:54:18Z", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake", + "use_squash_pr_title_as_default": false, + "visibility": "public", + "watchers": 0, + "watchers_count": 0, + "web_commit_signoff_required": false + }, + "sha": "1116f5a0f2ec285febd3a584b3f759cab57d7e03", + "user": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + } + }, + "body": "This PR is for testing purposes only", + "closed_at": null, + "comments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/10/comments", + "commits_url": "https://api.github.com/repos/Azure/azure-sdk-fake/pulls/10/commits", + "created_at": "2022-11-11T17:00:28Z", + "diff_url": "https://github.com/Azure/azure-sdk-fake/pull/10.diff", + "draft": false, + "head": { + "label": "FakeUser1:AnotherTestPR", + "ref": "AnotherTestPR", + "repo": { + "allow_auto_merge": true, + "allow_forking": true, + "allow_merge_commit": true, + "allow_rebase_merge": true, + "allow_squash_merge": true, + "allow_update_branch": false, + "archive_url": "https://api.github.com/repos/Azure/azure-sdk-fake/{archive_format}{/ref}", + "archived": false, + "assignees_url": "https://api.github.com/repos/Azure/azure-sdk-fake/assignees{/user}", + "blobs_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/blobs{/sha}", + "branches_url": "https://api.github.com/repos/Azure/azure-sdk-fake/branches{/branch}", + "clone_url": "https://github.com/Azure/azure-sdk-fake.git", + "collaborators_url": "https://api.github.com/repos/Azure/azure-sdk-fake/collaborators{/collaborator}", + "comments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/comments{/number}", + "commits_url": "https://api.github.com/repos/Azure/azure-sdk-fake/commits{/sha}", + "compare_url": "https://api.github.com/repos/Azure/azure-sdk-fake/compare/{base}...{head}", + "contents_url": "https://api.github.com/repos/Azure/azure-sdk-fake/contents/{+path}", + "contributors_url": "https://api.github.com/repos/Azure/azure-sdk-fake/contributors", + "created_at": "2022-06-27T16:19:29Z", + "default_branch": "main", + "delete_branch_on_merge": false, + "deployments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/deployments", + "description": "Tools repository leveraged by the Azure SDK team.", + "disabled": false, + "downloads_url": "https://api.github.com/repos/Azure/azure-sdk-fake/downloads", + "events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/events", + "fork": true, + "forks": 0, + "forks_count": 0, + "forks_url": "https://api.github.com/repos/Azure/azure-sdk-fake/forks", + "full_name": "Azure/azure-sdk-fake", + "git_commits_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/commits{/sha}", + "git_refs_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/refs{/sha}", + "git_tags_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/tags{/sha}", + "git_url": "git://github.com/Azure/azure-sdk-fake.git", + "has_discussions": false, + "has_downloads": true, + "has_issues": true, + "has_pages": false, + "has_projects": true, + "has_wiki": true, + "homepage": null, + "hooks_url": "https://api.github.com/repos/Azure/azure-sdk-fake/hooks", + "html_url": "https://github.com/Azure/azure-sdk-fake", + "id": 507980610, + "is_template": false, + "issue_comment_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/comments{/number}", + "issue_events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/events{/number}", + "issues_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues{/number}", + "keys_url": "https://api.github.com/repos/Azure/azure-sdk-fake/keys{/key_id}", + "labels_url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels{/name}", + "language": "C#", + "languages_url": "https://api.github.com/repos/Azure/azure-sdk-fake/languages", + "license": { + "key": "mit", + "name": "MIT License", + "node_id": "MDc6TGljZW5zZTEz", + "spdx_id": "MIT", + "url": "https://api.github.com/licenses/mit" + }, + "merge_commit_message": "PR_TITLE", + "merge_commit_title": "MERGE_MESSAGE", + "merges_url": "https://api.github.com/repos/Azure/azure-sdk-fake/merges", + "milestones_url": "https://api.github.com/repos/Azure/azure-sdk-fake/milestones{/number}", + "mirror_url": null, + "name": "azure-sdk-fake", + "node_id": "R_kgDOHkcrQg", + "notifications_url": "https://api.github.com/repos/Azure/azure-sdk-fake/notifications{?since,all,participating}", + "open_issues": 5, + "open_issues_count": 5, + "owner": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + }, + "private": false, + "pulls_url": "https://api.github.com/repos/Azure/azure-sdk-fake/pulls{/number}", + "pushed_at": "2023-01-23T20:07:27Z", + "releases_url": "https://api.github.com/repos/Azure/azure-sdk-fake/releases{/id}", + "size": 29059, + "squash_merge_commit_message": "COMMIT_MESSAGES", + "squash_merge_commit_title": "COMMIT_OR_PR_TITLE", + "ssh_url": "git@github.com:Azure/azure-sdk-fake.git", + "stargazers_count": 0, + "stargazers_url": "https://api.github.com/repos/Azure/azure-sdk-fake/stargazers", + "statuses_url": "https://api.github.com/repos/Azure/azure-sdk-fake/statuses/{sha}", + "subscribers_url": "https://api.github.com/repos/Azure/azure-sdk-fake/subscribers", + "subscription_url": "https://api.github.com/repos/Azure/azure-sdk-fake/subscription", + "svn_url": "https://github.com/Azure/azure-sdk-fake", + "tags_url": "https://api.github.com/repos/Azure/azure-sdk-fake/tags", + "teams_url": "https://api.github.com/repos/Azure/azure-sdk-fake/teams", + "topics": [], + "trees_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/trees{/sha}", + "updated_at": "2023-01-23T19:54:18Z", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake", + "use_squash_pr_title_as_default": false, + "visibility": "public", + "watchers": 0, + "watchers_count": 0, + "web_commit_signoff_required": false + }, + "sha": "7567393d7d487c62c85ce2c58fb47a4ff52b2f2c", + "user": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + } + }, + "html_url": "https://github.com/Azure/azure-sdk-fake/pull/10", + "id": 1119343007, + "issue_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/10", + "labels": [ + { + "color": "d73a4a", + "default": true, + "description": "Something isn't working", + "id": 4273699693, + "name": "bug", + "node_id": "LA_kwDOHkcrQs7-u3tt", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels/bug" + }, + { + "color": "94812F", + "default": false, + "description": "", + "id": 5070542662, + "name": "no-recent-activity", + "node_id": "LA_kwDOHkcrQs8AAAABLjpXRg", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels/no-recent-activity" + } + ], + "locked": false, + "merge_commit_sha": "d207bc4195108de7ae3212fab28d69552361b02d", + "merged_at": null, + "milestone": null, + "node_id": "PR_kwDOHkcrQs5Ct9Gf", + "number": 10, + "patch_url": "https://github.com/Azure/azure-sdk-fake/pull/10.patch", + "requested_reviewers": [ + { + "avatar_url": "https://avatars.githubusercontent.com/u/913445?v=4", + "events_url": "https://api.github.com/users/jsquire/events{/privacy}", + "followers_url": "https://api.github.com/users/jsquire/followers", + "following_url": "https://api.github.com/users/jsquire/following{/other_user}", + "gists_url": "https://api.github.com/users/jsquire/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/jsquire", + "id": 913445, + "login": "jsquire", + "node_id": "MDQ6VXNlcjkxMzQ0NQ==", + "organizations_url": "https://api.github.com/users/jsquire/orgs", + "received_events_url": "https://api.github.com/users/jsquire/received_events", + "repos_url": "https://api.github.com/users/jsquire/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/jsquire/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/jsquire/subscriptions", + "type": "User", + "url": "https://api.github.com/users/jsquire" + } + ], + "requested_teams": [], + "review_comment_url": "https://api.github.com/repos/Azure/azure-sdk-fake/pulls/comments{/number}", + "review_comments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/pulls/10/comments", + "state": "open", + "statuses_url": "https://api.github.com/repos/Azure/azure-sdk-fake/statuses/7567393d7d487c62c85ce2c58fb47a4ff52b2f2c", + "title": "PR for event testing only", + "updated_at": "2023-01-24T22:16:35Z", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/pulls/10", + "user": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + } + }, + "repository": { + "allow_forking": true, + "archive_url": "https://api.github.com/repos/Azure/azure-sdk-fake/{archive_format}{/ref}", + "archived": false, + "assignees_url": "https://api.github.com/repos/Azure/azure-sdk-fake/assignees{/user}", + "blobs_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/blobs{/sha}", + "branches_url": "https://api.github.com/repos/Azure/azure-sdk-fake/branches{/branch}", + "clone_url": "https://github.com/Azure/azure-sdk-fake.git", + "collaborators_url": "https://api.github.com/repos/Azure/azure-sdk-fake/collaborators{/collaborator}", + "comments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/comments{/number}", + "commits_url": "https://api.github.com/repos/Azure/azure-sdk-fake/commits{/sha}", + "compare_url": "https://api.github.com/repos/Azure/azure-sdk-fake/compare/{base}...{head}", + "contents_url": "https://api.github.com/repos/Azure/azure-sdk-fake/contents/{+path}", + "contributors_url": "https://api.github.com/repos/Azure/azure-sdk-fake/contributors", + "created_at": "2022-06-27T16:19:29Z", + "default_branch": "main", + "deployments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/deployments", + "description": "Tools repository leveraged by the Azure SDK team.", + "disabled": false, + "downloads_url": "https://api.github.com/repos/Azure/azure-sdk-fake/downloads", + "events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/events", + "fork": true, + "forks": 0, + "forks_count": 0, + "forks_url": "https://api.github.com/repos/Azure/azure-sdk-fake/forks", + "full_name": "Azure/azure-sdk-fake", + "git_commits_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/commits{/sha}", + "git_refs_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/refs{/sha}", + "git_tags_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/tags{/sha}", + "git_url": "git://github.com/Azure/azure-sdk-fake.git", + "has_discussions": false, + "has_downloads": true, + "has_issues": true, + "has_pages": false, + "has_projects": true, + "has_wiki": true, + "homepage": null, + "hooks_url": "https://api.github.com/repos/Azure/azure-sdk-fake/hooks", + "html_url": "https://github.com/Azure/azure-sdk-fake", + "id": 507980610, + "is_template": false, + "issue_comment_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/comments{/number}", + "issue_events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/events{/number}", + "issues_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues{/number}", + "keys_url": "https://api.github.com/repos/Azure/azure-sdk-fake/keys{/key_id}", + "labels_url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels{/name}", + "language": "C#", + "languages_url": "https://api.github.com/repos/Azure/azure-sdk-fake/languages", + "license": { + "key": "mit", + "name": "MIT License", + "node_id": "MDc6TGljZW5zZTEz", + "spdx_id": "MIT", + "url": "https://api.github.com/licenses/mit" + }, + "merges_url": "https://api.github.com/repos/Azure/azure-sdk-fake/merges", + "milestones_url": "https://api.github.com/repos/Azure/azure-sdk-fake/milestones{/number}", + "mirror_url": null, + "name": "azure-sdk-fake", + "node_id": "R_kgDOHkcrQg", + "notifications_url": "https://api.github.com/repos/Azure/azure-sdk-fake/notifications{?since,all,participating}", + "open_issues": 5, + "open_issues_count": 5, + "owner": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + }, + "private": false, + "pulls_url": "https://api.github.com/repos/Azure/azure-sdk-fake/pulls{/number}", + "pushed_at": "2023-01-23T20:07:27Z", + "releases_url": "https://api.github.com/repos/Azure/azure-sdk-fake/releases{/id}", + "size": 29059, + "ssh_url": "git@github.com:Azure/azure-sdk-fake.git", + "stargazers_count": 0, + "stargazers_url": "https://api.github.com/repos/Azure/azure-sdk-fake/stargazers", + "statuses_url": "https://api.github.com/repos/Azure/azure-sdk-fake/statuses/{sha}", + "subscribers_url": "https://api.github.com/repos/Azure/azure-sdk-fake/subscribers", + "subscription_url": "https://api.github.com/repos/Azure/azure-sdk-fake/subscription", + "svn_url": "https://github.com/Azure/azure-sdk-fake", + "tags_url": "https://api.github.com/repos/Azure/azure-sdk-fake/tags", + "teams_url": "https://api.github.com/repos/Azure/azure-sdk-fake/teams", + "topics": [], + "trees_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/trees{/sha}", + "updated_at": "2023-01-23T19:54:18Z", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake", + "visibility": "public", + "watchers": 0, + "watchers_count": 0, + "web_commit_signoff_required": false + }, + "review": { + "_links": { + "html": { + "href": "https://github.com/Azure/azure-sdk-fake/pull/10#pullrequestreview-1268416588" + }, + "pull_request": { + "href": "https://api.github.com/repos/Azure/azure-sdk-fake/pulls/10" + } + }, + "author_association": "COLLABORATOR", + "body": "test event 2", + "commit_id": "7567393d7d487c62c85ce2c58fb47a4ff52b2f2c", + "html_url": "https://github.com/Azure/azure-sdk-fake/pull/10#pullrequestreview-1268416588", + "id": 1268416588, + "node_id": "PRR_kwDOHkcrQs5LmoBM", + "pull_request_url": "https://api.github.com/repos/Azure/azure-sdk-fake/pulls/10", + "state": "changes_requested", + "submitted_at": "2023-01-24T22:16:35Z", + "user": { + "avatar_url": "https://avatars.githubusercontent.com/u/1020379?v=4", + "events_url": "https://api.github.com/users/FakeUser2/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser2/followers", + "following_url": "https://api.github.com/users/FakeUser2/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser2/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser2", + "id": 1020379, + "login": "FakeUser2", + "node_id": "MDQ6VXNlcjEwMjAzNzk=", + "organizations_url": "https://api.github.com/users/FakeUser2/orgs", + "received_events_url": "https://api.github.com/users/FakeUser2/received_events", + "repos_url": "https://api.github.com/users/FakeUser2/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser2/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser2/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser2" + } + }, + "sender": { + "avatar_url": "https://avatars.githubusercontent.com/u/1020379?v=4", + "events_url": "https://api.github.com/users/FakeUser2/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser2/followers", + "following_url": "https://api.github.com/users/FakeUser2/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser2/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser2", + "id": 1020379, + "login": "FakeUser2", + "node_id": "MDQ6VXNlcjEwMjAzNzk=", + "organizations_url": "https://api.github.com/users/FakeUser2/orgs", + "received_events_url": "https://api.github.com/users/FakeUser2/received_events", + "repos_url": "https://api.github.com/users/FakeUser2/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser2/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser2/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser2" + } +} diff --git a/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Tests.JsonEventPayloads/ResetPullRequestActivity_pr_synchronize.json b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Tests.JsonEventPayloads/ResetPullRequestActivity_pr_synchronize.json new file mode 100644 index 00000000000..02100b94ade --- /dev/null +++ b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Tests.JsonEventPayloads/ResetPullRequestActivity_pr_synchronize.json @@ -0,0 +1,567 @@ +{ + "action": "synchronize", + "after": "bd1285954758a643c931cec5c9879e7a0b287cba", + "before": "3e6a3aeebb53b27ae0d77bd4de0bca269e38d6db", + "number": 10, + "pull_request": { + "_links": { + "comments": { + "href": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/10/comments" + }, + "commits": { + "href": "https://api.github.com/repos/Azure/azure-sdk-fake/pulls/10/commits" + }, + "html": { + "href": "https://github.com/Azure/azure-sdk-fake/pull/10" + }, + "issue": { + "href": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/10" + }, + "review_comment": { + "href": "https://api.github.com/repos/Azure/azure-sdk-fake/pulls/comments{/number}" + }, + "review_comments": { + "href": "https://api.github.com/repos/Azure/azure-sdk-fake/pulls/10/comments" + }, + "self": { + "href": "https://api.github.com/repos/Azure/azure-sdk-fake/pulls/10" + }, + "statuses": { + "href": "https://api.github.com/repos/Azure/azure-sdk-fake/statuses/bd1285954758a643c931cec5c9879e7a0b287cba" + } + }, + "active_lock_reason": null, + "additions": 1, + "assignee": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + }, + "assignees": [ + { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + } + ], + "author_association": "OWNER", + "auto_merge": null, + "base": { + "label": "FakeUser1:main", + "ref": "main", + "repo": { + "allow_auto_merge": false, + "allow_forking": true, + "allow_merge_commit": true, + "allow_rebase_merge": true, + "allow_squash_merge": true, + "allow_update_branch": false, + "archive_url": "https://api.github.com/repos/Azure/azure-sdk-fake/{archive_format}{/ref}", + "archived": false, + "assignees_url": "https://api.github.com/repos/Azure/azure-sdk-fake/assignees{/user}", + "blobs_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/blobs{/sha}", + "branches_url": "https://api.github.com/repos/Azure/azure-sdk-fake/branches{/branch}", + "clone_url": "https://github.com/Azure/azure-sdk-fake.git", + "collaborators_url": "https://api.github.com/repos/Azure/azure-sdk-fake/collaborators{/collaborator}", + "comments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/comments{/number}", + "commits_url": "https://api.github.com/repos/Azure/azure-sdk-fake/commits{/sha}", + "compare_url": "https://api.github.com/repos/Azure/azure-sdk-fake/compare/{base}...{head}", + "contents_url": "https://api.github.com/repos/Azure/azure-sdk-fake/contents/{+path}", + "contributors_url": "https://api.github.com/repos/Azure/azure-sdk-fake/contributors", + "created_at": "2022-06-27T16:19:29Z", + "default_branch": "main", + "delete_branch_on_merge": false, + "deployments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/deployments", + "description": "Tools repository leveraged by the Azure SDK team.", + "disabled": false, + "downloads_url": "https://api.github.com/repos/Azure/azure-sdk-fake/downloads", + "events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/events", + "fork": true, + "forks": 0, + "forks_count": 0, + "forks_url": "https://api.github.com/repos/Azure/azure-sdk-fake/forks", + "full_name": "Azure/azure-sdk-fake", + "git_commits_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/commits{/sha}", + "git_refs_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/refs{/sha}", + "git_tags_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/tags{/sha}", + "git_url": "git://github.com/Azure/azure-sdk-fake.git", + "has_discussions": false, + "has_downloads": true, + "has_issues": true, + "has_pages": false, + "has_projects": true, + "has_wiki": true, + "homepage": null, + "hooks_url": "https://api.github.com/repos/Azure/azure-sdk-fake/hooks", + "html_url": "https://github.com/Azure/azure-sdk-fake", + "id": 507980610, + "is_template": false, + "issue_comment_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/comments{/number}", + "issue_events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/events{/number}", + "issues_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues{/number}", + "keys_url": "https://api.github.com/repos/Azure/azure-sdk-fake/keys{/key_id}", + "labels_url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels{/name}", + "language": "C#", + "languages_url": "https://api.github.com/repos/Azure/azure-sdk-fake/languages", + "license": { + "key": "mit", + "name": "MIT License", + "node_id": "MDc6TGljZW5zZTEz", + "spdx_id": "MIT", + "url": "https://api.github.com/licenses/mit" + }, + "merge_commit_message": "PR_TITLE", + "merge_commit_title": "MERGE_MESSAGE", + "merges_url": "https://api.github.com/repos/Azure/azure-sdk-fake/merges", + "milestones_url": "https://api.github.com/repos/Azure/azure-sdk-fake/milestones{/number}", + "mirror_url": null, + "name": "azure-sdk-fake", + "node_id": "R_kgDOHkcrQg", + "notifications_url": "https://api.github.com/repos/Azure/azure-sdk-fake/notifications{?since,all,participating}", + "open_issues": 7, + "open_issues_count": 7, + "owner": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + }, + "private": false, + "pulls_url": "https://api.github.com/repos/Azure/azure-sdk-fake/pulls{/number}", + "pushed_at": "2022-11-11T17:02:46Z", + "releases_url": "https://api.github.com/repos/Azure/azure-sdk-fake/releases{/id}", + "size": 28964, + "squash_merge_commit_message": "COMMIT_MESSAGES", + "squash_merge_commit_title": "COMMIT_OR_PR_TITLE", + "ssh_url": "git@github.com:Azure/azure-sdk-fake.git", + "stargazers_count": 0, + "stargazers_url": "https://api.github.com/repos/Azure/azure-sdk-fake/stargazers", + "statuses_url": "https://api.github.com/repos/Azure/azure-sdk-fake/statuses/{sha}", + "subscribers_url": "https://api.github.com/repos/Azure/azure-sdk-fake/subscribers", + "subscription_url": "https://api.github.com/repos/Azure/azure-sdk-fake/subscription", + "svn_url": "https://github.com/Azure/azure-sdk-fake", + "tags_url": "https://api.github.com/repos/Azure/azure-sdk-fake/tags", + "teams_url": "https://api.github.com/repos/Azure/azure-sdk-fake/teams", + "topics": [], + "trees_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/trees{/sha}", + "updated_at": "2022-10-31T16:54:20Z", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake", + "use_squash_pr_title_as_default": false, + "visibility": "public", + "watchers": 0, + "watchers_count": 0, + "web_commit_signoff_required": false + }, + "sha": "1116f5a0f2ec285febd3a584b3f759cab57d7e03", + "user": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + } + }, + "body": "This PR is for testing purposes only", + "changed_files": 1, + "closed_at": null, + "comments": 0, + "comments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/10/comments", + "commits": 2, + "commits_url": "https://api.github.com/repos/Azure/azure-sdk-fake/pulls/10/commits", + "created_at": "2022-11-11T17:00:28Z", + "deletions": 1, + "diff_url": "https://github.com/Azure/azure-sdk-fake/pull/10.diff", + "draft": false, + "head": { + "label": "FakeUser1:AnotherTestPR", + "ref": "AnotherTestPR", + "repo": { + "allow_auto_merge": false, + "allow_forking": true, + "allow_merge_commit": true, + "allow_rebase_merge": true, + "allow_squash_merge": true, + "allow_update_branch": false, + "archive_url": "https://api.github.com/repos/Azure/azure-sdk-fake/{archive_format}{/ref}", + "archived": false, + "assignees_url": "https://api.github.com/repos/Azure/azure-sdk-fake/assignees{/user}", + "blobs_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/blobs{/sha}", + "branches_url": "https://api.github.com/repos/Azure/azure-sdk-fake/branches{/branch}", + "clone_url": "https://github.com/Azure/azure-sdk-fake.git", + "collaborators_url": "https://api.github.com/repos/Azure/azure-sdk-fake/collaborators{/collaborator}", + "comments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/comments{/number}", + "commits_url": "https://api.github.com/repos/Azure/azure-sdk-fake/commits{/sha}", + "compare_url": "https://api.github.com/repos/Azure/azure-sdk-fake/compare/{base}...{head}", + "contents_url": "https://api.github.com/repos/Azure/azure-sdk-fake/contents/{+path}", + "contributors_url": "https://api.github.com/repos/Azure/azure-sdk-fake/contributors", + "created_at": "2022-06-27T16:19:29Z", + "default_branch": "main", + "delete_branch_on_merge": false, + "deployments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/deployments", + "description": "Tools repository leveraged by the Azure SDK team.", + "disabled": false, + "downloads_url": "https://api.github.com/repos/Azure/azure-sdk-fake/downloads", + "events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/events", + "fork": true, + "forks": 0, + "forks_count": 0, + "forks_url": "https://api.github.com/repos/Azure/azure-sdk-fake/forks", + "full_name": "Azure/azure-sdk-fake", + "git_commits_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/commits{/sha}", + "git_refs_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/refs{/sha}", + "git_tags_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/tags{/sha}", + "git_url": "git://github.com/Azure/azure-sdk-fake.git", + "has_discussions": false, + "has_downloads": true, + "has_issues": true, + "has_pages": false, + "has_projects": true, + "has_wiki": true, + "homepage": null, + "hooks_url": "https://api.github.com/repos/Azure/azure-sdk-fake/hooks", + "html_url": "https://github.com/Azure/azure-sdk-fake", + "id": 507980610, + "is_template": false, + "issue_comment_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/comments{/number}", + "issue_events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/events{/number}", + "issues_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues{/number}", + "keys_url": "https://api.github.com/repos/Azure/azure-sdk-fake/keys{/key_id}", + "labels_url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels{/name}", + "language": "C#", + "languages_url": "https://api.github.com/repos/Azure/azure-sdk-fake/languages", + "license": { + "key": "mit", + "name": "MIT License", + "node_id": "MDc6TGljZW5zZTEz", + "spdx_id": "MIT", + "url": "https://api.github.com/licenses/mit" + }, + "merge_commit_message": "PR_TITLE", + "merge_commit_title": "MERGE_MESSAGE", + "merges_url": "https://api.github.com/repos/Azure/azure-sdk-fake/merges", + "milestones_url": "https://api.github.com/repos/Azure/azure-sdk-fake/milestones{/number}", + "mirror_url": null, + "name": "azure-sdk-fake", + "node_id": "R_kgDOHkcrQg", + "notifications_url": "https://api.github.com/repos/Azure/azure-sdk-fake/notifications{?since,all,participating}", + "open_issues": 7, + "open_issues_count": 7, + "owner": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + }, + "private": false, + "pulls_url": "https://api.github.com/repos/Azure/azure-sdk-fake/pulls{/number}", + "pushed_at": "2022-11-11T17:02:46Z", + "releases_url": "https://api.github.com/repos/Azure/azure-sdk-fake/releases{/id}", + "size": 28964, + "squash_merge_commit_message": "COMMIT_MESSAGES", + "squash_merge_commit_title": "COMMIT_OR_PR_TITLE", + "ssh_url": "git@github.com:Azure/azure-sdk-fake.git", + "stargazers_count": 0, + "stargazers_url": "https://api.github.com/repos/Azure/azure-sdk-fake/stargazers", + "statuses_url": "https://api.github.com/repos/Azure/azure-sdk-fake/statuses/{sha}", + "subscribers_url": "https://api.github.com/repos/Azure/azure-sdk-fake/subscribers", + "subscription_url": "https://api.github.com/repos/Azure/azure-sdk-fake/subscription", + "svn_url": "https://github.com/Azure/azure-sdk-fake", + "tags_url": "https://api.github.com/repos/Azure/azure-sdk-fake/tags", + "teams_url": "https://api.github.com/repos/Azure/azure-sdk-fake/teams", + "topics": [], + "trees_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/trees{/sha}", + "updated_at": "2022-10-31T16:54:20Z", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake", + "use_squash_pr_title_as_default": false, + "visibility": "public", + "watchers": 0, + "watchers_count": 0, + "web_commit_signoff_required": false + }, + "sha": "bd1285954758a643c931cec5c9879e7a0b287cba", + "user": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + } + }, + "html_url": "https://github.com/Azure/azure-sdk-fake/pull/10", + "id": 1119343007, + "issue_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/10", + "labels": [ + { + "color": "d73a4a", + "default": true, + "description": "Something isn't working", + "id": 4273699693, + "name": "bug", + "node_id": "LA_kwDOHkcrQs7-u3tt", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels/bug" + }, + { + "color": "94812F", + "default": false, + "description": "", + "id": 5070542662, + "name": "no-recent-activity", + "node_id": "LA_kwDOHkcrQs8AAAABLjpXRg", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels/no-recent-activity" + } + ], + "locked": false, + "maintainer_can_modify": false, + "merge_commit_sha": "670cc9260666ea6d46bfda573fee3285e9fab2cf", + "mergeable": null, + "mergeable_state": "unknown", + "merged": false, + "merged_at": null, + "merged_by": null, + "milestone": null, + "node_id": "PR_kwDOHkcrQs5Ct9Gf", + "number": 10, + "patch_url": "https://github.com/Azure/azure-sdk-fake/pull/10.patch", + "rebaseable": null, + "requested_reviewers": [], + "requested_teams": [], + "review_comment_url": "https://api.github.com/repos/Azure/azure-sdk-fake/pulls/comments{/number}", + "review_comments": 0, + "review_comments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/pulls/10/comments", + "state": "open", + "statuses_url": "https://api.github.com/repos/Azure/azure-sdk-fake/statuses/bd1285954758a643c931cec5c9879e7a0b287cba", + "title": "PR for event testing only", + "updated_at": "2022-11-11T17:02:45Z", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/pulls/10", + "user": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + } + }, + "repository": { + "allow_forking": true, + "archive_url": "https://api.github.com/repos/Azure/azure-sdk-fake/{archive_format}{/ref}", + "archived": false, + "assignees_url": "https://api.github.com/repos/Azure/azure-sdk-fake/assignees{/user}", + "blobs_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/blobs{/sha}", + "branches_url": "https://api.github.com/repos/Azure/azure-sdk-fake/branches{/branch}", + "clone_url": "https://github.com/Azure/azure-sdk-fake.git", + "collaborators_url": "https://api.github.com/repos/Azure/azure-sdk-fake/collaborators{/collaborator}", + "comments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/comments{/number}", + "commits_url": "https://api.github.com/repos/Azure/azure-sdk-fake/commits{/sha}", + "compare_url": "https://api.github.com/repos/Azure/azure-sdk-fake/compare/{base}...{head}", + "contents_url": "https://api.github.com/repos/Azure/azure-sdk-fake/contents/{+path}", + "contributors_url": "https://api.github.com/repos/Azure/azure-sdk-fake/contributors", + "created_at": "2022-06-27T16:19:29Z", + "default_branch": "main", + "deployments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/deployments", + "description": "Tools repository leveraged by the Azure SDK team.", + "disabled": false, + "downloads_url": "https://api.github.com/repos/Azure/azure-sdk-fake/downloads", + "events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/events", + "fork": true, + "forks": 0, + "forks_count": 0, + "forks_url": "https://api.github.com/repos/Azure/azure-sdk-fake/forks", + "full_name": "Azure/azure-sdk-fake", + "git_commits_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/commits{/sha}", + "git_refs_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/refs{/sha}", + "git_tags_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/tags{/sha}", + "git_url": "git://github.com/Azure/azure-sdk-fake.git", + "has_discussions": false, + "has_downloads": true, + "has_issues": true, + "has_pages": false, + "has_projects": true, + "has_wiki": true, + "homepage": null, + "hooks_url": "https://api.github.com/repos/Azure/azure-sdk-fake/hooks", + "html_url": "https://github.com/Azure/azure-sdk-fake", + "id": 507980610, + "is_template": false, + "issue_comment_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/comments{/number}", + "issue_events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/events{/number}", + "issues_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues{/number}", + "keys_url": "https://api.github.com/repos/Azure/azure-sdk-fake/keys{/key_id}", + "labels_url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels{/name}", + "language": "C#", + "languages_url": "https://api.github.com/repos/Azure/azure-sdk-fake/languages", + "license": { + "key": "mit", + "name": "MIT License", + "node_id": "MDc6TGljZW5zZTEz", + "spdx_id": "MIT", + "url": "https://api.github.com/licenses/mit" + }, + "merges_url": "https://api.github.com/repos/Azure/azure-sdk-fake/merges", + "milestones_url": "https://api.github.com/repos/Azure/azure-sdk-fake/milestones{/number}", + "mirror_url": null, + "name": "azure-sdk-fake", + "node_id": "R_kgDOHkcrQg", + "notifications_url": "https://api.github.com/repos/Azure/azure-sdk-fake/notifications{?since,all,participating}", + "open_issues": 7, + "open_issues_count": 7, + "owner": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + }, + "private": false, + "pulls_url": "https://api.github.com/repos/Azure/azure-sdk-fake/pulls{/number}", + "pushed_at": "2022-11-11T17:02:46Z", + "releases_url": "https://api.github.com/repos/Azure/azure-sdk-fake/releases{/id}", + "size": 28964, + "ssh_url": "git@github.com:Azure/azure-sdk-fake.git", + "stargazers_count": 0, + "stargazers_url": "https://api.github.com/repos/Azure/azure-sdk-fake/stargazers", + "statuses_url": "https://api.github.com/repos/Azure/azure-sdk-fake/statuses/{sha}", + "subscribers_url": "https://api.github.com/repos/Azure/azure-sdk-fake/subscribers", + "subscription_url": "https://api.github.com/repos/Azure/azure-sdk-fake/subscription", + "svn_url": "https://github.com/Azure/azure-sdk-fake", + "tags_url": "https://api.github.com/repos/Azure/azure-sdk-fake/tags", + "teams_url": "https://api.github.com/repos/Azure/azure-sdk-fake/teams", + "topics": [], + "trees_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/trees{/sha}", + "updated_at": "2022-10-31T16:54:20Z", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake", + "visibility": "public", + "watchers": 0, + "watchers_count": 0, + "web_commit_signoff_required": false + }, + "sender": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + } +} diff --git a/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Tests.JsonEventPayloads/ScheduledEvent_payload.json b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Tests.JsonEventPayloads/ScheduledEvent_payload.json new file mode 100644 index 00000000000..b7c4bac8a3d --- /dev/null +++ b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Tests.JsonEventPayloads/ScheduledEvent_payload.json @@ -0,0 +1,110 @@ +{ + "repository": { + "allow_forking": true, + "archive_url": "https://api.github.com/repos/Azure/azure-sdk-fake/{archive_format}{/ref}", + "archived": false, + "assignees_url": "https://api.github.com/repos/Azure/azure-sdk-fake/assignees{/user}", + "blobs_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/blobs{/sha}", + "branches_url": "https://api.github.com/repos/Azure/azure-sdk-fake/branches{/branch}", + "clone_url": "https://github.com/Azure/azure-sdk-fake.git", + "collaborators_url": "https://api.github.com/repos/Azure/azure-sdk-fake/collaborators{/collaborator}", + "comments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/comments{/number}", + "commits_url": "https://api.github.com/repos/Azure/azure-sdk-fake/commits{/sha}", + "compare_url": "https://api.github.com/repos/Azure/azure-sdk-fake/compare/{base}...{head}", + "contents_url": "https://api.github.com/repos/Azure/azure-sdk-fake/contents/{+path}", + "contributors_url": "https://api.github.com/repos/Azure/azure-sdk-fake/contributors", + "created_at": "2022-06-27T16:19:29Z", + "default_branch": "main", + "deployments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/deployments", + "description": "Tools repository leveraged by the Azure SDK team.", + "disabled": false, + "downloads_url": "https://api.github.com/repos/Azure/azure-sdk-fake/downloads", + "events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/events", + "fork": true, + "forks": 0, + "forks_count": 0, + "forks_url": "https://api.github.com/repos/Azure/azure-sdk-fake/forks", + "full_name": "Azure/azure-sdk-fake", + "git_commits_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/commits{/sha}", + "git_refs_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/refs{/sha}", + "git_tags_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/tags{/sha}", + "git_url": "git://github.com/Azure/azure-sdk-fake.git", + "has_discussions": false, + "has_downloads": true, + "has_issues": true, + "has_pages": false, + "has_projects": true, + "has_wiki": true, + "homepage": null, + "hooks_url": "https://api.github.com/repos/Azure/azure-sdk-fake/hooks", + "html_url": "https://github.com/Azure/azure-sdk-fake", + "id": 507980610, + "is_template": false, + "issue_comment_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/comments{/number}", + "issue_events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/events{/number}", + "issues_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues{/number}", + "keys_url": "https://api.github.com/repos/Azure/azure-sdk-fake/keys{/key_id}", + "labels_url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels{/name}", + "language": "C#", + "languages_url": "https://api.github.com/repos/Azure/azure-sdk-fake/languages", + "license": { + "key": "mit", + "name": "MIT License", + "node_id": "MDc6TGljZW5zZTEz", + "spdx_id": "MIT", + "url": "https://api.github.com/licenses/mit" + }, + "merges_url": "https://api.github.com/repos/Azure/azure-sdk-fake/merges", + "milestones_url": "https://api.github.com/repos/Azure/azure-sdk-fake/milestones{/number}", + "mirror_url": null, + "name": "azure-sdk-fake", + "node_id": "R_kgDOHkcrQg", + "notifications_url": "https://api.github.com/repos/Azure/azure-sdk-fake/notifications{?since,all,participating}", + "open_issues": 8, + "open_issues_count": 8, + "owner": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + }, + "private": false, + "pulls_url": "https://api.github.com/repos/Azure/azure-sdk-fake/pulls{/number}", + "pushed_at": "2022-11-18T16:56:13Z", + "releases_url": "https://api.github.com/repos/Azure/azure-sdk-fake/releases{/id}", + "size": 28968, + "ssh_url": "git@github.com:Azure/azure-sdk-fake.git", + "stargazers_count": 0, + "stargazers_url": "https://api.github.com/repos/Azure/azure-sdk-fake/stargazers", + "statuses_url": "https://api.github.com/repos/Azure/azure-sdk-fake/statuses/{sha}", + "subscribers_url": "https://api.github.com/repos/Azure/azure-sdk-fake/subscribers", + "subscription_url": "https://api.github.com/repos/Azure/azure-sdk-fake/subscription", + "svn_url": "https://github.com/Azure/azure-sdk-fake", + "tags_url": "https://api.github.com/repos/Azure/azure-sdk-fake/tags", + "teams_url": "https://api.github.com/repos/Azure/azure-sdk-fake/teams", + "topics": [], + "trees_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/trees{/sha}", + "updated_at": "2022-10-31T16:54:20Z", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake", + "visibility": "public", + "watchers": 0, + "watchers_count": 0, + "web_commit_signoff_required": false + }, + "schedule": "*/2 * * * *", + "workflow": ".github/workflows/cron-test.yml" +} diff --git a/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Tests.JsonEventPayloads/ServiceAttention_issue_labeled.json b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Tests.JsonEventPayloads/ServiceAttention_issue_labeled.json new file mode 100644 index 00000000000..5a445592419 --- /dev/null +++ b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/Tests.JsonEventPayloads/ServiceAttention_issue_labeled.json @@ -0,0 +1,275 @@ +{ + "action": "labeled", + "issue": { + "active_lock_reason": null, + "assignee": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + }, + "assignees": [ + { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + } + ], + "author_association": "OWNER", + "body": null, + "closed_at": null, + "comments": 0, + "comments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/14/comments", + "created_at": "2023-01-27T17:01:30Z", + "events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/14/events", + "html_url": "https://github.com/Azure/azure-sdk-fake/issues/14", + "id": 1560095682, + "labels": [ + { + "color": "d73a4a", + "default": true, + "description": "Something isn't working", + "id": 4273699693, + "name": "bug", + "node_id": "LA_kwDOHkcrQs7-u3tt", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels/bug" + }, + { + "color": "9C7082", + "default": false, + "description": "fake label for testing", + "id": 5095712487, + "name": "FakeLabel4", + "node_id": "LA_kwDOHkcrQs8AAAABL7pm5w", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels/FakeLabel4" + }, + { + "color": "9C7082", + "default": false, + "description": "fake label for testing", + "id": 5095712487, + "name": "FakeLabel1", + "node_id": "LA_kwDOHkcrQs8AAAABL7pm5w", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels/FakeLabel1" + }, + { + "color": "9C7082", + "default": false, + "description": "fake label for testing", + "id": 5095712487, + "name": "FakeLabel9", + "node_id": "LA_kwDOHkcrQs8AAAABL7pm5w", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels/FakeLabel9" + } + ], + "labels_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/14/labels{/name}", + "locked": false, + "milestone": null, + "node_id": "I_kwDOHkcrQs5c_SvC", + "number": 14, + "performed_via_github_app": null, + "reactions": { + "+1": 0, + "-1": 0, + "confused": 0, + "eyes": 0, + "heart": 0, + "hooray": 0, + "laugh": 0, + "rocket": 0, + "total_count": 0, + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/14/reactions" + }, + "repository_url": "https://api.github.com/repos/Azure/azure-sdk-fake", + "state": "open", + "state_reason": null, + "timeline_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/14/timeline", + "title": "New test issue to generate event payloads", + "updated_at": "2023-01-30T16:16:54Z", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/14", + "user": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + } + }, + "label": { + "color": "F75BB2", + "default": false, + "description": "", + "id": 5095715984, + "name": "Service Attention", + "node_id": "LA_kwDOHkcrQs8AAAABL7p0kA", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels/Service%20Attention" + }, + "repository": { + "allow_forking": true, + "archive_url": "https://api.github.com/repos/Azure/azure-sdk-fake/{archive_format}{/ref}", + "archived": false, + "assignees_url": "https://api.github.com/repos/Azure/azure-sdk-fake/assignees{/user}", + "blobs_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/blobs{/sha}", + "branches_url": "https://api.github.com/repos/Azure/azure-sdk-fake/branches{/branch}", + "clone_url": "https://github.com/Azure/azure-sdk-fake.git", + "collaborators_url": "https://api.github.com/repos/Azure/azure-sdk-fake/collaborators{/collaborator}", + "comments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/comments{/number}", + "commits_url": "https://api.github.com/repos/Azure/azure-sdk-fake/commits{/sha}", + "compare_url": "https://api.github.com/repos/Azure/azure-sdk-fake/compare/{base}...{head}", + "contents_url": "https://api.github.com/repos/Azure/azure-sdk-fake/contents/{+path}", + "contributors_url": "https://api.github.com/repos/Azure/azure-sdk-fake/contributors", + "created_at": "2022-06-27T16:19:29Z", + "default_branch": "main", + "deployments_url": "https://api.github.com/repos/Azure/azure-sdk-fake/deployments", + "description": "Tools repository leveraged by the Azure SDK team.", + "disabled": false, + "downloads_url": "https://api.github.com/repos/Azure/azure-sdk-fake/downloads", + "events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/events", + "fork": true, + "forks": 0, + "forks_count": 0, + "forks_url": "https://api.github.com/repos/Azure/azure-sdk-fake/forks", + "full_name": "Azure/azure-sdk-fake", + "git_commits_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/commits{/sha}", + "git_refs_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/refs{/sha}", + "git_tags_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/tags{/sha}", + "git_url": "git://github.com/Azure/azure-sdk-fake.git", + "has_discussions": false, + "has_downloads": true, + "has_issues": true, + "has_pages": false, + "has_projects": true, + "has_wiki": true, + "homepage": null, + "hooks_url": "https://api.github.com/repos/Azure/azure-sdk-fake/hooks", + "html_url": "https://github.com/Azure/azure-sdk-fake", + "id": 507980610, + "is_template": false, + "issue_comment_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/comments{/number}", + "issue_events_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues/events{/number}", + "issues_url": "https://api.github.com/repos/Azure/azure-sdk-fake/issues{/number}", + "keys_url": "https://api.github.com/repos/Azure/azure-sdk-fake/keys{/key_id}", + "labels_url": "https://api.github.com/repos/Azure/azure-sdk-fake/labels{/name}", + "language": "C#", + "languages_url": "https://api.github.com/repos/Azure/azure-sdk-fake/languages", + "license": { + "key": "mit", + "name": "MIT License", + "node_id": "MDc6TGljZW5zZTEz", + "spdx_id": "MIT", + "url": "https://api.github.com/licenses/mit" + }, + "merges_url": "https://api.github.com/repos/Azure/azure-sdk-fake/merges", + "milestones_url": "https://api.github.com/repos/Azure/azure-sdk-fake/milestones{/number}", + "mirror_url": null, + "name": "azure-sdk-fake", + "node_id": "R_kgDOHkcrQg", + "notifications_url": "https://api.github.com/repos/Azure/azure-sdk-fake/notifications{?since,all,participating}", + "open_issues": 6, + "open_issues_count": 6, + "owner": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + }, + "private": false, + "pulls_url": "https://api.github.com/repos/Azure/azure-sdk-fake/pulls{/number}", + "pushed_at": "2023-01-27T16:33:00Z", + "releases_url": "https://api.github.com/repos/Azure/azure-sdk-fake/releases{/id}", + "size": 29098, + "ssh_url": "git@github.com:Azure/azure-sdk-fake.git", + "stargazers_count": 0, + "stargazers_url": "https://api.github.com/repos/Azure/azure-sdk-fake/stargazers", + "statuses_url": "https://api.github.com/repos/Azure/azure-sdk-fake/statuses/{sha}", + "subscribers_url": "https://api.github.com/repos/Azure/azure-sdk-fake/subscribers", + "subscription_url": "https://api.github.com/repos/Azure/azure-sdk-fake/subscription", + "svn_url": "https://github.com/Azure/azure-sdk-fake", + "tags_url": "https://api.github.com/repos/Azure/azure-sdk-fake/tags", + "teams_url": "https://api.github.com/repos/Azure/azure-sdk-fake/teams", + "topics": [], + "trees_url": "https://api.github.com/repos/Azure/azure-sdk-fake/git/trees{/sha}", + "updated_at": "2023-01-23T19:54:18Z", + "url": "https://api.github.com/repos/Azure/azure-sdk-fake", + "visibility": "public", + "watchers": 0, + "watchers_count": 0, + "web_commit_signoff_required": false + }, + "sender": { + "avatar_url": "https://avatars.githubusercontent.com/u/13556087?v=4", + "events_url": "https://api.github.com/users/FakeUser1/events{/privacy}", + "followers_url": "https://api.github.com/users/FakeUser1/followers", + "following_url": "https://api.github.com/users/FakeUser1/following{/other_user}", + "gists_url": "https://api.github.com/users/FakeUser1/gists{/gist_id}", + "gravatar_id": "", + "html_url": "https://github.com/FakeUser1", + "id": 13556087, + "login": "FakeUser1", + "node_id": "MDQ6VXNlcjEzNTU2MDg3", + "organizations_url": "https://api.github.com/users/FakeUser1/orgs", + "received_events_url": "https://api.github.com/users/FakeUser1/received_events", + "repos_url": "https://api.github.com/users/FakeUser1/repos", + "site_admin": false, + "starred_url": "https://api.github.com/users/FakeUser1/starred{/owner}{/repo}", + "subscriptions_url": "https://api.github.com/users/FakeUser1/subscriptions", + "type": "User", + "url": "https://api.github.com/users/FakeUser1" + } +} diff --git a/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/documentation/images/action_event.png b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/documentation/images/action_event.png new file mode 100644 index 00000000000..18c020b9de0 Binary files /dev/null and b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/documentation/images/action_event.png differ diff --git a/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/documentation/images/action_event_details.png b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/documentation/images/action_event_details.png new file mode 100644 index 00000000000..bb829aa75ba Binary files /dev/null and b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/documentation/images/action_event_details.png differ diff --git a/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/documentation/images/event_payload.png b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/documentation/images/event_payload.png new file mode 100644 index 00000000000..dfba1cf85d5 Binary files /dev/null and b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor.Tests/documentation/images/event_payload.png differ diff --git a/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor/Azure.Sdk.Tools.GitHubEventProcessor.csproj b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor/Azure.Sdk.Tools.GitHubEventProcessor.csproj new file mode 100644 index 00000000000..f2492030eb6 --- /dev/null +++ b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor/Azure.Sdk.Tools.GitHubEventProcessor.csproj @@ -0,0 +1,18 @@ + + + + Exe + net6.0 + true + github-event-processor + + + + + + + + + + + diff --git a/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor/Constants/ActionConstants.cs b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor/Constants/ActionConstants.cs new file mode 100644 index 00000000000..204ea67f534 --- /dev/null +++ b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor/Constants/ActionConstants.cs @@ -0,0 +1,37 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Azure.Sdk.Tools.GitHubEventProcessor.Constants +{ + /// + /// Action constants for github actions. These match the activity types for events defined in the + /// github docs https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows. + /// Some activities belong to multiple events, for example issues and pull_requests both have an + /// opened event. + /// + public class ActionConstants + { + public const string Assigned = "assigned"; + public const string Created = "created"; + public const string Closed = "closed"; + public const string Deleted = "deleted"; + public const string Demilestoned = "demilestoned"; + public const string Dismissed = "dismissed"; + public const string Edited = "edited"; + public const string Labeled = "labeled"; + public const string Locked = "locked"; + public const string Milestoned = "milestoned"; + public const string Opened = "opened"; + public const string Pinned = "pinned"; + public const string Reopened = "reopened"; + public const string ReviewRequested = "review_requested"; + public const string Submitted = "submitted"; + public const string Synchronize = "synchronize"; + public const string Transferred = "transferred"; + public const string Unassigned = "unassigned"; + public const string Unlabeled = "unlabeled"; + public const string Unlocked = "unlocked"; + public const string Unpinned = "unpinned"; + } +} diff --git a/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor/Constants/CommentConstants.cs b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor/Constants/CommentConstants.cs new file mode 100644 index 00000000000..abd9c91c5b3 --- /dev/null +++ b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor/Constants/CommentConstants.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Drawing; +using System.Text; + +namespace Azure.Sdk.Tools.GitHubEventProcessor.Constants +{ + /// + /// Strings in comments that cause actions to be included/excluded from processing. + /// + public class CommentConstants + { + // /azp does things like prepares new pipelines or kicks off pipelines and should + // also be ignored for comment processing. + public const string Azp = "/azp"; + // Check Enforcer commands are all /check-enforcer + // "What is Check Enforcer" is effectively dead + public const string CheckEnforcer = "/check-enforcer"; + // This is used to reopen an issue in a comment and causes actions to happen + public const string Reopen = "/reopen"; + // This is part of the message that's added to a PR that's being closed as part of the cron job that + // closes stale pull requests. There's a rule that looks for this string as part of a pull request comment to + // prevent an action. + public const string ScheduledCloseFragment = "Since there hasn't been recent engagement, this is being closed out."; + // used to unresolve an issue in a comment and causes actions to happen + public const string Unresolve = "/unresolve"; + } +} diff --git a/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor/Constants/EventConstants.cs b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor/Constants/EventConstants.cs new file mode 100644 index 00000000000..6c19177c4cf --- /dev/null +++ b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor/Constants/EventConstants.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Azure.Sdk.Tools.GitHubEventProcessor.Constants +{ + + /// + /// Event constants for the events that are being being processed. These are from the + /// github docs https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows. + /// + public class EventConstants + { + public const string Issues = "issues"; + public const string IssueComment = "issue_comment"; + public const string PullRequestReview = "pull_request_review"; + public const string PullRequestTarget = "pull_request_target"; + public const string Schedule = "schedule"; + } +} diff --git a/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor/Constants/LabelConstants.cs b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor/Constants/LabelConstants.cs new file mode 100644 index 00000000000..3c96389b383 --- /dev/null +++ b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor/Constants/LabelConstants.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Azure.Sdk.Tools.GitHubEventProcessor.Constants +{ + + /// + /// These are label constants that are common to all language repositories and ones + /// that the rules use for processing. No team, or lanaguage specific labels belong + /// in here. + /// + public class LabelConstants + { + public const string CommunityContribution = "Community Contribution"; + public const string CustomerReported = "customer-reported"; + public const string CXPAttention = "CXP Attention"; + public const string IssueAddressed = "issue-addressed"; + public const string NeedsAuthorFeedback = "needs-author-feedback"; + public const string NeedsTeamAttention = "needs-team-attention"; + public const string NeedsTeamTriage = "needs-team-triage"; + public const string NeedsTriage = "needs-triage"; + public const string NoRecentActivity = "no-recent-activity"; + public const string Question = "question"; + public const string ServiceAttention = "Service Attention"; + } +} diff --git a/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor/Constants/OrgConstants.cs b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor/Constants/OrgConstants.cs new file mode 100644 index 00000000000..548b645f996 --- /dev/null +++ b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor/Constants/OrgConstants.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Azure.Sdk.Tools.GitHubEventProcessor.Constants +{ + /// + /// Organization and product constants. + /// + public class OrgConstants + { + // The Azure is used to check whether or not the use is a member of Azure org. + public const string Azure = "Azure"; + // The ProductHeaderName is used to register the GitHubClient, specificially, for this + // application + public const string ProductHeaderName = "azure-sdk-github-event-processor"; + } +} diff --git a/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor/Constants/PermissionLevel.cs b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor/Constants/PermissionLevel.cs new file mode 100644 index 00000000000..0fb312fc33a --- /dev/null +++ b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor/Constants/PermissionLevel.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Octokit.Internal; + +namespace Azure.Sdk.Tools.GitHubEventProcessor.Constants +{ + // This is temporary. Octkit's 5.x release on 03/09/2023 included some breaking changes with permissions. + // GitHubClient.Repository.Collaborator.ReviewPermission now returns a CollaboratorPermissionResponse + // which still includes the legacy Collaborator permissions on the Permissions attribute but the enum + // was removed. New, Collaborator permissions (CollaboratorPermission in Octokit/Models/Common/Permission.cs) + // are on the Collaborator attribute and are a completely different set of permissions. + public class PermissionLevel + { + public const string Admin = "admin"; + public const string Write = "write"; + public const string Read = "read"; + public const string None = "none"; + } +} diff --git a/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor/Constants/RulesConstants.cs b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor/Constants/RulesConstants.cs new file mode 100644 index 00000000000..13d23c37488 --- /dev/null +++ b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor/Constants/RulesConstants.cs @@ -0,0 +1,54 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Azure.Sdk.Tools.GitHubEventProcessor.Constants +{ + /// + /// Rules constants are used in the rules configuration to determine which actions are + /// available for a given repository. + /// + public class RulesConstants + { + // issue rules + public const string InitialIssueTriage = "InitialIssueTriage"; + public const string ManualIssueTriage = "ManualIssueTriage"; + public const string ServiceAttention = "ServiceAttention"; + public const string CXPAttention = "CXPAttention"; + public const string ManualTriageAfterExternalAssignment = "ManualTriageAfterExternalAssignment"; + public const string RequireAttentionForNonMilestone = "RequireAttentionForNonMilestone"; + public const string AuthorFeedbackNeeded = "AuthorFeedbackNeeded"; + public const string IssueAddressed = "IssueAddressed"; + public const string IssueAddressedReset = "IssueAddressedReset"; + + // issue_comment rules + public const string AuthorFeedback = "AuthorFeedback"; + public const string ReopenIssue = "ReopenIssue"; + public const string DeclineToReopenIssue = "DeclineToReopenIssue"; + public const string IssueAddressedCommands = "IssueAddressedCommands"; + + // pull_request rules + public const string PullRequestTriage = "PullRequestTriage"; + public const string ResetApprovalsForUntrustedChanges = "ResetApprovalsForUntrustedChanges"; + + // pull_request_comment rules + public const string ReopenPullRequest = "ReopenPullRequest"; + + // Rules that apply to multiple events + // ResetIssueActivity applies to issue and issue_comment + public const string ResetIssueActivity = "ResetIssueActivity"; + // ResetPullRequestActivity applies to pull_request, pull_request_comment and pull_request_review + public const string ResetPullRequestActivity = "ResetPullRequestActivity"; + + // Cron task rules + public const string CloseStaleIssues = "CloseStaleIssues"; + public const string CloseStalePullRequests = "CloseStalePullRequests"; + public const string IdentifyStaleIssues = "IdentifyStaleIssues"; + public const string IdentifyStalePullRequests = "IdentifyStalePullRequests"; + public const string CloseAddressedIssues = "CloseAddressedIssues"; + public const string LockClosedIssues = "LockClosedIssues"; + + } +} diff --git a/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor/EventProcessing/IssueCommentProcessing.cs b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor/EventProcessing/IssueCommentProcessing.cs new file mode 100644 index 00000000000..b48d4611397 --- /dev/null +++ b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor/EventProcessing/IssueCommentProcessing.cs @@ -0,0 +1,207 @@ +using System; +using Azure.Sdk.Tools.GitHubEventProcessor.Utils; +using System.Threading.Tasks; +using Octokit; +using Azure.Sdk.Tools.GitHubEventProcessor.Constants; + +namespace Azure.Sdk.Tools.GitHubEventProcessor.EventProcessing +{ + public class IssueCommentProcessing + { + + /// + /// Every rule will have it's own function that will be called here, the rule configuration will determine + /// which rules will execute. + /// + /// Authenticated GitHubEventClient + /// IssueCommentPayload deserialized from the json event payload + public static async Task ProcessIssueCommentEvent(GitHubEventClient gitHubEventClient, IssueCommentPayload issueCommentPayload) + { + AuthorFeedback(gitHubEventClient, issueCommentPayload); + ResetIssueActivity(gitHubEventClient, issueCommentPayload); + ReopenIssue(gitHubEventClient, issueCommentPayload); + await DeclineToReopenIssue(gitHubEventClient, issueCommentPayload); + await IssueAddressedCommands(gitHubEventClient, issueCommentPayload); + + // After all of the rules have been processed, call to process pending updates + await gitHubEventClient.ProcessPendingUpdates(issueCommentPayload.Repository.Id, issueCommentPayload.Issue.Number); + } + + /// + /// Author Feedback + /// Trigger: issue comment created + /// Conditions: Issue is open + /// Issue has "needs-author-feedback" label + /// Commenter is the original issue author + /// Resulting Action: + /// Remove "needs-author-feedback" label + /// Add "needs-team-attention" label + /// Create issue comment + /// + /// Authenticated GitHubEventClient + /// issue_comment event payload + public static void AuthorFeedback(GitHubEventClient gitHubEventClient, IssueCommentPayload issueCommentPayload) + { + if (gitHubEventClient.RulesConfiguration.RuleEnabled(RulesConstants.AuthorFeedback)) + { + if (issueCommentPayload.Action == ActionConstants.Created) + { + if (issueCommentPayload.Issue.State == ItemState.Open && + LabelUtils.HasLabel(issueCommentPayload.Issue.Labels, LabelConstants.NeedsAuthorFeedback) && + issueCommentPayload.Sender.Login == issueCommentPayload.Issue.User.Login) + { + var issueUpdate = gitHubEventClient.GetIssueUpdate(issueCommentPayload.Issue); + issueUpdate.RemoveLabel(LabelConstants.NeedsAuthorFeedback); + issueUpdate.AddLabel(LabelConstants.NeedsTeamAttention); + string issueComment = $"Hi @{issueCommentPayload.Sender.Login}. Thank you for opening this issue and giving us the opportunity to assist. To help our team better understand your issue and the details of your scenario please provide a response to the question asked above or the information requested above. This will help us more accurately address your issue."; + gitHubEventClient.CreateComment(issueCommentPayload.Repository.Id, issueCommentPayload.Issue.Number, issueComment); + } + } + } + } + /// + /// Reset Issue Activity + /// For issue_comments, the trigger Action is created + /// See Common_ResetIssueActivity comments + /// + /// Authenticated GitHubEventClient + /// issue_comment event payload + public static void ResetIssueActivity(GitHubEventClient gitHubEventClient, IssueCommentPayload issueCommentPayload) + { + if (issueCommentPayload.Action == ActionConstants.Created) + { + IssueProcessing.Common_ResetIssueActivity(gitHubEventClient, issueCommentPayload.Action, issueCommentPayload.Issue, issueCommentPayload.Sender); + } + } + + /// + /// Reopen Issue + /// Trigger: issue comment created + /// Conditions: Issue is closed + /// Issue has label "no-recent-activity" + /// Issue has label "needs-author-feedback" + /// Commenter is the original issue author + /// This is not happening because of a "comment with close". This can be checked + /// by seeing if the comment's CreatedAt date and issue's ClosedAt date are equal. + /// Has this issue been closed for less than 7 days + /// Resulting Action: + /// Remove "no-recent-activity" label + /// Remove "needs-author-feedback" label + /// Add "needs-team-attention" label + /// + /// Authenticated GitHubEventClient + /// issue_comment event payload + public static void ReopenIssue(GitHubEventClient gitHubEventClient, IssueCommentPayload issueCommentPayload) + { + if (gitHubEventClient.RulesConfiguration.RuleEnabled(RulesConstants.ReopenIssue)) + { + if (issueCommentPayload.Action == ActionConstants.Created) + { + if (issueCommentPayload.Issue.State == ItemState.Closed && + LabelUtils.HasLabel(issueCommentPayload.Issue.Labels, LabelConstants.NoRecentActivity) && + LabelUtils.HasLabel(issueCommentPayload.Issue.Labels, LabelConstants.NeedsAuthorFeedback) && + issueCommentPayload.Sender.Login == issueCommentPayload.Issue.User.Login && + issueCommentPayload.Comment.CreatedAt != issueCommentPayload.Issue.ClosedAt.Value && + // Ensure both times are in UTC so timezones don't get tripped up. ClosedAt is nullable + // but being that the issue is closed is part of the criteria, this will be set + DateTime.UtcNow <= issueCommentPayload.Issue.ClosedAt.Value.UtcDateTime.AddDays(7)) + { + var issueUpdate = gitHubEventClient.GetIssueUpdate(issueCommentPayload.Issue); + issueUpdate.RemoveLabel(LabelConstants.NeedsAuthorFeedback); + issueUpdate.RemoveLabel(LabelConstants.NoRecentActivity); + issueUpdate.AddLabel(LabelConstants.NeedsTeamAttention); + issueUpdate.State = ItemState.Open; + } + } + } + } + + /// + /// Decline To Reopen Issue + /// Trigger: issue comment created + /// Conditions: Issue is closed + /// Issue has been closed for more than 7 days + /// Commenter has collaborator permission of None + /// Note: the rule has Commenter is not a contributor, which is incorrect + /// Action is not "comment and close" + /// Resulting Action: + /// Add issue comment + /// + /// Authenticated GitHubEventClient + /// issue_comment event payload + public static async Task DeclineToReopenIssue(GitHubEventClient gitHubEventClient, IssueCommentPayload issueCommentPayload) + { + if (gitHubEventClient.RulesConfiguration.RuleEnabled(RulesConstants.DeclineToReopenIssue)) + { + if (issueCommentPayload.Action == ActionConstants.Created) + { + if (issueCommentPayload.Issue.State == ItemState.Closed && + issueCommentPayload.Comment.CreatedAt != issueCommentPayload.Issue.ClosedAt.Value && + // Ensure both times are in UTC so timezones don't get tripped up. ClosedAt is nullable + // but being that the issue is closed is part of the criteria, this will be set. + DateTime.UtcNow >= issueCommentPayload.Issue.ClosedAt.Value.UtcDateTime.AddDays(7)) + { + bool hasPermissionOfNone = await gitHubEventClient.DoesUserHavePermission(issueCommentPayload.Repository.Id, issueCommentPayload.Sender.Login, PermissionLevel.None); + if (hasPermissionOfNone) + { + string issueComment = "Thank you for your interest in this issue! Because it has been closed for a period of time, we strongly advise that you open a new issue linking to this to ensure better visibility of your comment."; + gitHubEventClient.CreateComment(issueCommentPayload.Repository.Id, issueCommentPayload.Issue.Number, issueComment); + } + } + } + } + } + + /// + /// Issue Addressed Commands + /// Trigger: issue comment created + /// Conditions: Has label "issue-addressed" + /// Comment text contains the string "/unresolve" + /// Resulting Action: + /// This depends on the permissions of the user who made the comment + /// If the user is the issue author and has write or admin permissions then + /// Reopen the issue + /// Remove label "issue-addressed" + /// Add label "needs-team-attention" + /// else + /// Add issue comment: + /// "Hi ${contextualAuthor}, only the original author of the issue can ask that it be unresolved. + /// Please open a new issue with your scenario and details if you would like to discuss this topic with the team." + /// + /// Authenticated GitHubEventClient + /// issue_comment event payload + public static async Task IssueAddressedCommands(GitHubEventClient gitHubEventClient, IssueCommentPayload issueCommentPayload) + { + if (gitHubEventClient.RulesConfiguration.RuleEnabled(RulesConstants.IssueAddressedCommands)) + { + if (issueCommentPayload.Action == ActionConstants.Created) + { + if (CommentUtils.CommentContainsText(issueCommentPayload.Comment.Body, CommentConstants.Unresolve) && + LabelUtils.HasLabel(issueCommentPayload.Issue.Labels, LabelConstants.IssueAddressed)) + { + bool hasAdminOrWritePermission = await gitHubEventClient.DoesUserHaveAdminOrWritePermission(issueCommentPayload.Repository.Id, issueCommentPayload.Sender.Login); + + // if the user who created the comment is the issue author OR the user has write or admin permission + if (issueCommentPayload.Sender.Login == issueCommentPayload.Issue.User.Login || + hasAdminOrWritePermission) + { + var issueUpdate = gitHubEventClient.GetIssueUpdate(issueCommentPayload.Issue); + issueUpdate.State = ItemState.Open; + issueUpdate.RemoveLabel(LabelConstants.IssueAddressed); + issueUpdate.AddLabel(LabelConstants.NeedsTeamAttention); + } + // else the user is not the original author AND they don't have admin or write permission + else + { + if (!hasAdminOrWritePermission) + { + string issueComment = $"Hi ${issueCommentPayload.Sender.Login}, only the original author of the issue can ask that it be unresolved. Please open a new issue with your scenario and details if you would like to discuss this topic with the team."; + gitHubEventClient.CreateComment(issueCommentPayload.Repository.Id, issueCommentPayload.Issue.Number, issueComment); + } + } + } + } + } + } + } +} diff --git a/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor/EventProcessing/IssueProcessing.cs b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor/EventProcessing/IssueProcessing.cs new file mode 100644 index 00000000000..0cf943cc1c5 --- /dev/null +++ b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor/EventProcessing/IssueProcessing.cs @@ -0,0 +1,445 @@ +using System; +using Octokit; +using System.Threading.Tasks; +using Azure.Sdk.Tools.GitHubEventProcessor.GitHubPayload; +using Azure.Sdk.Tools.GitHubEventProcessor.Constants; +using Azure.Sdk.Tools.GitHubEventProcessor.Utils; +using System.ComponentModel; +using System.Diagnostics.Metrics; +using static System.Net.Mime.MediaTypeNames; +using System.Reflection.Emit; +using System.Reflection.Metadata; +using System.Xml.Linq; +using System.Collections.Generic; + +namespace Azure.Sdk.Tools.GitHubEventProcessor.EventProcessing +{ + public class IssueProcessing + { + /// + /// Every rule will have it's own function that will be called here, the rule configuration will determine + /// which rules will execute. + /// + /// Authenticated GitHubEventClient + /// IssueEventGitHubPayload deserialized from the json event payload + public static async Task ProcessIssueEvent(GitHubEventClient gitHubEventClient, IssueEventGitHubPayload issueEventPayload) + { + await InitialIssueTriage(gitHubEventClient, issueEventPayload); + ManualIssueTriage(gitHubEventClient, issueEventPayload); + ServiceAttention(gitHubEventClient, issueEventPayload); + CXPAttention(gitHubEventClient, issueEventPayload); + ManualTriageAfterExternalAssignment(gitHubEventClient, issueEventPayload); + RequireAttentionForNonMilestone(gitHubEventClient, issueEventPayload); + AuthorFeedbackNeeded(gitHubEventClient, issueEventPayload); + IssueAddressed(gitHubEventClient, issueEventPayload); + IssueAddressedReset(gitHubEventClient, issueEventPayload); + + // After all of the rules have been processed, call to process pending updates + await gitHubEventClient.ProcessPendingUpdates(issueEventPayload.Repository.Id, issueEventPayload.Issue.Number); + } + + /// + /// Note: This function does not yet process the way the rule was written because that requires information + /// we do not yet have. The proposal is to update CODEOWNERS which is still TBD. When that's updated, this + /// rule will need to be updated accordingly. The issue tracking this is + /// https://github.com/Azure/azure-sdk-tools/issues/5743 + /// Initial Issue Triage + /// Trigger: issue opened + /// Conditions: Issue has no labels + /// Issue has no assignee + /// Resulting Actions: + /// Evaluate the user that created the issue: + /// IF creator is NOT an Azure SDK team owner + /// AND is NOT a member of the Azure organization + /// AND does NOT have write permission + /// AND does NOT have admin permission: + /// Add "customer-reported" label + /// Add "question" label + /// Query AI label service for label suggestions: + /// IF labels were predicted: + /// Assign returned labels to the issue + /// Add "needs-team-attention" label to the issue + /// IF service label is associated with an Azure SDK team member: + /// IF a single team member: + /// Assign team member to the issue + /// ELSE + /// Assign a random team member from the set to the issue + /// Add a comment mentioning the other team members from the set + /// Add comment indicating issue was routed for assistance: "Thank you for your feedback. Tagging and routing to the team member best able to assist." + /// ELSE (service label is not associated with an Azure SDK team member) + /// Add "CXP Attention" label to the issue + /// Create a comment mentioning(content from .NET rule #30) + /// ELSE (labels were not predicted) + /// Add "needs-triage" label to the issue + /// + /// Authenticated GitHubEventClient + /// IssueEventGitHubPayload deserialized from the json event payload + public static async Task InitialIssueTriage(GitHubEventClient gitHubEventClient, IssueEventGitHubPayload issueEventPayload) + { + if (gitHubEventClient.RulesConfiguration.RuleEnabled(RulesConstants.InitialIssueTriage)) + { + if (issueEventPayload.Action == ActionConstants.Opened) + { + // If there are no labels and no assignees + if ((issueEventPayload.Issue.Labels.Count == 0) && (issueEventPayload.Issue.Assignee == null)) + { + // This is a stop-gap. To do what is above, we need CODEOWNERS changes which don't exist yet. + // For the moment, if there are no label suggestions add needs-triage and if there + // are, add them and then add needs-team-triage. The issue created to track these future updates + // is https://github.com/Azure/azure-sdk-tools/issues/5743 + List labelSuggestions = await gitHubEventClient.QueryAILabelService(issueEventPayload); + IssueUpdate issueUpdate = gitHubEventClient.GetIssueUpdate(issueEventPayload.Issue); + if (labelSuggestions.Count > 0 ) + { + foreach (string label in labelSuggestions) + { + issueUpdate.AddLabel(label); + } + issueUpdate.AddLabel(LabelConstants.NeedsTeamTriage); + } + else + { + issueUpdate.AddLabel(LabelConstants.NeedsTriage); + } + } + } + } + } + + /// + /// Manual Issue Triage + /// Trigger: issue labeled + /// Conditions: Issue is open + /// Issue has "needs-triage" label + /// Label being added is NOT "needs-triage" + /// Resulting Action: Remove "needs-triage" label + /// + /// Authenticated GitHubEventClient + /// IssueEventGitHubPayload deserialized from the json event payload + public static void ManualIssueTriage(GitHubEventClient gitHubEventClient, IssueEventGitHubPayload issueEventPayload) + { + if (gitHubEventClient.RulesConfiguration.RuleEnabled(RulesConstants.ManualIssueTriage)) + { + if (issueEventPayload.Action == ActionConstants.Labeled) + { + // if the issue is open, has needs-triage label and label being added is not needs-triage + // then remove the needs-triage label + if (issueEventPayload.Issue.State == ItemState.Open && + LabelUtils.HasLabel(issueEventPayload.Issue.Labels, LabelConstants.NeedsTriage) && + !issueEventPayload.Label.Name.Equals(LabelConstants.NeedsTriage)) + { + var issueUpdate = gitHubEventClient.GetIssueUpdate(issueEventPayload.Issue); + issueUpdate.RemoveLabel(LabelConstants.NeedsTriage); + } + } + } + } + + /// + /// Service Attention + /// Trigger: issue labeled + /// Conditions: Issue is open + /// Label being added is "Service Attention" + /// Resulting Action: Add issue comment "Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc ${mentionees}." + /// + /// Authenticated GitHubEventClient + /// IssueEventGitHubPayload deserialized from the json event payload + public static void ServiceAttention(GitHubEventClient gitHubEventClient, IssueEventGitHubPayload issueEventPayload) + { + if (gitHubEventClient.RulesConfiguration.RuleEnabled(RulesConstants.ServiceAttention)) + { + if (issueEventPayload.Action == ActionConstants.Labeled) + { + // If the issue is open, and the label being added is ServiceAttention + if (issueEventPayload.Issue.State == ItemState.Open && + issueEventPayload.Label.Name.Equals(LabelConstants.ServiceAttention)) + { + // Before bothering to fetch parties to mention from the CodeOwners file, ensure that ServiceAttention + // isn't the only label on the issue. + if (issueEventPayload.Issue.Labels.Count > 1) + { + string partiesToMention = CodeOwnerUtils.GetPartiesToMentionForServiceAttention(issueEventPayload.Issue.Labels); + if (null != partiesToMention) + { + string issueComment = $"Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc {partiesToMention}."; + gitHubEventClient.CreateComment(issueEventPayload.Repository.Id, issueEventPayload.Issue.Number, issueComment); + } + else + { + // If there are no codeowners found then output the issue URL so it's in the logs for the event + Console.WriteLine($"There were no parties to mention for issue: {issueEventPayload.Issue.Url}"); + } + } + else + { + Console.WriteLine($"{LabelConstants.ServiceAttention} is the only label on the issue. Other labels are required in order to get parties to mention from the Codeowners file."); + } + } + } + } + } + + /// + /// CXP Attention + /// Trigger: issue labeled + /// Conditions: Issue is open + /// Label being added is "CXP Attention" + /// Does not have "Service-Attention" label + /// Resulting Action: Add issue comment "Thank you for your feedback. This has been routed to the support team for assistance." + /// Note: The comment added for this rule seems odd, since there's not much of anything of consequence in the comment. + /// The CXP team has a dashboard and automation specifically tied to the CXP Attention label. The comment is necessary to count + /// as an initial response for SLA metrics. + /// + /// Authenticated GitHubEventClient + /// IssueEventGitHubPayload deserialized from the json event payload + public static void CXPAttention(GitHubEventClient gitHubEventClient, IssueEventGitHubPayload issueEventPayload) + { + if (gitHubEventClient.RulesConfiguration.RuleEnabled(RulesConstants.CXPAttention)) + { + if (issueEventPayload.Action == ActionConstants.Labeled) + { + + if (issueEventPayload.Issue.State == ItemState.Open && + issueEventPayload.Label.Name.Equals(LabelConstants.CXPAttention) && + !LabelUtils.HasLabel(issueEventPayload.Issue.Labels, LabelConstants.ServiceAttention)) + { + string issueComment = "Thank you for your feedback. This has been routed to the support team for assistance."; + gitHubEventClient.CreateComment(issueEventPayload.Repository.Id, issueEventPayload.Issue.Number, issueComment); + } + } + } + } + + /// + /// Manual Triage After External Assignment + /// Trigger: issue unlabeled + /// Conditions: Issue is open + /// Has "customer-reported" label + /// Label removed is "Service Attention" OR "CXP Attention" + /// Resulting Action: Add "needs-team-triage" label + /// + /// Authenticated GitHubEventClient + /// IssueEventGitHubPayload deserialized from the json event payload + public static void ManualTriageAfterExternalAssignment(GitHubEventClient gitHubEventClient, IssueEventGitHubPayload issueEventPayload) + { + if (gitHubEventClient.RulesConfiguration.RuleEnabled(RulesConstants.ManualTriageAfterExternalAssignment)) + { + if (issueEventPayload.Action == ActionConstants.Unlabeled) + { + if (issueEventPayload.Issue.State == ItemState.Open && + LabelUtils.HasLabel(issueEventPayload.Issue.Labels, LabelConstants.CustomerReported) && + (issueEventPayload.Label.Name.Equals(LabelConstants.CXPAttention) || + issueEventPayload.Label.Name.Equals(LabelConstants.ServiceAttention)) && + !LabelUtils.HasLabel(issueEventPayload.Issue.Labels, LabelConstants.NeedsTeamTriage)) + { + var issueUpdate = gitHubEventClient.GetIssueUpdate(issueEventPayload.Issue); + issueUpdate.AddLabel(LabelConstants.NeedsTeamTriage); + } + } + } + } + + /// + /// Reset Issue Activity + /// For issue, the trigger is Edited or Reopened + /// See Common_ResetIssueActivity comments + /// + /// Authenticated GitHubEventClient + /// IssueEventGitHubPayload deserialized from the json event payload + public static void ResetIssueActivity(GitHubEventClient gitHubEventClient, IssueEventGitHubPayload issueEventPayload) + { + if (issueEventPayload.Action == ActionConstants.Edited || issueEventPayload.Action == ActionConstants.Reopened) + { + // The rules check is in the common function + Common_ResetIssueActivity(gitHubEventClient, issueEventPayload.Action, issueEventPayload.Issue, issueEventPayload.Sender); + } + } + + /// + /// Common function for Reset Issue Activity + /// Trigger: issue reopened/edited, issue_comment created + /// Conditions: Issue is open OR Issue is being reopened + /// Issue has "no-recent-activity" label + /// User modifying the issue is NOT a known bot + /// Resulting Action: Remove "no-recent-activity" label + /// + /// Authenticated GitHubEventClient + /// The action being performed, from the payload object + /// Octokit.Issue object from the respective payload. + /// Octokit.User from the payload's Sender. + public static void Common_ResetIssueActivity(GitHubEventClient gitHubEventClient, string action, Issue issue, User sender) + { + if (gitHubEventClient.RulesConfiguration.RuleEnabled(RulesConstants.ResetIssueActivity)) + { + if ((issue.State == ItemState.Open || action == ActionConstants.Reopened) && + LabelUtils.HasLabel(issue.Labels, LabelConstants.NoRecentActivity) && + // If a user is a known GitHub bot, the user's AccountType will be Bot + sender.Type != AccountType.Bot) + { + var issueUpdate = gitHubEventClient.GetIssueUpdate(issue); + issueUpdate.RemoveLabel(LabelConstants.NoRecentActivity); + } + } + } + + /// + /// Require Attention For Non Milestone + /// Trigger: issue labeled/unlabeled + /// Conditions: Issue is open + /// Issue has label "customer-reported" + /// Issue does NOT have label "needs-team-attention" + /// Issue does NOT have label "needs-triage" + /// Issue does NOT have label "needs-team-triage" + /// Issue does NOT have label "needs-author-feedback" + /// Issue does NOT have label "issue-addressed" + /// Issue is not in a milestone + /// Resulting Action: Add "needs-team-attention" label + /// + /// Authenticated GitHubEventClient + /// IssueEventGitHubPayload deserialized from the json event payload + public static void RequireAttentionForNonMilestone(GitHubEventClient gitHubEventClient, IssueEventGitHubPayload issueEventPayload) + { + if (gitHubEventClient.RulesConfiguration.RuleEnabled(RulesConstants.RequireAttentionForNonMilestone)) + { + if (issueEventPayload.Action == ActionConstants.Labeled || issueEventPayload.Action == ActionConstants.Unlabeled) + { + if (issueEventPayload.Issue.State == ItemState.Open && + LabelUtils.HasLabel(issueEventPayload.Issue.Labels, LabelConstants.CustomerReported) && + !LabelUtils.HasLabel(issueEventPayload.Issue.Labels, LabelConstants.NeedsTeamAttention) && + !LabelUtils.HasLabel(issueEventPayload.Issue.Labels, LabelConstants.NeedsTriage) && + !LabelUtils.HasLabel(issueEventPayload.Issue.Labels, LabelConstants.NeedsTeamTriage) && + !LabelUtils.HasLabel(issueEventPayload.Issue.Labels, LabelConstants.NeedsAuthorFeedback) && + !LabelUtils.HasLabel(issueEventPayload.Issue.Labels, LabelConstants.IssueAddressed) && + null == issueEventPayload.Issue.Milestone) + { + var issueUpdate = gitHubEventClient.GetIssueUpdate(issueEventPayload.Issue); + issueUpdate.AddLabel(LabelConstants.NeedsTeamAttention); + } + } + } + } + + /// + /// Author Feedback Needed + /// Trigger: issue labeled + /// Conditions: Issue is open + /// Label added is "needs-author-feedback" + /// Resulting Action: + /// Remove "needs-triage" label + /// Remove "needs-team-triage" label + /// Remove "needs-team-attention" label + /// + /// Authenticated GitHubEventClient + /// IssueEventGitHubPayload deserialized from the json event payload + public static void AuthorFeedbackNeeded(GitHubEventClient gitHubEventClient, IssueEventGitHubPayload issueEventPayload) + { + if (gitHubEventClient.RulesConfiguration.RuleEnabled(RulesConstants.AuthorFeedbackNeeded)) + { + if (issueEventPayload.Action == ActionConstants.Labeled) + { + if (issueEventPayload.Issue.State == ItemState.Open && + issueEventPayload.Label.Name == LabelConstants.NeedsAuthorFeedback && + // Any of these labels will be removed if they exist on the Issue. If none exist then + // there's nothing to do. + (LabelUtils.HasLabel(issueEventPayload.Issue.Labels, LabelConstants.NeedsTriage) || + LabelUtils.HasLabel(issueEventPayload.Issue.Labels, LabelConstants.NeedsTeamTriage) || + LabelUtils.HasLabel(issueEventPayload.Issue.Labels, LabelConstants.NeedsTeamAttention))) + { + var issueUpdate = gitHubEventClient.GetIssueUpdate(issueEventPayload.Issue); + issueUpdate.RemoveLabel(LabelConstants.NeedsTriage); + issueUpdate.RemoveLabel(LabelConstants.NeedsTeamTriage); + issueUpdate.RemoveLabel(LabelConstants.NeedsTeamAttention); + } + } + } + } + + /// + /// Issue Addressed + /// Trigger: issue labeled + /// Conditions: Issue is open + /// Label added is "issue-addressed" + /// Resulting Action: + /// Remove "needs-triage" label + /// Remove "needs-team-triage" label + /// Remove "needs-team-attention" label + /// Remove "needs-author-feedback" label + /// Remove "no-recent-activity" label + /// Add issue comment + /// + /// Authenticated GitHubEventClient + /// IssueEventGitHubPayload deserialized from the json event payload + public static void IssueAddressed(GitHubEventClient gitHubEventClient, IssueEventGitHubPayload issueEventPayload) + { + if (gitHubEventClient.RulesConfiguration.RuleEnabled(RulesConstants.IssueAddressed)) + { + if (issueEventPayload.Action == ActionConstants.Labeled) + { + if (issueEventPayload.Issue.State == ItemState.Open && + issueEventPayload.Label.Name == LabelConstants.IssueAddressed) + { + // Don't bother creating the issue update unless at least one of the labels + // to be removed exists on the issue + if (LabelUtils.HasLabel(issueEventPayload.Issue.Labels, LabelConstants.NeedsTriage) || + LabelUtils.HasLabel(issueEventPayload.Issue.Labels, LabelConstants.NeedsTeamTriage) || + LabelUtils.HasLabel(issueEventPayload.Issue.Labels, LabelConstants.NeedsTeamAttention) || + LabelUtils.HasLabel(issueEventPayload.Issue.Labels, LabelConstants.NeedsAuthorFeedback) || + LabelUtils.HasLabel(issueEventPayload.Issue.Labels, LabelConstants.NoRecentActivity)) + { + var issueUpdate = gitHubEventClient.GetIssueUpdate(issueEventPayload.Issue); + issueUpdate.RemoveLabel(LabelConstants.NeedsTriage); + issueUpdate.RemoveLabel(LabelConstants.NeedsTeamTriage); + issueUpdate.RemoveLabel(LabelConstants.NeedsTeamAttention); + issueUpdate.RemoveLabel(LabelConstants.NeedsAuthorFeedback); + issueUpdate.RemoveLabel(LabelConstants.NoRecentActivity); + } + // The comment is always created + string issueComment = $"Hi @{issueEventPayload.Issue.User.Login}. Thank you for opening this issue and giving us the opportunity to assist. We believe that this has been addressed. If you feel that further discussion is needed, please add a comment with the text \"/unresolve\" to remove the \"issue-addressed\" label and continue the conversation."; + gitHubEventClient.CreateComment(issueEventPayload.Repository.Id, issueEventPayload.Issue.Number, issueComment); + } + } + } + } + + /// + /// Issue Addressed Reset + /// Trigger: issue labeled + /// Conditions: Issue is open + /// Issue has label "issue-addressed" + /// Label added is any one of: + /// "needs-team-attention" + /// "needs-author-feedback" + /// "Service Attention" + /// "CXP Attention" + /// "needs-triage" + /// "needs-team-triage" + /// Resulting Action: + /// Remove "issue-addressed" label + /// + /// Authenticated GitHubEventClient + /// IssueEventGitHubPayload deserialized from the json event payload + public static void IssueAddressedReset(GitHubEventClient gitHubEventClient, IssueEventGitHubPayload issueEventPayload) + { + if (gitHubEventClient.RulesConfiguration.RuleEnabled(RulesConstants.IssueAddressedReset)) + { + if (issueEventPayload.Action == ActionConstants.Labeled) + { + if (issueEventPayload.Issue.State == ItemState.Open && + LabelUtils.HasLabel(issueEventPayload.Issue.Labels, LabelConstants.IssueAddressed)) + { + if (issueEventPayload.Label.Name == LabelConstants.NeedsTeamAttention || + issueEventPayload.Label.Name == LabelConstants.NeedsAuthorFeedback || + issueEventPayload.Label.Name == LabelConstants.ServiceAttention || + issueEventPayload.Label.Name == LabelConstants.CXPAttention || + issueEventPayload.Label.Name == LabelConstants.NeedsTriage || + issueEventPayload.Label.Name == LabelConstants.NeedsTeamTriage) + { + var issueUpdate = gitHubEventClient.GetIssueUpdate(issueEventPayload.Issue); + issueUpdate.RemoveLabel(LabelConstants.IssueAddressed); + } + } + } + } + } + } +} diff --git a/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor/EventProcessing/PullRequestCommentProcessing.cs b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor/EventProcessing/PullRequestCommentProcessing.cs new file mode 100644 index 00000000000..0c586336b41 --- /dev/null +++ b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor/EventProcessing/PullRequestCommentProcessing.cs @@ -0,0 +1,147 @@ +using System; +using System.Collections.Generic; +using System.Text; +using Azure.Sdk.Tools.GitHubEventProcessor.GitHubPayload; +using Azure.Sdk.Tools.GitHubEventProcessor.Utils; +using Octokit.Internal; +using Octokit; +using System.Threading.Tasks; +using Azure.Sdk.Tools.GitHubEventProcessor.Constants; + +namespace Azure.Sdk.Tools.GitHubEventProcessor.EventProcessing +{ + public class PullRequestCommentProcessing + { + /// + /// Every rule will have it's own function that will be called here, the rule configuration will determine + /// which rules will execute. + /// It's worth noting here that Issue and PullRequest comments are the same event payload, IssueCommentPayload. + /// The different between the two is whether or not the IssueCommentPayload.Issue.PullRequest is null. This + /// is the way github differentiates these. + /// + /// Authenticated GitHubEventClient + /// IssueCommentPayload deserialized from the json event payload + public static async Task ProcessPullRequestCommentEvent(GitHubEventClient gitHubEventClient, IssueCommentPayload prCommentPayload) + { + await ResetPullRequestActivity(gitHubEventClient, prCommentPayload); + await ReopenPullRequest(gitHubEventClient, prCommentPayload); + + // After all of the rules have been processed, call to process pending updates + await gitHubEventClient.ProcessPendingUpdates(prCommentPayload.Repository.Id, prCommentPayload.Issue.Number); + } + + /// + /// Reset Pull Request Activity + /// Normally there's supposed to be a common function but the PullRequest object on the IssueCommentPayload isn't complete. + /// All of the things like labels and whatnot need to come from the Issue. + /// Trigger: issue_comment created on a pull request + /// Conditions for pull request comment + /// Pull request has "no-recent-activity" label + /// User modifying the pull request is not a bot + /// Commenter is the pull request author OR has admin or write permissions + /// Comment is not a /check-enforcer or /azp command + /// Comment is not from an auto-close event. Note: This could happen if the + /// the cron task wasn't executed with secrets.GITHUB_TOKEN (aka someone ran + /// the task from their own personal token.) + /// + /// Authenticated GitHubEventClient + /// IssueCommentPayload deserialized from the json event payload + public static async Task ResetPullRequestActivity(GitHubEventClient gitHubEventClient, + IssueCommentPayload prCommentPayload) + { + if (gitHubEventClient.RulesConfiguration.RuleEnabled(RulesConstants.ResetPullRequestActivity)) + { + if (prCommentPayload.Sender.Type != AccountType.Bot && + LabelUtils.HasLabel(prCommentPayload.Issue.Labels, LabelConstants.NoRecentActivity)) + { + if (prCommentPayload.Action == ActionConstants.Created && + prCommentPayload.Issue.State == ItemState.Open && + !CommentUtils.CommentContainsText(prCommentPayload.Comment.Body, CommentConstants.CheckEnforcer) && + !CommentUtils.CommentContainsText(prCommentPayload.Comment.Body, CommentConstants.Azp) && + !CommentUtils.CommentContainsText(prCommentPayload.Comment.Body, CommentConstants.ScheduledCloseFragment)) + { + bool removeLabel = false; + // If the commenter is the pull request author then the label can be + // removed without a permissions check + if (prCommentPayload.Issue.User.Login == prCommentPayload.Sender.Login) + { + removeLabel = true; + } + else + { + // If the user who made the comment has admin or write permissions then + // the label can be removed + bool hasWriteOrAdminPermissions = await gitHubEventClient.DoesUserHaveAdminOrWritePermission(prCommentPayload.Repository.Id, prCommentPayload.Sender.Login); + if (hasWriteOrAdminPermissions) + { + removeLabel = true; + } + } + + if (removeLabel) + { + var issueUpdate = gitHubEventClient.GetIssueUpdate(prCommentPayload.Issue); + issueUpdate.RemoveLabel(LabelConstants.NoRecentActivity); + } + } + } + } + } + + /// + /// Reopen Pull Request + /// Trigger: pull comment created + /// Conditions: + /// Pull request is closed + /// Pull request has "no-recent-activity" label + /// Comment text contains the string "/reopen" + /// Commenter is the pull request author OR has write or admin permission + /// Resulting Action: + /// if the Commenter is the pull request author OR has write or admin permission + /// Remove "no-recent-activity" label + /// Reopen pull request + /// else + /// Create a comment: "Sorry, @commenter, only the original author can reopen this pull request." + /// + /// Authenticated GitHubEventClient + /// IssueCommentPayload deserialized from the json event payload + public static async Task ReopenPullRequest(GitHubEventClient gitHubEventClient, IssueCommentPayload prCommentPayload) + { + if (gitHubEventClient.RulesConfiguration.RuleEnabled(RulesConstants.ReopenPullRequest)) + { + if (prCommentPayload.Action == ActionConstants.Created) + { + if (prCommentPayload.Issue.State == ItemState.Closed && + LabelUtils.HasLabel(prCommentPayload.Issue.Labels, LabelConstants.NoRecentActivity) && + CommentUtils.CommentContainsText(prCommentPayload.Comment.Body, CommentConstants.Reopen)) + { + bool reOpen = false; + if (prCommentPayload.Sender.Login == prCommentPayload.Issue.User.Login) + { + reOpen = true; + } + else + { + bool hasWriteOrAdminPermissions = await gitHubEventClient.DoesUserHaveAdminOrWritePermission(prCommentPayload.Repository.Id, prCommentPayload.Sender.Login); + if (hasWriteOrAdminPermissions) + { + reOpen = true; + } + } + if (reOpen) + { + var issueUpdate = gitHubEventClient.GetIssueUpdate(prCommentPayload.Issue); + issueUpdate.State = ItemState.Open; + issueUpdate.RemoveLabel(LabelConstants.NoRecentActivity); + } + else + { + string prComment = $"Sorry, @{prCommentPayload.Sender.Login}, only the original author can reopen this pull request."; + gitHubEventClient.CreateComment(prCommentPayload.Repository.Id, prCommentPayload.Issue.Number, prComment); + } + } + } + } + } + } +} diff --git a/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor/EventProcessing/PullRequestProcessing.cs b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor/EventProcessing/PullRequestProcessing.cs new file mode 100644 index 00000000000..38b9dec64cd --- /dev/null +++ b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor/EventProcessing/PullRequestProcessing.cs @@ -0,0 +1,245 @@ +using Octokit; +using System.Threading.Tasks; +using Azure.Sdk.Tools.GitHubEventProcessor.GitHubPayload; +using Azure.Sdk.Tools.GitHubEventProcessor.Utils; +using Azure.Sdk.Tools.GitHubEventProcessor.Constants; +using System.Text.Json; +using Octokit.Internal; + +namespace Azure.Sdk.Tools.GitHubEventProcessor.EventProcessing +{ + public class PullRequestProcessing + { + /// + /// Every rule will have it's own function that will be called here, the rule configuration will determine + /// which rules will execute. + /// + /// Authenticated GitHubEventClient + /// PullRequestEventGitHubPayload deserialized from the json event payload + public static async Task ProcessPullRequestEvent(GitHubEventClient gitHubEventClient, PullRequestEventGitHubPayload prEventPayload) + { + await PullRequestTriage(gitHubEventClient, prEventPayload); + ResetPullRequestActivity(gitHubEventClient, prEventPayload); + await ResetApprovalsForUntrustedChanges(gitHubEventClient, prEventPayload); + + // After all of the rules have been processed, call to process pending updates + await gitHubEventClient.ProcessPendingUpdates(prEventPayload.Repository.Id, prEventPayload.PullRequest.Number); + } + + + /// + /// Pull Request Triage + /// Trigger: pull request opened + /// Conditions: Pull request has no labels + /// Resulting Action: + /// Evaluate the path for each file in the PR, if the path has a label, add the label to the issue + /// If the sender is not a Collaborator OR, if they are a collaborator without Write/Admin permissions + /// Add "customer-reported" label + /// Add "Community Contribution" label + /// Create issue comment: "Thank you for your contribution @{issueAuthor} ! We will review the pull request and get back to you soon." + /// + /// Authenticated GitHubEventClient + /// PullRequestEventGitHubPayload deserialized from the json event payload + public static async Task PullRequestTriage(GitHubEventClient gitHubEventClient, + PullRequestEventGitHubPayload prEventPayload) + { + if (gitHubEventClient.RulesConfiguration.RuleEnabled(RulesConstants.PullRequestTriage)) + { + if (prEventPayload.Action == ActionConstants.Opened) + { + if (prEventPayload.PullRequest.Labels.Count == 0) + { + var prFileList = await gitHubEventClient.GetFilesForPullRequest(prEventPayload.Repository.Id, prEventPayload.PullRequest.Number); + var prLabels = CodeOwnerUtils.GetPRAutoLabelsForFilePaths(prEventPayload.PullRequest.Labels, prFileList); + if (prLabels.Count > 0) + { + var issueUpdate = gitHubEventClient.GetIssueUpdate(prEventPayload.PullRequest); + foreach (var prLabel in prLabels) + { + issueUpdate.AddLabel(prLabel); + } + } + + // The sender will only have Write or Admin permssion if they are a collaborator + bool hasAdminOrWritePermission = await gitHubEventClient.DoesUserHaveAdminOrWritePermission(prEventPayload.Repository.Id, prEventPayload.PullRequest.User.Login); + // If the user doesn't have Write or Admin permissions + if (!hasAdminOrWritePermission) + { + var issueUpdate = gitHubEventClient.GetIssueUpdate(prEventPayload.PullRequest); + issueUpdate.AddLabel(LabelConstants.CustomerReported); + issueUpdate.AddLabel(LabelConstants.CommunityContribution); + string prComment = $"Thank you for your contribution @{prEventPayload.PullRequest.User.Login}! We will review the pull request and get back to you soon."; + gitHubEventClient.CreateComment(prEventPayload.Repository.Id, prEventPayload.PullRequest.Number, prComment); + } + } + } + } + } + + /// + /// Reset Pull Request Activity + /// See Common_ResetPullRequestActivity function for details + /// + /// Authenticated GitHubEventClient + /// PullRequestEventGitHubPayload deserialized from the json event payload + public static void ResetPullRequestActivity(GitHubEventClient gitHubEventClient, + PullRequestEventGitHubPayload prEventPayload) + { + Common_ResetPullRequestActivity(gitHubEventClient, + prEventPayload.Action, + prEventPayload.PullRequest, + prEventPayload.Repository, + prEventPayload.Sender); + } + + /// + /// Reset Pull Request Activity + /// This action has triggers from 3 different events: pull_request and pull_request_review and issue_comment + /// Note: issue_comment, had to be a different function. While the issue_comment does have a PullRequest on + /// the issue, it's not a complete PullRequest like what comes in with a pull_request or pull_request_review event. + /// This function only covers pull_request and pull_request_review + /// Trigger: + /// pull_request reopened, synchronize (changes pushed), review_requested, merged + /// pull_request_review submitted + /// Conditions for all triggers + /// Pull request has "no-recent-activity" label + /// User modifying the pull request is not a bot + /// Conditions for pull request triggers, except for merge + /// Pull request is open. + /// Action is reopen, synchronize (changed pushed) or review requested + /// Conditions for pull request merged + /// Pull request is closed + /// Pull request payload, github.event.pull_request.merged, will be true + /// Resulting Action: + /// Remove "no-recent-activity" label + /// + /// Authenticated GitHubEventClient + /// The action being performed, from the payload object + /// Octokit.PullRequest object from the respective payload + /// Octokit.Repository object from the respective payload + /// Octokit.User from the payload's Sender. + public static void Common_ResetPullRequestActivity(GitHubEventClient gitHubEventClient, + string action, + PullRequest pullRequest, + Repository repository, + User sender) + { + if (gitHubEventClient.RulesConfiguration.RuleEnabled(RulesConstants.ResetPullRequestActivity)) + { + // Normally the action would be checked first but the various events and their conditions + // all have two checks in common which are quick and would alleviate the need to check anything + // else. + // 1. The sender is not a bot. + // 2. The Pull request has "no-recent-activity" label + if (sender.Type != AccountType.Bot && + LabelUtils.HasLabel(pullRequest.Labels, LabelConstants.NoRecentActivity)) + { + bool removeLabel = false; + // Pull request conditions AND the pull request needs to be in an opened state + if ((action == ActionConstants.Reopened || + action == ActionConstants.Synchronize || + action == ActionConstants.ReviewRequested) && + pullRequest.State == ItemState.Open) + { + removeLabel = true; + } + // Pull request merged conditions, the merged flag would be true and the PR would be closed + else if (action == ActionConstants.Closed && + pullRequest.Merged) + { + removeLabel = true; + } + // Pull request reviewed conditions. Submitted is only a pull_request_review event. + else if (action == ActionConstants.Submitted) + { + removeLabel = true; + } + if (removeLabel) + { + var issueUpdate = gitHubEventClient.GetIssueUpdate(pullRequest); + issueUpdate.RemoveLabel(LabelConstants.NoRecentActivity); + } + } + } + } + + /// + /// Reset auto-merge approvals on untrusted changes + /// Trigger: pull request synchronized + /// Conditions: + /// Pull request is open + /// Pull request has auto-merge enabled + /// User who pushed the changes does NOT have a collaborator association + /// User who pushed changes does NOT have write permission + /// User who pushed changes does NOT have admin permission + /// Resulting Action: + /// Reset all approvals + /// Create issue comment: "Hi @{issueAuthor}. We've noticed that new changes have been pushed to this pull request. Because it is set to automatically merge, we've reset the approvals to allow the opportunity to review the updates." + /// + /// Authenticated GitHubEventClient + /// PullRequestEventGitHubPayload deserialized from the json event payload + public static async Task ResetApprovalsForUntrustedChanges(GitHubEventClient gitHubEventClient, + PullRequestEventGitHubPayload prEventPayload) + { + if (gitHubEventClient.RulesConfiguration.RuleEnabled(RulesConstants.ResetApprovalsForUntrustedChanges)) + { + if (prEventPayload.Action == ActionConstants.Synchronize) + { + if (prEventPayload.PullRequest.State == ItemState.Open && + prEventPayload.AutoMergeEnabled) + { + bool hasAdminOrWritePermission = await gitHubEventClient.DoesUserHaveAdminOrWritePermission(prEventPayload.Repository.Id, prEventPayload.PullRequest.User.Login); + // The sender will only have Write or Admin permssion if they are a collaborator + if (!hasAdminOrWritePermission) + { + // In this case, get all of the reviews + var reviews = await gitHubEventClient.GetReviewsForPullRequest(prEventPayload.Repository.Id, prEventPayload.PullRequest.Number); + foreach (var review in reviews) + { + // For each review that has approved the pull_request, dismiss it + if (review.State == PullRequestReviewState.Approved) + { + // Every dismiss needs a dismiss message. Might as well make it personalized. + string dismissalMessage = $"Hi @{review.User.Login}. We've noticed that new changes have been pushed to this pull request. Because it is set to automatically merge, we've reset the approvals to allow the opportunity to review the updates."; + gitHubEventClient.DismissReview(prEventPayload.Repository.Id, + prEventPayload.PullRequest.Number, + review.Id, + dismissalMessage); + } + } + string prComment = $"Hi @{prEventPayload.PullRequest.User.Login}. We've noticed that new changes have been pushed to this pull request. Because it is set to automatically merge, we've reset the approvals to allow the opportunity to review the updates."; + gitHubEventClient.CreateComment(prEventPayload.Repository.Id, prEventPayload.PullRequest.Number, prComment); + } + } + } + } + } + + /// + /// The pull_request, because of the auto_merge processing, requires more than just deserialization of the + /// the rawJson, it also needs to set whether or not the auto_merge has been enabled. Because this is also + /// by the static tests it needed to be in a common function. + /// + /// The rawJson to deserialize + /// Octokit.Internal.SimpleJsonSerializer which is serializer used to deserialize the payload into OctoKit classes. + /// PullRequestEventGitHubPayload deserialized from the event json + public static PullRequestEventGitHubPayload DeserializePullRequest(string rawJson, SimpleJsonSerializer serializer) + { + PullRequestEventGitHubPayload prEventPayload = serializer.Deserialize(rawJson); + using var doc = JsonDocument.Parse(rawJson); + // The actions event payload for a pull_request has a class on the pull request that + // the OctoKit.PullRequest class does not have. This will be null if the user does not + // have Auto-Merge enabled through the pull request UI and will be non-null otherwise. + // An AutoMergeEnabled boolean was added to the root of the PullRequestEventGitHubPayload + // which defaults to false. The actual information in the auto_merge is not necessary + // for any rules processing other than knowing whether or not it's been set. + var autoMergeProp = doc.RootElement.GetProperty("pull_request").GetProperty("auto_merge"); + if (JsonValueKind.Object == autoMergeProp.ValueKind) + { + prEventPayload.AutoMergeEnabled = true; + } + + return prEventPayload; + } + } +} diff --git a/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor/EventProcessing/PullRequestReviewProcessing.cs b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor/EventProcessing/PullRequestReviewProcessing.cs new file mode 100644 index 00000000000..7949f638869 --- /dev/null +++ b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor/EventProcessing/PullRequestReviewProcessing.cs @@ -0,0 +1,43 @@ +using System; +using System.Collections.Generic; +using System.Text; +using Azure.Sdk.Tools.GitHubEventProcessor.Utils; +using Octokit.Internal; +using Octokit; +using System.Threading.Tasks; + +namespace Azure.Sdk.Tools.GitHubEventProcessor.EventProcessing +{ + public class PullRequestReviewProcessing + { + /// + /// Every rule will have it's own function that will be called here, the rule configuration will determine + /// which rules will execute. + /// + /// Authenticated GitHubEventClient + /// PullRequestReviewEventPayload deserialized from the json event payload + public static async Task ProcessPullRequestReviewEvent(GitHubEventClient gitHubEventClient, PullRequestReviewEventPayload prReviewEventPayload) + { + ResetPullRequestActivity(gitHubEventClient, prReviewEventPayload); + + // After all of the rules have been processed, call to process pending updates + await gitHubEventClient.ProcessPendingUpdates(prReviewEventPayload.Repository.Id, prReviewEventPayload.PullRequest.Number); + } + + /// + /// Reset Pull Request Activity + /// See Common_ResetPullRequestActivity function for details + /// + /// Authenticated GitHubEventClient + /// PullRequestReviewEventPayload deserialized from the json event payload + public static void ResetPullRequestActivity(GitHubEventClient gitHubEventClient, + PullRequestReviewEventPayload prReviewEventPayload) + { + PullRequestProcessing.Common_ResetPullRequestActivity(gitHubEventClient, + prReviewEventPayload.Action, + prReviewEventPayload.PullRequest, + prReviewEventPayload.Repository, + prReviewEventPayload.Sender); + } + } +} diff --git a/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor/EventProcessing/ScheduledEventProcessing.cs b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor/EventProcessing/ScheduledEventProcessing.cs new file mode 100644 index 00000000000..e6bd4b0eeb8 --- /dev/null +++ b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor/EventProcessing/ScheduledEventProcessing.cs @@ -0,0 +1,530 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Reflection.Emit; +using System.Text; +using System.Threading.Tasks; +using Azure.Sdk.Tools.GitHubEventProcessor.Constants; +using Azure.Sdk.Tools.GitHubEventProcessor.GitHubPayload; +using Azure.Sdk.Tools.GitHubEventProcessor.Utils; +using Octokit; +using Octokit.Internal; + +namespace Azure.Sdk.Tools.GitHubEventProcessor.EventProcessing +{ + public class ScheduledEventProcessing + { + // Each repository has rate limit for actions of 1000/hour. Because scheduled tasks have the potential + // to cause a large number of updates, put an initial limit on the number of updates a scheduled task + // can make. + private static int ScheduledTaskUpdateLimit = 100; + // There's a secondary limit to the search API which is 1000 items. The default page size for the search + // is 100 items (which is also the max per page) + private static int MaxSearchResults = 1000; + + /// + /// + /// + /// Authenticated GitHubEventClient + /// ScheduledEventGitHubPayload deserialized from the json event payload + /// String, the scheduled even + public static async Task ProcessScheduledEvent(GitHubEventClient gitHubEventClient, ScheduledEventGitHubPayload scheduledEventPayload, string cronTaskToRun) + { + switch (cronTaskToRun) + { + case RulesConstants.CloseAddressedIssues: + { + await CloseAddressedIssues(gitHubEventClient, scheduledEventPayload); + break; + } + case RulesConstants.CloseStaleIssues: + { + await CloseStaleIssues(gitHubEventClient, scheduledEventPayload); + break; + } + case RulesConstants.CloseStalePullRequests: + { + await CloseStalePullRequests(gitHubEventClient, scheduledEventPayload); + break; + } + case RulesConstants.IdentifyStaleIssues: + { + await IdentifyStaleIssues(gitHubEventClient, scheduledEventPayload); + break; + } + case RulesConstants.IdentifyStalePullRequests: + { + await IdentifyStalePullRequests(gitHubEventClient, scheduledEventPayload); + break; + } + case RulesConstants.LockClosedIssues: + { + await LockClosedIssues(gitHubEventClient, scheduledEventPayload); + break; + } + default: + { + Console.WriteLine($"{cronTaskToRun} is not valid Scheduled Event rule. Please ensure the scheduled event yml is correctly passing in the correct rules constant."); + break; + } + } + // The second argument is IssueOrPullRequestNumber which isn't applicable to scheduled events (cron tasks) + // since they're not going to be changing a single IssueUpdate like rules processing does. + await gitHubEventClient.ProcessPendingUpdates(scheduledEventPayload.Repository.Id); + } + + /// + /// Trigger: every 6 hours + /// Query Criteria + /// Issue is open + /// Issue has label "issue-addressed" + /// Issue was last updated more than 7 days ago + /// Resulting Action: + /// Close the issue + /// Create a comment "Hi @${issueAuthor}, since you haven’t asked that we `/unresolve` the issue, we’ll close this out. If you believe further discussion is needed, please add a comment `/unresolve` to reopen the issue." + /// + /// Authenticated GitHubEventClient + /// ScheduledEventGitHubPayload deserialized from the json event payload + public static async Task CloseAddressedIssues(GitHubEventClient gitHubEventClient, ScheduledEventGitHubPayload scheduledEventPayload) + { + if (gitHubEventClient.RulesConfiguration.RuleEnabled(RulesConstants.CloseAddressedIssues)) + { + + List includeLabels = new List + { + LabelConstants.IssueAddressed + }; + SearchIssuesRequest request = gitHubEventClient.CreateSearchRequest(scheduledEventPayload.Repository.Owner.Login, + scheduledEventPayload.Repository.Name, + IssueTypeQualifier.Issue, + ItemState.Open, + 7, // more than 7 days old + null, + includeLabels); + // Need to stop updating when the we hit the limit but, until then, after exhausting every + // issue in the page returned, the query needs to be rerun to get the next page + int numUpdates = 0; + // In theory, maximumPage will be 10 since there's 100 results per-page returned by default but + // this ensures that if we opt to change the page size + int maximumPage = MaxSearchResults / request.PerPage; + for (request.Page = 1; request.Page <= maximumPage; request.Page++) + { + SearchIssuesResult result = await gitHubEventClient.QueryIssues(request); + int iCounter = 0; + while ( + // Process every item in the page returned + iCounter < result.Items.Count && + // unless the update limit has been hit + numUpdates < ScheduledTaskUpdateLimit + ) + { + Issue issue = result.Items[iCounter++]; + IssueUpdate issueUpdate = gitHubEventClient.GetIssueUpdate(issue, false); + issueUpdate.State = ItemState.Closed; + issueUpdate.StateReason = ItemStateReason.Completed; + gitHubEventClient.AddToIssueUpdateList(scheduledEventPayload.Repository.Id, + issue.Number, + issueUpdate); + string comment = $"Hi @{issue.User.Login}, since you haven’t asked that we `/unresolve` the issue, we’ll close this out. If you believe further discussion is needed, please add a comment `/unresolve` to reopen the issue."; + gitHubEventClient.CreateComment(scheduledEventPayload.Repository.Id, + issue.Number, + comment); + // There are 2 updates per result + numUpdates += 2; + } + + // The number of items in the query isn't known until the query is run. + // If the number of items in the result equals the total number of items matching the query then + // all the items have been processed. + // OR + // If the number of items in the result is less than the number of items requested per page then + // the last page of results has been processed which was not a full page + // OR + // The number of updates has hit the limit for a scheduled task + if (result.Items.Count == result.TotalCount || + result.Items.Count < request.PerPage || + numUpdates >= ScheduledTaskUpdateLimit) + { + break; + } + } + } + } + + /// + /// Trigger: Daily 1am + /// Query Criteria + /// Issue is open + /// Issue has "needs-author-feedback" label + /// Issue has "no-recent-activity" label + /// Issue was last modified more than 14 days ago + /// Resulting Action: + /// Close the issue + /// + /// Authenticated GitHubEventClient + /// ScheduledEventGitHubPayload deserialized from the json event payload + public static async Task CloseStaleIssues(GitHubEventClient gitHubEventClient, ScheduledEventGitHubPayload scheduledEventPayload) + { + if (gitHubEventClient.RulesConfiguration.RuleEnabled(RulesConstants.CloseStaleIssues)) + { + List includeLabels = new List + { + LabelConstants.NeedsAuthorFeedback, + LabelConstants.NoRecentActivity + }; + SearchIssuesRequest request = gitHubEventClient.CreateSearchRequest(scheduledEventPayload.Repository.Owner.Login, + scheduledEventPayload.Repository.Name, + IssueTypeQualifier.Issue, + ItemState.Open, + 14, // more than 14 days since last update + null, + includeLabels); + + // Need to stop updating when the we hit the limit but, until then, after exhausting every + // issue in the page returned, the query needs to be rerun to get the next page + int numUpdates = 0; + // In theory, maximumPage will be 10 since there's 100 results per-page returned by default but + // this ensures that if we opt to change the page size + int maximumPage = MaxSearchResults / request.PerPage; + for (request.Page = 1;request.Page <= maximumPage; request.Page++) + { + SearchIssuesResult result = await gitHubEventClient.QueryIssues(request); + int iCounter = 0; + while ( + // Process every item in the page returned + iCounter < result.Items.Count && + // unless the update limit has been hit + numUpdates < ScheduledTaskUpdateLimit + ) + { + Issue issue = result.Items[iCounter++]; + IssueUpdate issueUpdate = gitHubEventClient.GetIssueUpdate(issue, false); + issueUpdate.State = ItemState.Closed; + issueUpdate.StateReason = ItemStateReason.NotPlanned; + gitHubEventClient.AddToIssueUpdateList(scheduledEventPayload.Repository.Id, + issue.Number, + issueUpdate); + numUpdates++; + } + + // The number of items in the query isn't known until the query is run. + // If the number of items in the result equals the total number of items matching the query then + // all the items have been processed. + // OR + // If the number of items in the result is less than the number of items requested per page then + // the last page of results has been processed which was not a full page + // OR + // The number of updates has hit the limit for a scheduled task + if (result.Items.Count == result.TotalCount || + result.Items.Count < request.PerPage || + numUpdates >= ScheduledTaskUpdateLimit) + { + break; + } + } + } + } + + /// + /// Trigger: every 6 hours + /// Query Criteria + /// Pull request is open + /// Pull request has "no-recent-activity" label + /// Pull request was last modified more than 7 days ago + /// Resulting Action: + /// Close the pull request + /// Create a comment "Hi @${issueAuthor}. Thank you for your contribution. Since there hasn't been recent engagement, we're going to close this out. Feel free to respond with a comment containing `/reopen` if you'd like to continue working on these changes. Please be sure to use the command to reopen or remove the `no-recent-activity` label; otherwise, this is likely to be closed again with the next cleanup pass." + /// + /// Authenticated GitHubEventClient + /// ScheduledEventGitHubPayload deserialized from the json event payload + public static async Task CloseStalePullRequests(GitHubEventClient gitHubEventClient, ScheduledEventGitHubPayload scheduledEventPayload) + { + if (gitHubEventClient.RulesConfiguration.RuleEnabled(RulesConstants.CloseStalePullRequests)) + { + + List includeLabels = new List + { + LabelConstants.NoRecentActivity + }; + SearchIssuesRequest request = gitHubEventClient.CreateSearchRequest(scheduledEventPayload.Repository.Owner.Login, + scheduledEventPayload.Repository.Name, + IssueTypeQualifier.PullRequest, + ItemState.Open, + 7, // more than 7 days old + null, + includeLabels); + // Need to stop updating when the we hit the limit but, until then, after exhausting every + // issue in the page returned, the query needs to be rerun to get the next page + int numUpdates = 0; + // In theory, maximumPage will be 10 since there's 100 results per-page returned by default but + // this ensures that if we opt to change the page size + int maximumPage = MaxSearchResults / request.PerPage; + for (request.Page = 1; request.Page <= maximumPage; request.Page++) + { + SearchIssuesResult result = await gitHubEventClient.QueryIssues(request); + int iCounter = 0; + while ( + // Process every item in the page returned + iCounter < result.Items.Count && + // unless the update limit has been hit + numUpdates < ScheduledTaskUpdateLimit + ) + { + Issue issue = result.Items[iCounter++]; + IssueUpdate issueUpdate = gitHubEventClient.GetIssueUpdate(issue, false); + issueUpdate.State = ItemState.Closed; + issueUpdate.StateReason = ItemStateReason.NotPlanned; + gitHubEventClient.AddToIssueUpdateList(scheduledEventPayload.Repository.Id, + issue.Number, + issueUpdate); + string comment = $"Hi @{issue.User.Login}. Thank you for your contribution. Since there hasn't been recent engagement, we're going to close this out. Feel free to respond with a comment containing `/reopen` if you'd like to continue working on these changes. Please be sure to use the command to reopen or remove the `no-recent-activity` label; otherwise, this is likely to be closed again with the next cleanup pass."; + gitHubEventClient.CreateComment(scheduledEventPayload.Repository.Id, + issue.Number, + comment); + // There are 2 updates per result + numUpdates += 2; + } + + // The number of items in the query isn't known until the query is run. + // If the number of items in the result equals the total number of items matching the query then + // all the items have been processed. + // OR + // If the number of items in the result is less than the number of items requested per page then + // the last page of results has been processed which was not a full page + // OR + // The number of updates has hit the limit for a scheduled task + if (result.Items.Count == result.TotalCount || + result.Items.Count < request.PerPage || + numUpdates >= ScheduledTaskUpdateLimit) + { + break; + } + } + } + } + + /// + /// Trigger: weekly, Friday at 5am + /// Query Criteria + /// Pull request is open + /// Pull request does NOT have "no-recent-activity" label + /// Pull request was last updated more than 60 days ago + /// Resulting Action: + /// Add "no-recent-activity" label + /// Create a comment "Hi @${issueAuthor}. Thank you for your interest in helping to improve the Azure SDK experience and for your contribution. We've noticed that there hasn't been recent engagement on this pull request. If this is still an active work stream, please let us know by pushing some changes or leaving a comment. Otherwise, we'll close this out in 7 days." + /// + /// Authenticated GitHubEventClient + /// ScheduledEventGitHubPayload deserialized from the json event payload + public static async Task IdentifyStalePullRequests(GitHubEventClient gitHubEventClient, ScheduledEventGitHubPayload scheduledEventPayload) + { + if (gitHubEventClient.RulesConfiguration.RuleEnabled(RulesConstants.IdentifyStalePullRequests)) + { + + List excludeLabels = new List + { + LabelConstants.NoRecentActivity + }; + SearchIssuesRequest request = gitHubEventClient.CreateSearchRequest(scheduledEventPayload.Repository.Owner.Login, + scheduledEventPayload.Repository.Name, + IssueTypeQualifier.PullRequest, + ItemState.Open, + 60, // more than 60 days since last update + null, + null, + excludeLabels); + // Need to stop updating when the we hit the limit but, until then, after exhausting every + // issue in the page returned, the query needs to be rerun to get the next page + int numUpdates = 0; + // In theory, maximumPage will be 10 since there's 100 results per-page returned by default but + // this ensures that if we opt to change the page size + int maximumPage = MaxSearchResults / request.PerPage; + for (request.Page = 1; request.Page <= maximumPage; request.Page++) + { + SearchIssuesResult result = await gitHubEventClient.QueryIssues(request); + int iCounter = 0; + while ( + // Process every item in the page returned + iCounter < result.Items.Count && + // unless the update limit has been hit + numUpdates < ScheduledTaskUpdateLimit + ) + { + Issue issue = result.Items[iCounter++]; + IssueUpdate issueUpdate = gitHubEventClient.GetIssueUpdate(issue, false); + issueUpdate.AddLabel(LabelConstants.NoRecentActivity); + gitHubEventClient.AddToIssueUpdateList(scheduledEventPayload.Repository.Id, + issue.Number, + issueUpdate); + string comment = $"Hi @{issue.User.Login}. Thank you for your interest in helping to improve the Azure SDK experience and for your contribution. We've noticed that there hasn't been recent engagement on this pull request. If this is still an active work stream, please let us know by pushing some changes or leaving a comment. Otherwise, we'll close this out in 7 days."; + gitHubEventClient.CreateComment(scheduledEventPayload.Repository.Id, + issue.Number, + comment); + // There are 2 updates per result + numUpdates +=2; + } + + // The number of items in the query isn't known until the query is run. + // If the number of items in the result equals the total number of items matching the query then + // all the items have been processed. + // OR + // If the number of items in the result is less than the number of items requested per page then + // the last page of results has been processed which was not a full page + // OR + // The number of updates has hit the limit for a scheduled task + if (result.Items.Count == result.TotalCount || + result.Items.Count < request.PerPage || + numUpdates >= ScheduledTaskUpdateLimit) + { + break; + } + } + } + } + + /// + /// Trigger: every 6 hours + /// Query Criteria + /// Issue is open + /// Issue has "needs-author-feedback" label + /// Issue does NOT have "no-recent-activity" label + /// Issue was last updated more than 7 days ago + /// Resulting Action: + /// Add "no-recent-activity" label + /// Create a comment: "Hi @{issueAuthor}, we're sending this friendly reminder because we haven't heard back from you in **7 days**. We need more information about this issue to help address it. Please be sure to give us your input. If we don't hear back from you within **14 days** of this comment the issue will be automatically closed. Thank you!" + /// + /// Authenticated GitHubEventClient + /// ScheduledEventGitHubPayload deserialized from the json event payload + public static async Task IdentifyStaleIssues(GitHubEventClient gitHubEventClient, ScheduledEventGitHubPayload scheduledEventPayload) + { + if (gitHubEventClient.RulesConfiguration.RuleEnabled(RulesConstants.IdentifyStaleIssues)) + { + + List includeLabels = new List + { + LabelConstants.NeedsAuthorFeedback + }; + List excludeLabels = new List + { + LabelConstants.NoRecentActivity + }; + SearchIssuesRequest request = gitHubEventClient.CreateSearchRequest(scheduledEventPayload.Repository.Owner.Login, + scheduledEventPayload.Repository.Name, + IssueTypeQualifier.Issue, + ItemState.Open, + 7, // more than 7 days since the last update + null, + includeLabels, + excludeLabels); + + // Need to stop updating when the we hit the limit but, until then, after exhausting every + // issue in the page returned, the query needs to be rerun to get the next page + int numUpdates = 0; + // In theory, maximumPage will be 10 since there's 100 results per-page returned by default but + // this ensures that if we opt to change the page size + int maximumPage = MaxSearchResults / request.PerPage; + for (request.Page = 1; request.Page <= maximumPage; request.Page++) + { + SearchIssuesResult result = await gitHubEventClient.QueryIssues(request); + int iCounter = 0; + while ( + // Process every item in the page returned + iCounter < result.Items.Count && + // unless the update limit has been hit + numUpdates < ScheduledTaskUpdateLimit + ) + { + Issue issue = result.Items[iCounter++]; + IssueUpdate issueUpdate = gitHubEventClient.GetIssueUpdate(issue, false); + issueUpdate.AddLabel(LabelConstants.NoRecentActivity); + gitHubEventClient.AddToIssueUpdateList(scheduledEventPayload.Repository.Id, + issue.Number, + issueUpdate); + string comment = $"Hi @{issue.User.Login}, we're sending this friendly reminder because we haven't heard back from you in **7 days**. We need more information about this issue to help address it. Please be sure to give us your input. If we don't hear back from you within **14 days** of this comment the issue will be automatically closed. Thank you!"; + gitHubEventClient.CreateComment(scheduledEventPayload.Repository.Id, + issue.Number, + comment); + // There are 2 updates per result + numUpdates += 2; + } + + // The number of items in the query isn't known until the query is run. + // If the number of items in the result equals the total number of items matching the query then + // all the items have been processed. + // OR + // If the number of items in the result is less than the number of items requested per page then + // the last page of results has been processed which was not a full page + // OR + // The number of updates has hit the limit for a scheduled task + if (result.Items.Count == result.TotalCount || + result.Items.Count < request.PerPage || + numUpdates >= ScheduledTaskUpdateLimit) + { + break; + } + } + } + } + + /// + /// Trigger: every 6 hours + /// Query Criteria + /// Issue is closed + /// Issue was last updated more than 90 days ago + /// Issue is unlocked + /// Resulting Action: + /// Lock issue conversations + /// + /// Authenticated GitHubEventClient + /// ScheduledEventGitHubPayload deserialized from the json event payload + public static async Task LockClosedIssues(GitHubEventClient gitHubEventClient, ScheduledEventGitHubPayload scheduledEventPayload) + { + if (gitHubEventClient.RulesConfiguration.RuleEnabled(RulesConstants.LockClosedIssues)) + { + + SearchIssuesRequest request = gitHubEventClient.CreateSearchRequest( + scheduledEventPayload.Repository.Owner.Login, + scheduledEventPayload.Repository.Name, + IssueTypeQualifier.Issue, + ItemState.Closed, + 90, // more than 90 days + new List { IssueIsQualifier.Unlocked }); + + int numUpdates = 0; + // In theory, maximumPage will be 10 since there's 100 results per-page returned by default but + // this ensures that if we opt to change the page size + int maximumPage = MaxSearchResults / request.PerPage; + for (request.Page = 1; request.Page <= maximumPage; request.Page++) + { + SearchIssuesResult result = await gitHubEventClient.QueryIssues(request); + int iCounter = 0; + while ( + // Process every item in the page returned + iCounter < result.Items.Count && + // unless the update limit has been hit + numUpdates < ScheduledTaskUpdateLimit + ) + { + Issue issue = result.Items[iCounter++]; + gitHubEventClient.LockIssue(scheduledEventPayload.Repository.Id, issue.Number, LockReason.Resolved); + numUpdates++; + } + + // The number of items in the query isn't known until the query is run. + // If the number of items in the result equals the total number of items matching the query then + // all the items have been processed. + // OR + // If the number of items in the result is less than the number of items requested per page then + // the last page of results has been processed which was not a full page + // OR + // The number of updates has hit the limit for a scheduled task + if (result.Items.Count == result.TotalCount || + result.Items.Count < request.PerPage || + numUpdates >= ScheduledTaskUpdateLimit) + { + break; + } + } + } + } + } +} diff --git a/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor/GitHubEventClient.cs b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor/GitHubEventClient.cs new file mode 100644 index 00000000000..2fa7fa29e80 --- /dev/null +++ b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor/GitHubEventClient.cs @@ -0,0 +1,802 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net.Http; +using System.Net.Http.Json; +using System.Threading.Tasks; +using Azure.Sdk.Tools.GitHubEventProcessor.Constants; +using Azure.Sdk.Tools.GitHubEventProcessor.GitHubPayload; +using Azure.Sdk.Tools.GitHubEventProcessor.Utils; +using Octokit; + +namespace Azure.Sdk.Tools.GitHubEventProcessor +{ + /// + /// GitHubEventClient is a singleton. It holds the GitHubClient and Rules instances as well + /// as any updates queued during event processing. After all the relevant rules have been processed, + /// a call to ProcessPendingUpdates will process all of the pending updates. This ensures that the + /// individual rules don't need to deal with calls to GitHub and the respective error processing, + /// within the rules, themselves. + /// + public class GitHubEventClient + { + // Exception string partial from the call to GitHubClient.Repository.Collaborator.ReviewPermission + // used to determine if the call threw because the user being checked was a bot or didn't exist. + private static readonly string NotAUserPartial = "is not a user"; + + /// + /// Class to store the information needed to create a GitHub Comment on an Issue or PullRequest. + /// + public class GitHubComment + { + private long _repositoryId; + private int _issueOrPullRequestNumber; + private string _comment; + + public long RepositoryId { get { return _repositoryId; } } + public int IssueOrPullRequestNumber { get { return _issueOrPullRequestNumber; } } + public string Comment { get { return _comment; } } + + public GitHubComment(long repositoryId, int issueOrPullRequestNumder, string comment) + { + _repositoryId = repositoryId; + _issueOrPullRequestNumber = issueOrPullRequestNumder; + _comment = comment; + } + } + + /// + /// Class to store the information needed to dismiss a PullRequest review + /// + public class GitHubReviewDismissal + { + private long _repositoryId; + private int _pullRequestNumber; + private long _reviewId; + private string _dismissalMessage; + + public long RepositoryId { get { return _repositoryId; } } + public int PullRequestNumber { get { return _pullRequestNumber; } } + public long ReviewId { get { return _reviewId; } } + public string DismissalMessage { get { return _dismissalMessage; } } + + public GitHubReviewDismissal(long repositoryId, int pullRequestNumber, long reviewId, string dismissalMessage) + { + _repositoryId = repositoryId; + _pullRequestNumber = pullRequestNumber; + _reviewId = reviewId; + _dismissalMessage = dismissalMessage; + } + } + + /// + /// Class to store the information needed to lock an Issue + /// + public class GitHubIssueToLock + { + private long _repositoryId; + private int _issueNumber; + private LockReason _lockReason; + + public long RepositoryId { get { return _repositoryId; } } + public int IssueNumber { get { return _issueNumber; } } + public LockReason LockReason { get { return _lockReason; } } + + public GitHubIssueToLock(long repositoryId, int issueNumber, LockReason lockReason) + { + _repositoryId = repositoryId; + _issueNumber = issueNumber; + _lockReason = lockReason; + } + } + + /// + /// Used by scheduled/cron event processing which processes multiple Issues or PullRequests. This + /// stores the IssueUpdate and the information necessary to update the Issue or PullRequest. + /// + public class GitHubIssueToUpdate + { + private long _repositoryId; + private int _issueOrPRNumber; + private IssueUpdate _issueUpdate; + + public long RepositoryId { get { return _repositoryId; } } + public int IssueOrPRNumber { get { return _issueOrPRNumber; } } + public IssueUpdate IssueUpdate { get { return _issueUpdate; } } + + public GitHubIssueToUpdate(long repositoryId, int issueOrPRNumber, IssueUpdate issueUpdate) + { + _repositoryId = repositoryId; + _issueOrPRNumber = issueOrPRNumber; + _issueUpdate = issueUpdate; + } + } + + + private GitHubClient _gitHubClient = null; + private RulesConfiguration _rulesConfiguration = null; + // Protected instead of private so the mock class can access them + protected IssueUpdate _issueUpdate = null; + protected List _gitHubComments = new List(); + protected List _gitHubReviewDismissals = new List(); + // Locking issues is only done through scheduled event processing + protected List _gitHubIssuesToLock = new List(); + // Scheduled event processing can process multiple issues, this list will not be used + // for action processing which uses a shared event. + protected List _gitHubIssuesToUpdate = new List(); + + public RulesConfiguration RulesConfiguration + { + get { return _rulesConfiguration; } + } + + public GitHubEventClient(string productHeaderName, string rulesConfigLocation = null) + { + _gitHubClient = CreateClientWithGitHubEnvToken(productHeaderName); + _rulesConfiguration = LoadRulesConfiguration(rulesConfigLocation); + } + + /// + /// Process any of the pending updates stored on this class. Right now that consists of the following: + /// 1. IssueUpdate + /// 2. Added Comments + /// 3. Removed Dismissals + /// + /// The Id of the repository + /// The Issue or PullRequest number if not processing a scheduled task. + /// Integer, the number of update calls made + public virtual async Task ProcessPendingUpdates(long repositoryId, int issueOrPullRequestNumber = 0) + { + Console.WriteLine("Processing pending updates..."); + int numUpdates = 0; + int numExpectedUpdates = ComputeNumberOfExpectedUpdates(); + try + { + // Process the issue update + if (_issueUpdate != null) + { + await _gitHubClient.Issue.Update(repositoryId, + issueOrPullRequestNumber, + _issueUpdate); + numUpdates++; + } + + // Process any comments + foreach (var comment in _gitHubComments) + { + await _gitHubClient.Issue.Comment.Create(comment.RepositoryId, + comment.IssueOrPullRequestNumber, + comment.Comment); + numUpdates++; + } + + // Process any PullRequest review dismissals + foreach (var dismissal in _gitHubReviewDismissals) + { + var prReview = new PullRequestReviewDismiss(); + prReview.Message = dismissal.DismissalMessage; + await _gitHubClient.PullRequest.Review.Dismiss(dismissal.RepositoryId, + dismissal.PullRequestNumber, + dismissal.ReviewId, + prReview); + numUpdates++; + } + + // Process any issue locks + foreach (var issueToLock in _gitHubIssuesToLock) + { + await _gitHubClient.Issue.LockUnlock.Lock(issueToLock.RepositoryId, + issueToLock.IssueNumber, + issueToLock.LockReason); + numUpdates++; + } + + // Process any Scheduled task IssueUpdates + foreach (var issueToUpdate in _gitHubIssuesToUpdate) + { + await _gitHubClient.Issue.Update(issueToUpdate.RepositoryId, + issueToUpdate.IssueOrPRNumber, + issueToUpdate.IssueUpdate); + numUpdates++; + } + Console.WriteLine("Finished processing pending updates."); + } + // For the moment, nothing special is being done when rate limit exceptions are + // thrown but keep them separate in case that changes. + catch (RateLimitExceededException rateLimitEx) + { + string message = $"RateLimitExceededException was thrown processing pending updates. Total expected updates={numExpectedUpdates}, number of updates made={numUpdates}."; + Console.WriteLine(message); + Console.WriteLine(rateLimitEx); + } + catch (SecondaryRateLimitExceededException secondaryRateLimitEx) + { + string message = $"SecondaryRateLimitExceededException was thrown processing pending updates. Total expected updates={numExpectedUpdates}, number of updates made={numUpdates}."; + Console.WriteLine(message); + Console.WriteLine(secondaryRateLimitEx); + } + catch (Exception ex) + { + string message = $"Exception was thrown processing pending updates. Total expected updates={numExpectedUpdates}, number of updates made={numUpdates}."; + Console.WriteLine(message); + Console.WriteLine(ex); + } + + return numUpdates; + } + + /// + /// Compute and output the number of expected updates. + /// + /// int, the total number of expected updates + public int ComputeNumberOfExpectedUpdates() + { + int numUpdates = 0; + if (_issueUpdate != null) + { + Console.WriteLine("Common IssueUpdate from rules processing will be updated."); + numUpdates++; + } + if (_gitHubComments.Count > 0) + { + Console.WriteLine($"Number of Comments to create {_gitHubComments.Count}"); + numUpdates += _gitHubComments.Count; + } + if (_gitHubReviewDismissals.Count > 0) + { + Console.WriteLine($"Number of Review Dismissals {_gitHubReviewDismissals.Count}"); + numUpdates += _gitHubReviewDismissals.Count; + } + if (_gitHubIssuesToLock.Count > 0) + { + Console.WriteLine($"Number of Issues to Lock {_gitHubIssuesToLock.Count}"); + numUpdates += _gitHubIssuesToLock.Count; + } + if (_gitHubIssuesToUpdate.Count > 0) + { + Console.WriteLine($"Number of IssuesUpdates (only applicable for Scheduled events) {_gitHubIssuesToUpdate.Count}"); + numUpdates += _gitHubIssuesToUpdate.Count; + } + return numUpdates; + } + + /// + /// Write the current rate limit and remaining number of transactions. + /// + /// Optional message to prepend to the rate limit message. + public async Task WriteRateLimits(string prependMessage = null) + { + var miscRateLimit = await GetRateLimits(); + // Get the Minutes till reset. + TimeSpan span = miscRateLimit.Resources.Core.Reset.UtcDateTime.Subtract(DateTime.UtcNow); + // In the message, cast TotalMinutes to an int to get a whole number of minutes. + string rateLimitMessage = $"Limit={miscRateLimit.Resources.Core.Limit}, Remaining={miscRateLimit.Resources.Core.Remaining}, Limit Reset in {(int)span.TotalMinutes} minutes."; + if (prependMessage != null) + { + rateLimitMessage = $"{prependMessage} {rateLimitMessage}"; + } + Console.WriteLine(rateLimitMessage); + } + + /// + /// Write the current rate limit and remaining number of transactions. + /// + /// Optional message to prepend to the rate limit message. + public async Task WriteSearchRateLimits(string prependMessage = null) + { + var miscRateLimit = await GetRateLimits(); + // Get the Seconds till reset. Unlike the core rate limit which resets every hour, the search rate limit + // should reset every minute. + TimeSpan span = miscRateLimit.Resources.Search.Reset.UtcDateTime.Subtract(DateTime.UtcNow); + // In the message, cast TotalSeconds to an int to get a whole number of minutes. + string rateLimitMessage = $"Search Limit={miscRateLimit.Resources.Search.Limit}, Remaining={miscRateLimit.Resources.Search.Remaining}, Limit Reset in {(int)span.TotalSeconds} seconds."; + if (prependMessage != null) + { + rateLimitMessage = $"{prependMessage} {rateLimitMessage}"; + } + Console.WriteLine(rateLimitMessage); + } + + /// + /// Using the authenticated GitHubClient, call the RateLimit API to get the rate limits. + /// + /// Octokit.MiscellaneousRateLimit which contains the rate limit information. + public async Task GetRateLimits() + { + return await _gitHubClient.RateLimit.GetRateLimits(); + } + + /// + /// Overloaded convenience function that'll return the IssueUpdate. Actions all make changes to + /// the same, shared, IssueUpdate because they're processing on the same event. For scheduled + /// event processing, there will be multiple, unique IssueUpdates and there won't be a shared one. + /// + /// Octokit.Issue from the event payload + /// Whether or not actions are being processed. Default is true. + /// Octokit.IssueUpdate + public IssueUpdate GetIssueUpdate(Issue issue, bool isProcessingAction = true) + { + if (isProcessingAction) + { + if (null == _issueUpdate) + { + _issueUpdate = issue.ToUpdate(); + } + return _issueUpdate; + } + else + { + return issue.ToUpdate(); + } + } + + /// + /// Overloaded convenience function that'll return the IssueUpdate. Actions all make changes to + /// the same, shared, IssueUpdate because they're processing on the same event. For scheduled + /// event processing, there will be multiple, unique IssueUpdates and there won't be shared one. + /// + /// Octokit.PullRequest from the event payload + /// Whether or not actions are being processed. Default is true. + /// Octokit.IssueUpdate + public IssueUpdate GetIssueUpdate(PullRequest pullRequest, bool isProcessingAction = true) + { + if (isProcessingAction) + { + if (null == _issueUpdate) + { + _issueUpdate = CreateIssueUpdateForPR(pullRequest); + } + return _issueUpdate; + } + else + { + return CreateIssueUpdateForPR(pullRequest); + } + } + + /// + /// Create an IssueUpdate for a PR. For Issues, creating an IssueUpdate is done calling + /// Issue.ToUpdate() on the Issue contained within the IssueEventGitHubPayload which + /// create an IssueUpdate prefilled with information from the issue. For PullRequests, + /// there is no such call to create an IssueUpdate. The IssueUpdate needs this prefilled + /// information otherwise, it'll end clearing/resetting things. This code is, quite + /// literally, taken directly from Issue's ToUpdate call and modified to get the + /// information from the input PullRequest. + /// I filed an issue about this with Octokit.Net https://github.com/octokit/octokit.net/discussions/2629 + /// + /// Octokit.PullRequest object from event payload + /// OctoKit.IssueUpdate + internal IssueUpdate CreateIssueUpdateForPR(PullRequest pullRequest) + { + var milestoneId = pullRequest.Milestone == null + ? new int?() + : pullRequest.Milestone.Number; + + var assignees = pullRequest.Assignees == null + ? null + : pullRequest.Assignees.Select(x => x.Login); + + var labels = pullRequest.Labels == null + ? null + : pullRequest.Labels.Select(x => x.Name); + + ItemState state; + var issueUpdate = new IssueUpdate + { + Body = pullRequest.Body, + Milestone = milestoneId, + State = pullRequest.State.TryParse(out state) ? (ItemState?)state : null, + Title = pullRequest.Title + }; + + if (assignees != null) + { + foreach (var assignee in assignees) + { + issueUpdate.AddAssignee(assignee); + } + } + + if (labels != null) + { + foreach (var label in labels) + { + issueUpdate.AddLabel(label); + } + } + return issueUpdate; + } + + /// + /// Create a comment that will be added to the PR with the pending updates + /// + /// The Id of the repository + /// The Issue or PullRequest number + /// The comment being created. + public void CreateComment(long repositoryId, int issueOrPullRequestNumber, string comment) + { + GitHubComment gitHubComment = new GitHubComment(repositoryId, issueOrPullRequestNumber, comment); + _gitHubComments.Add(gitHubComment); + } + + /// + /// Get all the reviews for a given pull request. + /// + /// The Id of the repository + /// The pull request number + /// IReadOnlyList of PullRequestReview + public virtual async Task> GetReviewsForPullRequest(long repositoryId, int pullRequestNumber) + { + return await _gitHubClient.PullRequest.Review.GetAll(repositoryId, pullRequestNumber); + } + + public void DismissReview(long repositoryId, int pullRequestNumber, long reviewId, string dismissalMessage) + { + GitHubReviewDismissal gitHubReviewDismissal = new GitHubReviewDismissal(repositoryId, + pullRequestNumber, + reviewId, + dismissalMessage); + _gitHubReviewDismissals.Add(gitHubReviewDismissal); + } + + /// + /// Create a GitHubIssueToLock and add it to the list of Issues to lock which gets + /// gets updated with the pending updates. + /// + /// + /// + /// + public void LockIssue(long repositoryId, int issueNumber, LockReason lockReason) + { + GitHubIssueToLock gitHubIssueToLock = new GitHubIssueToLock(repositoryId, + issueNumber, + lockReason); + _gitHubIssuesToLock.Add(gitHubIssueToLock); + } + + /// + /// Scheduled events will process multiple issue update. This function adds them to + /// list of IssueUpdates that will get processed with the pending updates. + /// + /// Repository Id of the Issue or PullRequest + /// Issue or PullRequest number being updated + /// The modified IssueUpdate + public void AddToIssueUpdateList(long repositoryId, int issueOrPRNumber, IssueUpdate issueUpdate) + { + GitHubIssueToUpdate gitHubIssueToUpdate = new GitHubIssueToUpdate(repositoryId, issueOrPRNumber, issueUpdate); + _gitHubIssuesToUpdate.Add(gitHubIssueToUpdate); + } + + + /// + /// Common function to get files for a pull request. The default page size for the API is 30 + /// and needs to be set to 100 to minimize calls, do that here. + /// + /// The Id of the repository + /// The pull request number + /// IReadOnlyList of PullRequestFiles associated with the pull request + public virtual async Task> GetFilesForPullRequest(long repositoryId, int pullRequestNumber) + { + // For whatever reason the default page size is 30 instead of 100. + ApiOptions apiOptions = new ApiOptions(); + apiOptions.PageSize = 100; + return await _gitHubClient.PullRequest.Files(repositoryId, pullRequestNumber, apiOptions); + } + + /// + /// Check to see if a given user is a Collaborator + /// + /// The Id of the repository + /// The User.Login for the event object from the action payload + /// bool, true if the user is a Collaborator, false otherwise + public virtual async Task IsUserCollaborator(long repositoryId, string user) + { + return await _gitHubClient.Repository.Collaborator.IsCollaborator(repositoryId, user); + } + + /// + /// Check to see if the user is a member of the given Org + /// + /// Organization name. Chances are this will only ever be "Azure" + /// The User.Login for the event object from the action payload + /// bool, true if the user is a member of the org, false otherwise + public virtual async Task IsUserMemberOfOrg(string orgName, string user) + { + // Chances are the orgname is only going to be "Azure" + return await _gitHubClient.Organization.Member.CheckMember(orgName, user); + } + + /// + /// Check whether or not a user has a specific collaborator permission + /// + /// The Id of the Repository + /// The User.Login for the event object from the action payload + /// OctoKit.PermissionLevel to check + /// bool, true if the user has the permission level, false otherwise + public async Task DoesUserHavePermission(long repositoryId, string user, string permission) + { + List permissionList = new List + { + permission + }; + return await DoesUserHavePermissions(repositoryId, user, permissionList); + } + + /// + /// There are a lot of checks to see if user has Write Collaborator permissions, however, + /// Collaborator permission levels are Admin, Write, Read and None. Checking to see if a + /// user has Write permissions translates to does the user have Admin or Write. + /// + /// The Id of the Repository + /// The User.Login for the event object from the action payload + /// bool, true if the use has Write or Admin permissions, false otherwise + public async Task DoesUserHaveAdminOrWritePermission(long repositoryId, string user) + { + List permissionList = new List + { + PermissionLevel.Admin, + PermissionLevel.Write + }; + return await DoesUserHavePermissions(repositoryId, user, permissionList); + } + + /// + /// Check whether or not the user has one of the permissions in the list. There's no concept of a permission + /// hierarchy when checking permissions. For example, if something requires a user have Write permission + /// then the check needs to look for Write or Admin permission. + /// + /// The Id of the Repository + /// The User.Login for the event object from the action payload + /// List of Octokit.PermissionLevels + /// bool, true if the user has any permissions in the permissionList, false otherwise + public virtual async Task DoesUserHavePermissions(long repositoryId, string user, List permissionList) + { + try + { + CollaboratorPermissionResponse collaboratorPermission = await _gitHubClient.Repository.Collaborator.ReviewPermission(repositoryId, user); + // If the user has one of the permissions on the list return true + foreach (var permission in permissionList) + { + if (collaboratorPermission.Permission == permission) + { + return true; + } + } + } + catch (Exception ex) + { + // If this throws it's because it's being checked for a non-user (bot) or the user somehow doesn't exist. + // If that's not the case, rethrow the exception, otherwise let processing return false + if (!ex.Message.Contains(NotAUserPartial, StringComparison.OrdinalIgnoreCase)) + { + throw; + } + } + return false; + } + + /// + /// Create a SearchIssuesRequest with the information passed in. + /// + /// Should be the repository.Owner.Login from the cron payload + /// Should be repository.Name from the cron payload + /// IssueTypeQualifier of Issue or PullRequest + /// ItemState of Open or Closed + /// Optional: List of IssueIsQualifier (ex. locked/unlocked) to include, null if none + /// Optional: List of labels to include, null if none + /// Optional: List of labels to exclude, null if none + /// Optional: Number of days since last updated + /// SearchIssuesRequest created with the information passed in. + public SearchIssuesRequest CreateSearchRequest(string repoOwner, + string repoName, + IssueTypeQualifier issueType, + ItemState itemState, + int daysSinceLastUpdate = 0, + List issueIsQualifiers = null, + List labelsToInclude = null, + List labelsToExclude = null) + { + var request = new SearchIssuesRequest(); + + // The repo owner + request.Repos.Add(repoOwner, repoName); + + // Can only search for opened or closed + request.State = itemState; + if (null != issueIsQualifiers) + { + request.Is = issueIsQualifiers; + } + + // restrict the search to issues (IssueTypeQualifier.Issue) + // or pull requests (IssueTypeQualifier.PullRequest) + request.Type = issueType; + + if (daysSinceLastUpdate > 0) + { + // Octokit's DateRange wants a DateTimeOffset as other constructors are depricated + // AddDays of 0-days to effectively subtract them. + DateTime daysAgo = DateTime.UtcNow.AddDays(0 - daysSinceLastUpdate); + DateTimeOffset daysAgoOffset = new DateTimeOffset(daysAgo); + request.Updated = new DateRange(daysAgoOffset, SearchQualifierOperator.LessThan); + } + + if (null != labelsToInclude) + { + request.Labels = labelsToInclude; + } + + if (null != labelsToExclude) + { + // This is how things would get exluded. Anything that needs to be an exclusion + // for the query needs added to a SearchIssuesRequestExclusions and then + // the Exclusions on the request needs to be set to that. + var exclusions = new SearchIssuesRequestExclusions(); + exclusions.Labels = labelsToExclude; + request.Exclusions = exclusions; + } + return request; + } + + /// + /// Execute the query for a given SearchIssuesRequest. It was necessary to break up the SearchIssuesRequest + /// and the query due to pagination. The SearchIssuesResult will only contain to up the first 100 results. + /// Subsequent results need to be requeried with the SearchIssuesRequest.Page incremented to get the next 100 + /// results and so on. + /// + /// SearchIssuesRequest objected which contains the search criteria. + /// OctoKit.SearchIssuesResult + public virtual async Task QueryIssues(SearchIssuesRequest searchIssuesRequest) + { + int maxTries = 5; + // 61 seconds + int sleepDuration = 61000; + for (int tryNumber = 1; tryNumber <= maxTries; tryNumber++) + { + try + { + Console.WriteLine($"Calling SearchIssues, try number {tryNumber}. Page number={searchIssuesRequest.Page}, results per page={searchIssuesRequest.PerPage}"); + await WriteSearchRateLimits("Search RateLimit before call to SearchIssues:"); + var searchIssueResult = await _gitHubClient.Search.SearchIssues(searchIssuesRequest); + await WriteSearchRateLimits("Search RateLimit after call to SearchIssues:"); + Console.WriteLine($"Call returned {searchIssueResult.Items.Count} results out of {searchIssueResult.TotalCount} total results."); + return searchIssueResult; + } + catch (SecondaryRateLimitExceededException secondaryRateLimitEx) + { + Console.WriteLine($"In QueryIssues, a SecondaryRateLimitExceededException was caught from a SearchIssues call."); + if (null != secondaryRateLimitEx.HttpResponse) + { + Console.WriteLine($"HttpStatusCode={secondaryRateLimitEx.HttpResponse.StatusCode}"); + Console.WriteLine("HttpResponse info:"); + foreach (KeyValuePair kvp in secondaryRateLimitEx.HttpResponse.Headers) + { + Console.WriteLine($"[{kvp.Key}, {kvp.Value}]"); + } + } + else + { + Console.WriteLine("secondaryRateLimitEx.HttpResponse was null"); + } + if (tryNumber == maxTries) + { + Console.WriteLine($"QueryIssues, number of retries, {maxTries}, have been exhausted, rethrowing."); + throw; + } + else + { + Console.WriteLine($"QueryIssues, sleeping for {sleepDuration/61} seconds before retrying."); + // Task.Delay over Sleep will push the wait into the IO completion state and unblocks the thread + // from the threadpool whereas sleep blocks the thread in the threadpool. + await Task.Delay(tryNumber * sleepDuration); + } + } + } + // This code will never get hit. + // This is fix CS0161 (not all code paths return a value). Either the function will return a successful + // SearchIssuesResult above OR it'll rethrow the last SecondaryRateLimitExceededException encountered + // in the retry loop. + SearchIssuesResult searchIssuesResult = new SearchIssuesResult(); + return searchIssuesResult; + } + + /// + /// This method creates a GitHubClient using the GITHUB_TOKEN from the environment for authentication + /// + /// This is used to generate the User Agent string sent with each request. The name used should represent the product, the GitHub Organization, or the GitHub username that's using Octokit.net (in that order of preference). + /// If the product header name is null or empty + /// If there is no GITHUB_TOKEN in the environment + /// Authenticated GitHubClient + public virtual GitHubClient CreateClientWithGitHubEnvToken(string productHeaderName) + { + if (string.IsNullOrEmpty(productHeaderName)) + { + throw new ArgumentException("productHeaderName cannot be null or empty"); + } + var githubToken = Environment.GetEnvironmentVariable("GITHUB_TOKEN"); + if (string.IsNullOrEmpty(githubToken)) + { + throw new ApplicationException("GITHUB_TOKEN cannot be null or empty"); + } + var gitHubClient = new GitHubClient(new ProductHeaderValue(productHeaderName)) + { + Credentials = new Credentials(githubToken) + }; + return gitHubClient; + } + + /// + /// Load the rules configuration. + /// + /// Optional path to the rules config location. If not set it'll check for the rules configuration in its well known location. + /// RulesConfiguration loaded from the input location or well known location + public virtual RulesConfiguration LoadRulesConfiguration(string rulesConfigLocation = null) + { + // if the rulesConfigLocation is set, try and load the rules from there, otherwise + // use the directory climber to find the root of the repository and pull it from + // the .github or .github/workflows directory + var rulesConfiguration = new RulesConfiguration(rulesConfigLocation); + return rulesConfiguration; + } + + /// + /// Class to hold the response from the AI Label Service query + /// + public class LabelResponse + { + public string[] Labels { get; set; } + } + + public virtual async Task> QueryAILabelService(IssueEventGitHubPayload issueEventPayload) + { + // The LABEL_SERVICE_API_KEY is queried from Keyvault as part of the action and added to the + // environment. + string AIServiceKey = Environment.GetEnvironmentVariable("LABEL_SERVICE_API_KEY"); + if (string.IsNullOrEmpty(AIServiceKey)) + { + Console.WriteLine("LABEL_SERVICE_API_KEY is null or empty."); + return new List(); + } + string requestUrl = $"https://issuelabeler.azurewebsites.net/api/AzureSdkIssueLabelerService?code={AIServiceKey}"; + + var payload = new + { + IssueNumber = issueEventPayload.Issue.Number, + issueEventPayload.Issue.Title, + issueEventPayload.Issue.Body, + IssueUserLogin = issueEventPayload.Issue.User.Login, + RepositoryName = issueEventPayload.Repository.Name, + RepositoryOwnerName = issueEventPayload.Repository.Owner.Login + }; + using var client = new HttpClient(); + List returnList; + try + { + var response = await client.PostAsJsonAsync(requestUrl, payload).ConfigureAwait(false); + // The AI Label Service will return a HttpStatusCode.OK in the following cases + // 1. There is a AI model for the repository. It'll also return the list of labels, if any. + // 2. There is not an AI model for the repository. The list of suggestions will be empty. At + // this point the expectation is that the logging for the AI label service will indicate + // that it was called for a repository that doesn't have AI models. + // If the AI Label Service doesn't return HttpStatusCode.OK, just log that here and return an + // empty list. + if (response.StatusCode == System.Net.HttpStatusCode.OK) + { + var suggestions = await response.Content.ReadFromJsonAsync().ConfigureAwait(false); + returnList = new List(suggestions.Labels); + } + else + { + Console.WriteLine($"The AI Label service did not return a success. Status Code={response.StatusCode}, Reason={response.ReasonPhrase}"); + returnList = new List(); + } + } + catch (Exception ex) + { + Console.WriteLine($"Exception calling AI Label Service. Exception={ex}"); + returnList = new List(); + } + return returnList; + } + } +} diff --git a/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor/GitHubPayload/IssueEventGitHubPayload.cs b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor/GitHubPayload/IssueEventGitHubPayload.cs new file mode 100644 index 00000000000..7d41409879d --- /dev/null +++ b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor/GitHubPayload/IssueEventGitHubPayload.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Text; +using Octokit; + +namespace Azure.Sdk.Tools.GitHubEventProcessor.GitHubPayload +{ + /// + /// Class used to deserialize Issue event payloads. The reason why Octokit's IssueEventPayload + /// can't be used directly is because it's missing the Label which necessary to know the label + /// added/removed for the labeled/unlabeled events. This class uses the existing Octokit classes + /// as well as Octokit's SimpleJsonSerializer for deserialization. + /// + [DebuggerDisplay("{DebuggerDisplay,nq}")] + public class IssueEventGitHubPayload : ActivityPayload + { + public string Action { get; private set; } + public Issue Issue { get; private set; } + public Label Label { get; private set; } + } +} diff --git a/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor/GitHubPayload/PullRequestEventGitHubPayload.cs b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor/GitHubPayload/PullRequestEventGitHubPayload.cs new file mode 100644 index 00000000000..53dc21c6f36 --- /dev/null +++ b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor/GitHubPayload/PullRequestEventGitHubPayload.cs @@ -0,0 +1,31 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Net.WebSockets; +using System.Text; +using Octokit; + +namespace Azure.Sdk.Tools.GitHubEventProcessor.GitHubPayload +{ + /// + /// Class used to deserialize PullRequest event payloads. The reason why Octokit's PullRequestEventPayload + /// can't be used directly is because it's missing the Label which necessary to know the label added/removed + /// for the labeled/unlabeled events. This class uses the existing Octokit classes as well as Octokit's + /// SimpleJsonSerializer for deserialization. The other anomaly here is the AutoMergeEnabled which requires + /// special processing to set. + /// + [DebuggerDisplay("{DebuggerDisplay,nq}")] + public class PullRequestEventGitHubPayload : ActivityPayload + { + public string Action { get; private set; } + public int Number { get; private set; } + public PullRequest PullRequest { get; private set; } + public Label Label { get; private set; } + + // The actions event payload for a pull_request has a class on the pull request that + // the OctoKit.PullRequest class does not have. If the user has enabled Auto-Merge + // through the pull request UI. + public bool AutoMergeEnabled { get; set; } + + } +} diff --git a/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor/GitHubPayload/ScheduledEventGitHubPayload.cs b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor/GitHubPayload/ScheduledEventGitHubPayload.cs new file mode 100644 index 00000000000..5ac82159237 --- /dev/null +++ b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor/GitHubPayload/ScheduledEventGitHubPayload.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Text; +using Octokit; + +namespace Azure.Sdk.Tools.GitHubEventProcessor.GitHubPayload +{ + + /// + /// Class used to deserialize Scheduled event payloads. There is no Octokit equivalent + /// class for Scheduled events. This class uses the existing Octokit Repository classes + /// as well as Octokit's SimpleJsonSerializer for deserialization. + /// + public class ScheduledEventGitHubPayload + { + public Repository Repository { get; protected set; } + public string Schedule { get; private set; } + public string Workflow { get; private set; } + } + +} diff --git a/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor/Program.cs b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor/Program.cs new file mode 100644 index 00000000000..ffdbfc43233 --- /dev/null +++ b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor/Program.cs @@ -0,0 +1,103 @@ +using System; +using System.IO; +using Octokit; +using Azure.Sdk.Tools.GitHubEventProcessor.GitHubPayload; +using System.Text.Json; +using Octokit.Internal; +using System.Threading.Tasks; +using Azure.Sdk.Tools.GitHubEventProcessor.EventProcessing; +using Azure.Sdk.Tools.GitHubEventProcessor.Utils; +using Azure.Sdk.Tools.GitHubEventProcessor.Constants; + +namespace Azure.Sdk.Tools.GitHubEventProcessor +{ + internal class Program + { + static async Task Main(string[] args) + { + // "dotnet run --" the "--" says don't count dotnet run as arguments + if (args.Length < 2) + { + Console.WriteLine("Error: There are two required arguments:"); + Console.WriteLine(" 1. The github.event_name"); + Console.WriteLine(" 2. The GITHUB_PAYLOAD json file."); + Environment.Exit(1); + return; + } + if (!File.Exists(args[1])) + { + Console.WriteLine($"Error: The GITHUB_PAYLOAD file {args[1]} does not exist."); + Environment.Exit(1); + return; + } + + string eventName = args[0]; + var serializer = new SimpleJsonSerializer(); + string rawJson = File.ReadAllText(args[1]); + GitHubEventClient gitHubEventClient = new GitHubEventClient(OrgConstants.ProductHeaderName); + await gitHubEventClient.WriteRateLimits("RateLimit at start of execution:"); + switch (eventName) + { + case EventConstants.Issues: + { + IssueEventGitHubPayload issueEventPayload = serializer.Deserialize(rawJson); + await IssueProcessing.ProcessIssueEvent(gitHubEventClient, issueEventPayload); + break; + } + case EventConstants.IssueComment: + { + IssueCommentPayload issueCommentPayload = serializer.Deserialize(rawJson); + // IssueComment events are for both issues and pull requests. If the comment is on a pull request, + // then Issue's PullRequest object in the payload will be non-null + if (issueCommentPayload.Issue.PullRequest != null) + { + await PullRequestCommentProcessing.ProcessPullRequestCommentEvent(gitHubEventClient, issueCommentPayload); + } + else + { + await IssueCommentProcessing.ProcessIssueCommentEvent(gitHubEventClient, issueCommentPayload); + } + + break; + } + case EventConstants.PullRequestTarget: + { + // The pull_request, because of the auto_merge processing, requires more than just deserialization of the + // the rawJson. + PullRequestEventGitHubPayload prEventPayload = PullRequestProcessing.DeserializePullRequest(rawJson, serializer); + await PullRequestProcessing.ProcessPullRequestEvent(gitHubEventClient, prEventPayload); + break; + } + case EventConstants.PullRequestReview: + { + PullRequestReviewEventPayload prReviewEventPayload = serializer.Deserialize(rawJson); + await PullRequestReviewProcessing.ProcessPullRequestReviewEvent(gitHubEventClient, prReviewEventPayload); + break; + } + case EventConstants.Schedule: + { + if (args.Length < 3) + { + Console.WriteLine("Error: For scheduled tasks there are three required arguments:"); + Console.WriteLine($" 1. The github.event_name (which will be {EventConstants.Schedule} for cron tasks."); + Console.WriteLine(" 2. The GITHUB_PAYLOAD json file."); + Console.WriteLine(" 3. The cron task to run."); + Environment.Exit(1); + return; + } + + ScheduledEventGitHubPayload scheduledEventPayload = serializer.Deserialize(rawJson); + string cronTaskToRun = args[2]; + await ScheduledEventProcessing.ProcessScheduledEvent(gitHubEventClient, scheduledEventPayload, cronTaskToRun); + break; + } + default: + { + Console.WriteLine($"Event type {eventName} does not have any processing associated with it."); + break; + } + } + await gitHubEventClient.WriteRateLimits("RateLimit at end of execution:"); + } + } +} diff --git a/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor/README.md b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor/README.md new file mode 100644 index 00000000000..0b89ccf3efe --- /dev/null +++ b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor/README.md @@ -0,0 +1,73 @@ +# GitHub Event Processor Breakdown + +This is going to be at a very high level as specifics can be found within the code. + +## GitHub Event Client + +[GitHubEventClient](./GitHubEventClient.cs) is a singleton and contains the following: + +1. The authenticated GitHubClient - Authenticated using the GITHUB_TOKEN provided by GitHub Actions. +2. The loaded Rules Configuration for the repository it's running in +3. Convenience functions - Anything having to deal with GitHub communication/queries and Rules. +4. All pending updates - Event processing can create a number of different updates, things like issue updates, comments, review dismissals etc. During event processing, any updates are stored here and when all the rules have been processed the pending updates will be made. + +### Why pending updates are handled at the end of processing + +GitHub mostly treats Issues and Pull Requests the same. Title, Body, Assignees, Milestone, State (Open/Closed) and Labels are all modified and updated in the same manner. With the GitHub API, any or all of the aforementioned items are updated with a single call regardless of the number of changes. Any rules that run as a result of processing for a specific Event/Action will make any of these types of changes to a shared IssueUpdate instance and the resulting update will be the culmination of changes. This differs from how FabricBot processes rules today in which each rule operates on the original item and simultaneous updates are made for each rule. This has the possibility to do make conflicting updates in which the last one in wins. + +## Constants + +[Constants](./Constants/) + +- **Event Constants** - These match the [events that trigger workflows](https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows). These are used to determine what payload class to deserialize the json event payload into and what type of event is being processed. For example, **issues** and **issue_comment** +- **Action Constants** - Each event has a number of activities it supports and these is used in rules processing. Every action rule has criteria, defining what action on a give event should cause processing. For example, **labeled** is action on an **issue**. +- **Label Constants** - These are very specifically labels that are common across all of the repositories and used explicitly by rules processing. These are labels like "needs-triage" or "Service Attention". No team or language specific labels belong in here. +- **Rules Constants** - These match the rules the [event-processor.config](../YmlAndConfigFiles/event-processor.config) file. If a new rule is being created, then a new constant needs to be defined here and will ultimately need to be added to the config file so it'll process if turned on. +- **Comment Constants** - There are rules that process based upon certain phrases being in comments. For example, Reopen Pull Request triggers on the issue_comment creation where the comment has the word **/reopen** in it. +- **Org Constants** - This is actually Org and Product constants. It just contains the org constant for Azure and the constant for the product header name which is required when registering the GitHubClient. + +## GitHubPayload + +[GitHubPayload](./GitHubPayload/) For the most part, the **GITHUB_PAYLOAD** from the action maps exactly to the Octokit.Net classes with a couple of exceptions. The payload for Pull Request and Issue Events, specifically for labeled/unlabeled actions, contains the label that was being added or removed which the Octokit.Net classes did not have. The IssueEventGitHubPayload and PullRequestEventGitHubPayload classes are effectively the same as their Octokit.Net counterparts with the exception of this added label. PullRequestEventGitHubPayload was also missing AutoMergeEnabled. Since we don't need the contents of that, just whether it's there or not, this was simply replaced with a flag. The other exception was ScheduledEventGitHubPayload. Octokit.Net isn't explicitly made for GitHub Actions and doesn't have a Scheduled event which is why this class was necessary. + +## Event Processing + +[EventProcessing](./EventProcessing/) The files are all **Event**Processing.cs and contain all of the processing rules for that event type. For example, [IssueProcessing.cs](./EventProcessing/IssueProcessing.cs) contains all of the rules for Issue Processing. The rules are defined [here](../RULES.md). + +### Event Actions vs Scheduled Events + +Event Actions are user driven, someone creating an issue or adding a label a pull request. Scheduled Events are cron driven. Event Actions get most of their information from the **GITHUB_PAYLOAD** when determining whether or not to process. Scheduled Events execute a search query and all of the criteria is part of the query. Event Actions process on a single, usually an Issue or Pull Request whereas Scheduled Events will process multiple Issues or Pull Requests returned from the query. + +### Event Action Processing + +1. Check whether or not the rule is **On** or **Off**, if **Off** then the rule will not process. +2. Check the trigger (otherwise known as Action). For example, Manual Issue Triage only processes when the **Issues** action is **Labeled** +3. Check the criteria. For example, Manual Issue Triage will only process if the Issue is Open, has the label *needs-triage* and the label being added isn't *needs-triage*. +4. If 1-3 are true, perform the actions for that rule. For example, Manual Issue Triage, if 1-3 are true then the *needs-triage* label is removed from the Issue. + +#### An important note about Event Action criteria + +Most of the criteria information comes from the **GITHUB_PAYLOAD** but there are several rules that require a call to GitHub. For example, some rules require knowing whether or not the user that initiated the action has certain permissions on the repository. Because calls to GitHub count against the Core rate limit for the repository, those are the absolute last piece of criteria checked, only after the rest of the criteria is true. This is purposely done to minimize the number of calls that count against the rate limit. + +### Scheduled Event Processing + +1. Check whether or not the rule is **On** or **Off**, if **Off** then the rule will not process. +2. The criteria for Scheduled Event is the query information to search call. For example, Close Addressed Issues will query for issues that are Open, have the label *issue-addressed* and have had no activity for at least 7 days. +3. All items returned from the query *can* be processed. + +#### Important notes about Scheduled Event Processing + +- For any given Scheduled Event, the processing should be such that, after processing, if the query was immediately run a second time, anything that was just processed would not show up again. For example, part of the criteria for the Close Addressed Issues search is that the issue is open. Processing for this rule closes the issue, which would no longer cause it to show up in query. +- Scheduled Events use the same Core rate limit as Event Action processing. The number of items a given Scheduled Event process is currently governed to 1/10th of the hourly Core rate limit. This is to prevent Scheduled Event processing from eating up the rate limit and adversely affecting Event Action processing. + +## Utilities + +[Utilities](./Utilities/) + +- **DirectoryUtils** - Used to ascend to the root of the repository and, given a subdirectory hint, find a given file. CODOWNERS and the rule configuration both use this to discover the location of their respective files to load. +- **CodeOwnersUtils** - This contains convenience functions to load the CODEOWNERS file and perform the following actions: + - Getting the list of labels based upon file paths for pull_requests + - Getting the list of people to @ mention for Service Attention +- **CommentUtils** - There are several rules that scan comments for specific things, this just contains the common search function to ensure they're all looking for things in the same manner regardless of the rule. +- **LabelUtils** - Similar to comment utils, it contains a common function that'll accept a list of labels from an Issue or Pull Request and check to see if a given label exists. +- **RulesConfiguration** - Methods for loading the rules configuration, checking whether a given rule is enabled, reporting missing rules and a method, used by the mock, to create a default configuration used for testing. diff --git a/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor/Utils/CodeOwnerUtils.cs b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor/Utils/CodeOwnerUtils.cs new file mode 100644 index 00000000000..045981b997b --- /dev/null +++ b/tools/github-event-processor/Azure.Sdk.Tools.GitHubEventProcessor/Utils/CodeOwnerUtils.cs @@ -0,0 +1,166 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Text; +using Azure.Sdk.Tools.CodeOwnersParser; +using Azure.Sdk.Tools.GitHubEventProcessor.Constants; +using Octokit; + +namespace Azure.Sdk.Tools.GitHubEventProcessor.Utils +{ + /// + /// Codeowners utility function wrapper. + /// + public class CodeOwnerUtils + { + private static readonly string CodeownersFileName = "event-processor.config"; + private static readonly string CodeownersSubDirectory = ".github"; + + static List _codeOwnerEntries = null; + public static string codeOwnersFilePathOverride = null; + + /// + /// Return the codeowners file path. It'll either be the overridden path, used for testing + /// or it'll search for it in the repository under the well known location which is the + /// .github directory off the root of the repository. + /// + /// CODEOWNERS file path + public static string GetCodeOwnersFilePath() + { + if (null != codeOwnersFilePathOverride) + { + // If the user overrode the location + return codeOwnersFilePathOverride; + } + else + { + return DirectoryUtils.FindFileInRepository(CodeownersFileName, CodeownersSubDirectory); + } + } + + /// + /// Wrapper function so don't end having to load the CODEOWNERS file multiple + /// times if there's more than one call to get CodeOwnerEntries for information. + /// + /// List of CodeownersEntry + public static List GetCodeOwnerEntries() + { + if (_codeOwnerEntries == null) + { + string codeOwnersFilePath = GetCodeOwnersFilePath(); + Console.WriteLine($"Loading codeowners file, {codeOwnersFilePath}"); + _codeOwnerEntries = CodeownersFile.GetCodeownersEntriesFromFileOrUrl(codeOwnersFilePath); + } + return _codeOwnerEntries; + } + + /// + /// Normally, there's only one CODEOWNER file per repository which is loaded and + /// saved for the life of the action. This function is needed for static testing, + /// which loads fake CODEOWNER files for test scenarios. + /// + /// void + public static void ResetCodeOwnerEntries() + { + if (_codeOwnerEntries != null) + { + _codeOwnerEntries.Clear(); + _codeOwnerEntries = null; + } + } + + + /// + /// Given a list of files from a pull request, return the list of PR labels that + /// that need to get added to the PR. + /// + /// the list of labels on the PR + /// the list of files in the PR + /// String list of labels that need to get added to the PR + public static List GetPRAutoLabelsForFilePaths(IReadOnlyList