Remove pull_request_review processing from actions (#6099)

This commit is contained in:
James Suplizio 2023-05-05 09:54:21 -07:00 коммит произвёл GitHub
Родитель 15e8f1765d
Коммит 415299e772
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
6 изменённых файлов: 15 добавлений и 762 удалений

Просмотреть файл

@ -1,56 +0,0 @@
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
{
/// <summary>
/// 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
/// </summary>
/// <param name="rule">String, RulesConstants for the rule being tested</param>
/// <param name="payloadFile">JSon payload file for the event being tested</param>
/// <param name="ruleState">Whether or not the rule is on/off</param>
[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<PullRequestReviewEventPayload>(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, the NoRecentActivity label removed
Assert.AreEqual(1, totalUpdates, $"The number of updates should have been 1 but was instead, {totalUpdates}");
// Verify that NeedsAuthorFeedback was removed
Assert.True(mockGitHubEventClient.GetLabelsToRemove().Contains(LabelConstants.NoRecentActivity), $"Labels to remove should contain {LabelConstants.NoRecentActivity} and does not.");
}
else
{
Assert.AreEqual(0, totalUpdates, $"{rule} is {ruleState} and should not have produced any updates.");
}
}
}
}

Просмотреть файл

@ -1,612 +0,0 @@
{
"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"
}
}

Просмотреть файл

@ -79,29 +79,12 @@ namespace Azure.Sdk.Tools.GitHubEventProcessor.EventProcessing
/// <summary>
/// Reset Pull Request Activity
/// See Common_ResetPullRequestActivity function for details
/// </summary>
/// <param name="gitHubEventClient">Authenticated GitHubEventClient</param>
/// <param name="prEventPayload">PullRequestEventGitHubPayload deserialized from the json event payload</param>
public static void ResetPullRequestActivity(GitHubEventClient gitHubEventClient,
PullRequestEventGitHubPayload prEventPayload)
{
Common_ResetPullRequestActivity(gitHubEventClient,
prEventPayload.Action,
prEventPayload.PullRequest,
prEventPayload.Repository,
prEventPayload.Sender);
}
/// <summary>
/// Reset Pull Request Activity
/// This action has triggers from 3 different events: pull_request and pull_request_review and issue_comment
/// This action has triggers from 2 different events: pull_request 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
/// the issue, it's not a complete PullRequest like what comes in with a pull_request event.
/// This function only covers pull_request
/// 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
@ -115,15 +98,9 @@ namespace Azure.Sdk.Tools.GitHubEventProcessor.EventProcessing
/// Remove "no-recent-activity" label
/// </summary>
/// <param name="gitHubEventClient">Authenticated GitHubEventClient</param>
/// <param name="action">The action being performed, from the payload object</param>
/// <param name="pullRequest">Octokit.PullRequest object from the respective payload</param>
/// <param name="repository">Octokit.Repository object from the respective payload</param>
/// <param name="sender">Octokit.User from the payload's Sender.</param>
public static void Common_ResetPullRequestActivity(GitHubEventClient gitHubEventClient,
string action,
PullRequest pullRequest,
Repository repository,
User sender)
/// <param name="prEventPayload">PullRequestEventGitHubPayload deserialized from the json event payload</param>
public static void ResetPullRequestActivity(GitHubEventClient gitHubEventClient,
PullRequestEventGitHubPayload prEventPayload)
{
if (gitHubEventClient.RulesConfiguration.RuleEnabled(RulesConstants.ResetPullRequestActivity))
{
@ -132,26 +109,21 @@ namespace Azure.Sdk.Tools.GitHubEventProcessor.EventProcessing
// 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))
if (prEventPayload.Sender.Type != AccountType.Bot &&
LabelUtils.HasLabel(prEventPayload.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)
if ((prEventPayload.Action == ActionConstants.Reopened ||
prEventPayload.Action == ActionConstants.Synchronize ||
prEventPayload.Action == ActionConstants.ReviewRequested) &&
prEventPayload.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)
else if (prEventPayload.Action == ActionConstants.Closed &&
prEventPayload.PullRequest.Merged)
{
removeLabel = true;
}
@ -164,7 +136,7 @@ namespace Azure.Sdk.Tools.GitHubEventProcessor.EventProcessing
}
/// <summary>
/// Reset auto-merge approvals on untrusted changes
/// Reset approvals on untrusted changes if auto-merge is enabled
/// Trigger: pull request synchronized
/// Conditions:
/// Pull request is open

Просмотреть файл

@ -1,43 +0,0 @@
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
{
/// <summary>
/// Every rule will have it's own function that will be called here, the rule configuration will determine
/// which rules will execute.
/// </summary>
/// <param name="gitHubEventClient">Authenticated GitHubEventClient</param>
/// <param name="prReviewEventPayload">PullRequestReviewEventPayload deserialized from the json event payload</param>
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);
}
/// <summary>
/// Reset Pull Request Activity
/// See Common_ResetPullRequestActivity function for details
/// </summary>
/// <param name="gitHubEventClient">Authenticated GitHubEventClient</param>
/// <param name="prReviewEventPayload">PullRequestReviewEventPayload deserialized from the json event payload</param>
public static void ResetPullRequestActivity(GitHubEventClient gitHubEventClient,
PullRequestReviewEventPayload prReviewEventPayload)
{
PullRequestProcessing.Common_ResetPullRequestActivity(gitHubEventClient,
prReviewEventPayload.Action,
prReviewEventPayload.PullRequest,
prReviewEventPayload.Repository,
prReviewEventPayload.Sender);
}
}
}

Просмотреть файл

@ -71,13 +71,6 @@ namespace Azure.Sdk.Tools.GitHubEventProcessor
await PullRequestProcessing.ProcessPullRequestEvent(gitHubEventClient, prEventPayload);
break;
}
case EventConstants.PullRequestReview:
{
PullRequestReviewEventPayload prReviewEventPayload = serializer.Deserialize<PullRequestReviewEventPayload>(rawJson);
gitHubEventClient.SetConfigEntryOverrides(prReviewEventPayload.Repository);
await PullRequestReviewProcessing.ProcessPullRequestReviewEvent(gitHubEventClient, prReviewEventPayload);
break;
}
case EventConstants.Schedule:
{
if (args.Length < 3)

Просмотреть файл

@ -466,7 +466,6 @@ OR
- Changes Pushed
- Merged
- Review Requested
- Review Submitted
OR