From 7749ae954180c5091aebe4b5602656816fdd2f75 Mon Sep 17 00:00:00 2001 From: Udit Date: Wed, 2 Oct 2024 23:52:48 +0530 Subject: [PATCH 01/42] Added Webhook for Repository ruleset --- github/event_types.go | 14 ++++ github/repos_rules.go | 182 +++++++++++++++++++++++++++++++++++++++++- 2 files changed, 194 insertions(+), 2 deletions(-) diff --git a/github/event_types.go b/github/event_types.go index fbe56b20d06..96d69490825 100644 --- a/github/event_types.go +++ b/github/event_types.go @@ -1505,6 +1505,20 @@ type RepositoryImportEvent struct { Sender *User `json:"sender,omitempty"` } +// RepositoryRuleSetEvent event occurs when there is activity relating to repository rulesets +// +// GitHub API docs: https://docs.github.com/en/webhooks/webhook-events-and-payloads#repository_ruleset +type RepositoryRuleSetEvent struct { + Action *string `json:"action,omitempty"` + Enterprise *Enterprise `json:"enterprise,omitempty"` + Installation *Installation `json:"installation,omitempty"` + Organization *Organization `json:"organization,omitempty"` + Repository *Repository `json:"repository,omitempty"` + RepositoryRuleSet RepositoryRuleSet `json:"repository_ruleset"` + Changes *RepositoryRuleSetEditedChanges `json:"changes,omitempty"` + Sender *User `json:"sender"` +} + // RepositoryVulnerabilityAlertEvent is triggered when a security alert is created, dismissed, or resolved. // // GitHub API docs: https://docs.github.com/developers/webhooks-and-events/webhook-events-and-payloads#repository_vulnerability_alert diff --git a/github/repos_rules.go b/github/repos_rules.go index d09bb71d103..192b5e56b0b 100644 --- a/github/repos_rules.go +++ b/github/repos_rules.go @@ -140,7 +140,7 @@ type MergeQueueRuleParameters struct { // RequiredStatusChecksRuleParameters represents the required_status_checks rule parameters. type RequiredStatusChecksRuleParameters struct { - DoNotEnforceOnCreate bool `json:"do_not_enforce_on_create"` + DoNotEnforceOnCreate *bool `json:"do_not_enforce_on_create,omitempty"` RequiredStatusChecks []RuleRequiredStatusChecks `json:"required_status_checks"` StrictRequiredStatusChecksPolicy bool `json:"strict_required_status_checks_policy"` } @@ -155,7 +155,8 @@ type RuleRequiredWorkflow struct { // RequiredWorkflowsRuleParameters represents the workflows rule parameters. type RequiredWorkflowsRuleParameters struct { - RequiredWorkflows []*RuleRequiredWorkflow `json:"workflows"` + DoNotEnforceOnCreate bool `json:"do_not_enforce_on_create,omitempty"` + RequiredWorkflows []*RuleRequiredWorkflow `json:"workflows"` } // RepositoryRule represents a GitHub Rule. @@ -167,6 +168,183 @@ type RepositoryRule struct { RulesetID int64 `json:"ruleset_id"` } +type RepositoryRuleSetEditedChanges struct { + Name *RepositoryRuleSetEditedSource `json:"name,omitempty"` + Enforcement *RepositoryRuleSetEditedSource `json:"enforcement,omitempty"` + Conditions *RepositoryRuleSetEditedConditions `json:"conditions,omitempty"` + Rules *RepositoryRuleSetEditedRules `json:"rules,omitempty"` +} + +type RepositoryRuleSetEditedSource struct { + From *string `json:"from,omitempty"` +} + +type RepositoryRuleSetEditedSources struct { + From []*string `json:"from,omitempty"` +} + +type RepositoryRuleSetEditedConditions struct { + Added []*RepositoryRuleSetRefCondition `json:"added,omitempty"` + Deleted []*RepositoryRuleSetRefCondition `json:"deleted,omitempty"` + Updated []*RepositoryRuleSetEditedUpdatedConditions `json:"updated,omitempty"` +} + +type RepositoryRuleSetEditedRules struct { + Added []*RepositoryRuleSetRule `json:"added,omitempty"` + Deleted []*RepositoryRuleSetRule `json:"deleted,omitempty"` + Updated []*RepositoryRuleSetUpdatedRules `json:"updated,omitempty"` +} + +type RepositoryRuleSetRefCondition struct { + RefName *RulesetRefConditionParameters `json:"ref_name,omitempty"` +} + +type RepositoryRuleSetEditedUpdatedConditions struct { + Condition *RepositoryRuleSetRefCondition `json:"condition,omitempty"` + Changes *RepositoryRuleSetUpdatedConditionsEdited `json:"changes,omitempty"` +} + +type RepositoryRuleSetUpdatedConditionsEdited struct { + ConditionType *RepositoryRuleSetEditedSource `json:"condition_type,omitempty"` + Target *RepositoryRuleSetEditedSource `json:"target,omitempty"` + Include *RepositoryRuleSetEditedSources `json:"include,omitempty"` + Exclude *RepositoryRuleSetEditedSources `json:"exclude,omitempty"` +} + +type RepositoryRuleSetUpdatedRules struct { + Rule *RepositoryRuleSetRule `json:"rule,omitempty"` + Changes *RepositoryRuleSetEditedRuleChanges `json:"changes,omitempty"` +} + +type RepositoryRuleSetEditedRuleChanges struct { + Configuration *RepositoryRuleSetEditedSources `json:"configuration,omitempty"` + RuleType *RepositoryRuleSetEditedSources `json:"rule_type,omitempty"` + Pattern *RepositoryRuleSetEditedSources `json:"pattern,omitempty"` +} +type RepositoryRuleSet struct { + ID int64 `json:"id"` + Name string `json:"name"` + //Possible values for target: "branch", "tag", "push" + Target *string `json:"target,omitempty"` + //Possible values for source type: "Repository", "Organization" + SourceType *string `json:"source_type,omitempty"` + Source string `json:"source"` + // Possible values for enforcement: "disabled", "active", "evaluate" + Enforcement string `json:"enforcement"` + BypassActors []*BypassActor `json:"bypass_actors,omitempty"` + // Possible values for current user can bypass: "always", "pull_requests_only", "never" + CurrentUserCanBypass *string `json:"current_user_can_bypass,omitempty"` + NodeID *string `json:"node_id,omitempty"` + Links *RepositoryRuleSetLink `json:"_links,omitempty"` + Conditions *json.RawMessage `json:"conditions,omitempty"` + Rules []*RepositoryRuleSetRule `json:"rules,omitempty"` + CreatedAt *Timestamp `json:"created_at,omitempty"` + UpdatedAt *Timestamp `json:"updated_at,omitempty"` +} + +type RepositoryRuleSetRule struct { + Creation *RepositoryRuleSetRuleType `json:"creation,omitempty"` + Update *RepositoryRuleSetUpdateRule `json:"update,omitempty"` + Deletion *RepositoryRuleSetRuleType `json:"deletion,omitempty"` + RequireLinearHistory *RepositoryRuleSetRuleType `json:"required_linear_history,omitempty"` + MergeQueue *RepositoryRuleSetMergeQueueRule `json:"merge_queue,omitempty"` + RequireDeployments *RepositoryRuleSetRequireDeploymentsRule `json:"required_deployments,omitempty"` + RequiredSignatures *RepositoryRuleSetRuleType `json:"required_signatures,omitempty"` + PullRequest *RepositoryRuleSetPullRequestRule `json:"pull_request,omitempty"` + RequiredStatusChecks *RepositoryRuleSetRequiredStatusChecksRule `json:"required_status_checks,omitempty"` + NonFastForward *RepositoryRuleSetRuleType `json:"non_fast_forward,omitempty"` + CommitMessagePattern *RepositoryRuleSetPatternRule `json:"commit_message_pattern,omitempty"` + CommitAuthorEmailPattern *RepositoryRuleSetPatternRule `json:"commit_author_email_pattern,omitempty"` + CommitterEmailPattern *RepositoryRuleSetPatternRule `json:"committer_email_pattern,omitempty"` + BranchNamePattern *RepositoryRuleSetPatternRule `json:"branch_name_pattern,omitempty"` + TagNamePattern *RepositoryRuleSetPatternRule `json:"tag_name_pattern,omitempty"` + FilePathRestriction *RepositoryRuleSetFilePathRestrictionRule `json:"file_path_restriction,omitempty"` + MaxFilePathLength *RepositoryRuleSetMaxFilePathLengthRule `json:"max_file_path_length,omitempty"` + FileExtensionRestriction *RepositoryRuleSetFileExtensionRestrictionRule `json:"file_extension_restriction,omitempty"` + MaxFileSize *RepositoryRuleSetMaxFileSizeRule `json:"max_file_size,omitempty"` + Workflows *RepositoryRuleSetWorkflowsRule `json:"workflows,omitempty"` + CodeScanning *RepositoryRuleSetCodeScanningRule `json:"code_scanning,omitempty"` +} +type RepositoryRuleSetLink struct { + Self *RulesetLink `json:"self,omitempty"` + Html *RulesetLink `json:"html,omitempty"` +} + +type RepositoryRuleSetRuleType struct { + Type string `json:"type"` +} + +type RepositoryRuleSetUpdateRule struct { + //Value for Type: "update" + Type string `json:"type"` + Parameters *UpdateAllowsFetchAndMergeRuleParameters `json:"parameters,omitempty"` +} + +type RepositoryRuleSetMergeQueueRule struct { + Type string `json:"type"` + Parameters *MergeQueueRuleParameters `json:"parameters,omitempty"` +} + +type RepositoryRuleSetRequireDeploymentsRule struct { + Type string `json:"type"` + Parameters *RequiredDeploymentEnvironmentsRuleParameters `json:"parameters,omitempty"` +} + +type RepositoryRuleSetPullRequestRule struct { + Type string `json:"type"` + Parameters *PullRequestRuleParameters `json:"parameters,omitempty"` +} + +type RepositoryRuleSetRequiredStatusChecksRule struct { + Type string `json:"type"` + Parameters *RequiredStatusChecksRuleParameters `json:"parameters,omitempty"` +} + +type RepositoryRuleSetPatternRule struct { + Type string `json:"type"` + Parameters *RulePatternParameters `json:"parameters,omitempty"` +} + +type RepositoryRuleSetFilePathRestrictionRule struct { + Type string `json:"type"` + Parameters *RuleFileParameters `json:"parameters,omitempty"` +} + +type RepositoryRuleSetMaxFilePathLengthRule struct { + Type string `json:"type"` + Parameters *RuleMaxFilePathLengthParameters `json:"parameters,omitempty"` +} + +type RepositoryRuleSetFileExtensionRestrictionRule struct { + Type string `json:"type"` + Parameters *RuleFileExtensionRestrictionParameters `json:"parameters,omitempty"` +} + +type RepositoryRuleSetMaxFileSizeRule struct { + Type string `json:"type"` + Parameters *RuleMaxFileSizeParameters `json:"parameters,omitempty"` +} + +type RepositoryRuleSetWorkflowsRule struct { + Type string `json:"type"` + Parameters *RequiredWorkflowsRuleParameters `json:"parameters,omitempty"` +} + +type RepositoryRuleSetCodeScanningRule struct { + Type string `json:"type"` + Parameters *RuleCodeScanningParameters `json:"parameters,omitempty"` +} + +type RuleCodeScanningParameters struct { + CodeScanningTools []CodeScanningTool `json:"code_scanning_tools"` +} + +type CodeScanningTool struct { + AlertsThreshold string `json:"alerts_threshold"` + SecurityAlertsThreshold string `json:"security_alerts_threshold"` + Tool string `json:"tool"` +} + // UnmarshalJSON implements the json.Unmarshaler interface. // This helps us handle the fact that RepositoryRule parameter field can be of numerous types. func (r *RepositoryRule) UnmarshalJSON(data []byte) error { From c473ad5f93448856185f1a03541f35cb8c82a9dd Mon Sep 17 00:00:00 2001 From: Udit Date: Thu, 3 Oct 2024 20:24:16 +0530 Subject: [PATCH 02/42] added test for repository ruleset event --- github/event_types.go | 2 +- github/event_types_test.go | 680 +++++++++++++++++++++++++++++++++++++ 2 files changed, 681 insertions(+), 1 deletion(-) diff --git a/github/event_types.go b/github/event_types.go index 96d69490825..85a1261e8aa 100644 --- a/github/event_types.go +++ b/github/event_types.go @@ -1514,7 +1514,7 @@ type RepositoryRuleSetEvent struct { Installation *Installation `json:"installation,omitempty"` Organization *Organization `json:"organization,omitempty"` Repository *Repository `json:"repository,omitempty"` - RepositoryRuleSet RepositoryRuleSet `json:"repository_ruleset"` + RepositoryRuleSet *RepositoryRuleSet `json:"repository_ruleset"` Changes *RepositoryRuleSetEditedChanges `json:"changes,omitempty"` Sender *User `json:"sender"` } diff --git a/github/event_types_test.go b/github/event_types_test.go index 6f5235efe9e..0d21ebbe5b3 100644 --- a/github/event_types_test.go +++ b/github/event_types_test.go @@ -9448,6 +9448,686 @@ func TestReleaseEvent_Marshal(t *testing.T) { testJSONMarshal(t, u, want) } +func TestRepositoryRuleSetEvent_Marshal(t *testing.T) { + testJSONMarshal(t, &RepositoryRuleSetEvent{}, "{}") + + l := make(map[string]interface{}) + l["key"] = "value" + + jsonMsg, _ := json.Marshal(&l) + + u := &RepositoryRuleSetEvent{ + Action: String("a"), + Enterprise: &Enterprise{ + ID: Int(1), + Slug: String("s"), + Name: String("n"), + NodeID: String("nid"), + AvatarURL: String("au"), + Description: String("d"), + WebsiteURL: String("wu"), + HTMLURL: String("hu"), + CreatedAt: &Timestamp{referenceTime}, + UpdatedAt: &Timestamp{referenceTime}, + }, + Installation: &Installation{ + ID: Int64(1), + NodeID: String("nid"), + AppID: Int64(1), + AppSlug: String("as"), + TargetID: Int64(1), + Account: &User{ + Login: String("l"), + ID: Int64(1), + URL: String("u"), + AvatarURL: String("a"), + GravatarID: String("g"), + Name: String("n"), + Company: String("c"), + Blog: String("b"), + Location: String("l"), + Email: String("e"), + Hireable: Bool(true), + Bio: String("b"), + TwitterUsername: String("t"), + PublicRepos: Int(1), + Followers: Int(1), + Following: Int(1), + CreatedAt: &Timestamp{referenceTime}, + SuspendedAt: &Timestamp{referenceTime}, + }, + AccessTokensURL: String("atu"), + RepositoriesURL: String("ru"), + HTMLURL: String("hu"), + TargetType: String("tt"), + SingleFileName: String("sfn"), + RepositorySelection: String("rs"), + Events: []string{"e"}, + SingleFilePaths: []string{"s"}, + Permissions: &InstallationPermissions{ + Actions: String("a"), + Administration: String("ad"), + Checks: String("c"), + Contents: String("co"), + ContentReferences: String("cr"), + Deployments: String("d"), + Environments: String("e"), + Issues: String("i"), + Metadata: String("md"), + Members: String("m"), + OrganizationAdministration: String("oa"), + OrganizationHooks: String("oh"), + OrganizationPlan: String("op"), + OrganizationPreReceiveHooks: String("opr"), + OrganizationProjects: String("op"), + OrganizationSecrets: String("os"), + OrganizationSelfHostedRunners: String("osh"), + OrganizationUserBlocking: String("oub"), + Packages: String("pkg"), + Pages: String("pg"), + PullRequests: String("pr"), + RepositoryHooks: String("rh"), + RepositoryProjects: String("rp"), + RepositoryPreReceiveHooks: String("rprh"), + Secrets: String("s"), + SecretScanningAlerts: String("ssa"), + SecurityEvents: String("se"), + SingleFile: String("sf"), + Statuses: String("s"), + TeamDiscussions: String("td"), + VulnerabilityAlerts: String("va"), + Workflows: String("w"), + }, + CreatedAt: &Timestamp{referenceTime}, + UpdatedAt: &Timestamp{referenceTime}, + HasMultipleSingleFiles: Bool(false), + SuspendedBy: &User{ + Login: String("l"), + ID: Int64(1), + URL: String("u"), + AvatarURL: String("a"), + GravatarID: String("g"), + Name: String("n"), + Company: String("c"), + Blog: String("b"), + Location: String("l"), + Email: String("e"), + Hireable: Bool(true), + Bio: String("b"), + TwitterUsername: String("t"), + PublicRepos: Int(1), + Followers: Int(1), + Following: Int(1), + CreatedAt: &Timestamp{referenceTime}, + SuspendedAt: &Timestamp{referenceTime}, + }, + SuspendedAt: &Timestamp{referenceTime}, + }, + Organization: &Organization{ + BillingEmail: String("be"), + Blog: String("b"), + Company: String("c"), + Email: String("e"), + TwitterUsername: String("tu"), + Location: String("loc"), + Name: String("n"), + Description: String("d"), + IsVerified: Bool(true), + HasOrganizationProjects: Bool(true), + HasRepositoryProjects: Bool(true), + DefaultRepoPermission: String("drp"), + MembersCanCreateRepos: Bool(true), + MembersCanCreateInternalRepos: Bool(true), + MembersCanCreatePrivateRepos: Bool(true), + MembersCanCreatePublicRepos: Bool(false), + MembersAllowedRepositoryCreationType: String("marct"), + MembersCanCreatePages: Bool(true), + MembersCanCreatePublicPages: Bool(false), + MembersCanCreatePrivatePages: Bool(true), + }, + Repository: &Repository{ + ID: Int64(1), + URL: String("u"), + Name: String("n"), + }, + RepositoryRuleSet: &RepositoryRuleSet{ + ID: 1, + Name: "n", + Target: String("branch"), + SourceType: String("Repository"), + Source: "s", + Enforcement: "disabled", + BypassActors: []*BypassActor{ + { + ActorID: Int64(234), + ActorType: String("Team"), + BypassMode: String("Always"), + }, + }, + CurrentUserCanBypass: String("always"), + NodeID: String("n"), + Links: &RepositoryRuleSetLink{ + Self: &RulesetLink{ + HRef: String("href"), + }, + Html: &RulesetLink{ + HRef: String("href"), + }, + }, + Conditions: (*json.RawMessage)(&jsonMsg), + Rules: []*RepositoryRuleSetRule{ + //Creating just one object with all the possible rules for testing + { + Creation: &RepositoryRuleSetRuleType{ + Type: "creation", + }, + Update: &RepositoryRuleSetUpdateRule{ + Type: "update", + Parameters: &UpdateAllowsFetchAndMergeRuleParameters{ + UpdateAllowsFetchAndMerge: true, + }, + }, + Deletion: &RepositoryRuleSetRuleType{ + Type: "deletion", + }, + RequireLinearHistory: &RepositoryRuleSetRuleType{ + Type: "require_linear_history", + }, + MergeQueue: &RepositoryRuleSetMergeQueueRule{ + Type: "merge_queue", + Parameters: &MergeQueueRuleParameters{ + CheckResponseTimeoutMinutes: 35, + GroupingStrategy: "HEADGREEN", + MaxEntriesToBuild: 8, + MaxEntriesToMerge: 4, + MergeMethod: "SQUASH", + MinEntriesToMerge: 2, + MinEntriesToMergeWaitMinutes: 13, + }, + }, + RequireDeployments: &RepositoryRuleSetRequireDeploymentsRule{ + Type: "required_deployments", + Parameters: &RequiredDeploymentEnvironmentsRuleParameters{ + RequiredDeploymentEnvironments: []string{"test"}, + }, + }, + RequiredSignatures: &RepositoryRuleSetRuleType{ + Type: "required_signatures", + }, + PullRequest: &RepositoryRuleSetPullRequestRule{ + Type: "pull_request", + Parameters: &PullRequestRuleParameters{ + RequireCodeOwnerReview: true, + RequireLastPushApproval: true, + RequiredApprovingReviewCount: 1, + RequiredReviewThreadResolution: true, + DismissStaleReviewsOnPush: true, + }, + }, + RequiredStatusChecks: &RepositoryRuleSetRequiredStatusChecksRule{ + Type: "required_status_checks", + Parameters: &RequiredStatusChecksRuleParameters{ + RequiredStatusChecks: []RuleRequiredStatusChecks{ + { + Context: "test", + IntegrationID: Int64(1), + }, + }, + StrictRequiredStatusChecksPolicy: true, + }, + }, + NonFastForward: &RepositoryRuleSetRuleType{ + Type: "non_fast_forward", + }, + CommitMessagePattern: &RepositoryRuleSetPatternRule{ + Type: "commit_message_pattern", + Parameters: &RulePatternParameters{ + Name: String("avoid test commits"), + Negate: Bool(true), + Operator: "starts_with", + Pattern: "[test]", + }, + }, + CommitAuthorEmailPattern: &RepositoryRuleSetPatternRule{ + Type: "commit_author_email_pattern", + Parameters: &RulePatternParameters{ + Operator: "contains", + Pattern: "github", + }, + }, + CommitterEmailPattern: &RepositoryRuleSetPatternRule{ + Type: "committer_email_pattern", + Parameters: &RulePatternParameters{ + Name: String("avoid commit emails"), + Negate: Bool(true), + Operator: "ends_with", + Pattern: "abc", + }, + }, + BranchNamePattern: &RepositoryRuleSetPatternRule{ + Type: "branch_name_pattern", + Parameters: &RulePatternParameters{ + Name: String("avoid branch names"), + Negate: Bool(true), + Operator: "regex", + Pattern: "github$", + }, + }, + TagNamePattern: &RepositoryRuleSetPatternRule{ + Type: "tag_name_pattern", + Parameters: &RulePatternParameters{ + Name: String("avoid tag names"), + Negate: Bool(true), + Operator: "contains", + Pattern: "github", + }, + }, + FilePathRestriction: &RepositoryRuleSetFilePathRestrictionRule{ + Type: "file_path_restriction", + Parameters: &RuleFileParameters{ + RestrictedFilePaths: &[]string{"/a/file"}, + }, + }, + MaxFilePathLength: &RepositoryRuleSetMaxFilePathLengthRule{ + Type: "max_file_path_length", + Parameters: &RuleMaxFilePathLengthParameters{ + MaxFilePathLength: 255, + }, + }, + FileExtensionRestriction: &RepositoryRuleSetFileExtensionRestrictionRule{ + Type: "file_extension_restriction", + Parameters: &RuleFileExtensionRestrictionParameters{ + RestrictedFileExtensions: []string{".exe"}, + }, + }, + MaxFileSize: &RepositoryRuleSetMaxFileSizeRule{ + Type: "max_file_size", + Parameters: &RuleMaxFileSizeParameters{ + MaxFileSize: 1024, + }, + }, + Workflows: &RepositoryRuleSetWorkflowsRule{ + Type: "workflows", + Parameters: &RequiredWorkflowsRuleParameters{ + RequiredWorkflows: []*RuleRequiredWorkflow{ + { + Path: ".github/workflows/test.yml", + RepositoryID: Int64(1), + }, + }, + }, + }, + CodeScanning: &RepositoryRuleSetCodeScanningRule{ + Type: "code_scanning", + Parameters: &RuleCodeScanningParameters{ + CodeScanningTools: []CodeScanningTool{{ + AlertsThreshold: "alert", + SecurityAlertsThreshold: "security", + Tool: "tool", + }}, + }, + }, + }, + }, + CreatedAt: &Timestamp{referenceTime}, + UpdatedAt: &Timestamp{referenceTime}, + }, + Sender: &User{ + Login: String("l"), + ID: Int64(1), + NodeID: String("n"), + URL: String("u"), + ReposURL: String("r"), + EventsURL: String("e"), + AvatarURL: String("a"), + }, + } + + want := `{ + "action": "a", + "enterprise": { + "id": 1, + "slug": "s", + "name": "n", + "node_id": "nid", + "avatar_url": "au", + "description": "d", + "website_url": "wu", + "html_url": "hu", + "created_at": ` + referenceTimeStr + `, + "updated_at": ` + referenceTimeStr + ` + }, + "installation": { + "id": 1, + "node_id": "nid", + "app_id": 1, + "app_slug": "as", + "target_id": 1, + "account": { + "login": "l", + "id": 1, + "avatar_url": "a", + "gravatar_id": "g", + "name": "n", + "company": "c", + "blog": "b", + "location": "l", + "email": "e", + "hireable": true, + "bio": "b", + "twitter_username": "t", + "public_repos": 1, + "followers": 1, + "following": 1, + "created_at": ` + referenceTimeStr + `, + "suspended_at": ` + referenceTimeStr + `, + "url": "u" + }, + "access_tokens_url": "atu", + "repositories_url": "ru", + "html_url": "hu", + "target_type": "tt", + "single_file_name": "sfn", + "repository_selection": "rs", + "events": [ + "e" + ], + "single_file_paths": [ + "s" + ], + "permissions": { + "actions": "a", + "administration": "ad", + "checks": "c", + "contents": "co", + "content_references": "cr", + "deployments": "d", + "environments": "e", + "issues": "i", + "metadata": "md", + "members": "m", + "organization_administration": "oa", + "organization_hooks": "oh", + "organization_plan": "op", + "organization_pre_receive_hooks": "opr", + "organization_projects": "op", + "organization_secrets": "os", + "organization_self_hosted_runners": "osh", + "organization_user_blocking": "oub", + "packages": "pkg", + "pages": "pg", + "pull_requests": "pr", + "repository_hooks": "rh", + "repository_projects": "rp", + "repository_pre_receive_hooks": "rprh", + "secrets": "s", + "secret_scanning_alerts": "ssa", + "security_events": "se", + "single_file": "sf", + "statuses": "s", + "team_discussions": "td", + "vulnerability_alerts": "va", + "workflows": "w" + }, + "created_at": ` + referenceTimeStr + `, + "updated_at": ` + referenceTimeStr + `, + "has_multiple_single_files": false, + "suspended_by": { + "login": "l", + "id": 1, + "avatar_url": "a", + "gravatar_id": "g", + "name": "n", + "company": "c", + "blog": "b", + "location": "l", + "email": "e", + "hireable": true, + "bio": "b", + "twitter_username": "t", + "public_repos": 1, + "followers": 1, + "following": 1, + "created_at": ` + referenceTimeStr + `, + "suspended_at": ` + referenceTimeStr + `, + "url": "u" + }, + "suspended_at": ` + referenceTimeStr + ` + }, + "organization": { + "name": "n", + "company": "c", + "blog": "b", + "location": "loc", + "email": "e", + "twitter_username": "tu", + "description": "d", + "billing_email": "be", + "is_verified": true, + "has_organization_projects": true, + "has_repository_projects": true, + "default_repository_permission": "drp", + "members_can_create_repositories": true, + "members_can_create_public_repositories": false, + "members_can_create_private_repositories": true, + "members_can_create_internal_repositories": true, + "members_allowed_repository_creation_type": "marct", + "members_can_create_pages": true, + "members_can_create_public_pages": false, + "members_can_create_private_pages": true + }, + "repository": { + "id": 1, + "url": "u", + "name": "n" + }, + "repository_ruleset": { + "id": 1, + "name": "n", + "target": "branch", + "source_type": "Repository", + "source": "s", + "enforcement": "disabled", + "bypass_actors": [ + { + "actor_id": 234, + "actor_type": "Team", + "bypass_mode": "Always" + } + ], + "current_user_can_bypass": "always", + "node_id": "n", + "_links": { + "self": { + "href": "href" + }, + "html": { + "href": "href" + } + }, + "conditions": { + "key": "value" + }, + "rules": [ + { + "creation": { + "type": "creation" + }, + "update": { + "type": "update", + "parameters": { + "update_allows_fetch_and_merge": true + } + }, + "deletion": { + "type": "deletion" + }, + "required_linear_history": { + "type": "require_linear_history" + }, + "merge_queue": { + "type": "merge_queue", + "parameters": { + "check_response_timeout_minutes": 35, + "grouping_strategy": "HEADGREEN", + "max_entries_to_build": 8, + "max_entries_to_merge": 4, + "merge_method": "SQUASH", + "min_entries_to_merge": 2, + "min_entries_to_merge_wait_minutes": 13 + } + }, + "required_deployments": { + "type": "required_deployments", + "parameters": { + "required_deployment_environments": [ + "test" + ] + } + }, + "required_signatures": { + "type": "required_signatures" + }, + "pull_request": { + "type": "pull_request", + "parameters": { + "dismiss_stale_reviews_on_push": true, + "require_code_owner_review": true, + "require_last_push_approval": true, + "required_approving_review_count": 1, + "required_review_thread_resolution": true + } + }, + "required_status_checks": { + "type": "required_status_checks", + "parameters": { + "required_status_checks": [ + { + "context": "test", + "integration_id": 1 + } + ], + "strict_required_status_checks_policy": true + } + }, + "non_fast_forward": { + "type": "non_fast_forward" + }, + "commit_message_pattern": { + "type": "commit_message_pattern", + "parameters": { + "name": "avoid test commits", + "negate": true, + "operator": "starts_with", + "pattern": "[test]" + } + }, + "commit_author_email_pattern": { + "type": "commit_author_email_pattern", + "parameters": { + "operator": "contains", + "pattern": "github" + } + }, + "committer_email_pattern": { + "type": "committer_email_pattern", + "parameters": { + "name": "avoid commit emails", + "negate": true, + "operator": "ends_with", + "pattern": "abc" + } + }, + "branch_name_pattern": { + "type": "branch_name_pattern", + "parameters": { + "name": "avoid branch names", + "negate": true, + "operator": "regex", + "pattern": "github$" + } + }, + "tag_name_pattern": { + "type": "tag_name_pattern", + "parameters": { + "name": "avoid tag names", + "negate": true, + "operator": "contains", + "pattern": "github" + } + }, + "file_path_restriction": { + "type": "file_path_restriction", + "parameters": { + "restricted_file_paths": [ + "/a/file" + ] + } + }, + "max_file_path_length": { + "type": "max_file_path_length", + "parameters": { + "max_file_path_length": 255 + } + }, + "file_extension_restriction": { + "type": "file_extension_restriction", + "parameters": { + "restricted_file_extensions": [ + ".exe" + ] + } + }, + "max_file_size": { + "type": "max_file_size", + "parameters": { + "max_file_size": 1024 + } + }, + "workflows": { + "type": "workflows", + "parameters": { + "workflows": [ + { + "path": ".github/workflows/test.yml", + "repository_id": 1 + } + ] + } + }, + "code_scanning": { + "type": "code_scanning", + "parameters": { + "code_scanning_tools": [ + { + "alerts_threshold": "alert", + "security_alerts_threshold": "security", + "tool": "tool" + } + ] + } + } + } + ], + "created_at": ` + referenceTimeStr + `, + "updated_at": ` + referenceTimeStr + ` + }, + + "sender": { + "login": "l", + "id": 1, + "node_id": "n", + "avatar_url": "a", + "url": "u", + "events_url": "e", + "repos_url": "r" + } +}` + + testJSONMarshal(t, u, want) + +} + func TestContentReferenceEvent_Marshal(t *testing.T) { testJSONMarshal(t, &ContentReferenceEvent{}, "{}") From f7dd113236ed6819abcc20d217e5fcf543e47939 Mon Sep 17 00:00:00 2001 From: Udit Date: Fri, 4 Oct 2024 17:22:23 +0530 Subject: [PATCH 03/42] Add RepositoryRulesetEvent methods --- github/event_types.go | 2 +- github/event_types_test.go | 1460 +++++++++++++++++++++++++++---- github/github-accessors.go | 552 ++++++++++++ github/github-accessors_test.go | 513 +++++++++++ github/messages.go | 1 + github/messages_test.go | 4 + github/repos_rules.go | 15 +- github/repos_rules_test.go | 2 +- 8 files changed, 2364 insertions(+), 185 deletions(-) diff --git a/github/event_types.go b/github/event_types.go index 85a1261e8aa..018904dbbab 100644 --- a/github/event_types.go +++ b/github/event_types.go @@ -1514,7 +1514,7 @@ type RepositoryRuleSetEvent struct { Installation *Installation `json:"installation,omitempty"` Organization *Organization `json:"organization,omitempty"` Repository *Repository `json:"repository,omitempty"` - RepositoryRuleSet *RepositoryRuleSet `json:"repository_ruleset"` + RepositoryRuleSet *RepositoryRuleSet `json:"repository_ruleset"` Changes *RepositoryRuleSetEditedChanges `json:"changes,omitempty"` Sender *User `json:"sender"` } diff --git a/github/event_types_test.go b/github/event_types_test.go index 0d21ebbe5b3..107f9d8c36e 100644 --- a/github/event_types_test.go +++ b/github/event_types_test.go @@ -9610,13 +9610,12 @@ func TestRepositoryRuleSetEvent_Marshal(t *testing.T) { Self: &RulesetLink{ HRef: String("href"), }, - Html: &RulesetLink{ + HTML: &RulesetLink{ HRef: String("href"), }, }, Conditions: (*json.RawMessage)(&jsonMsg), Rules: []*RepositoryRuleSetRule{ - //Creating just one object with all the possible rules for testing { Creation: &RepositoryRuleSetRuleType{ Type: "creation", @@ -9772,6 +9771,532 @@ func TestRepositoryRuleSetEvent_Marshal(t *testing.T) { CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, }, + Changes: &RepositoryRuleSetEditedChanges{ + Name: &RepositoryRuleSetEditedSource{ + From: String("f"), + }, + Enforcement: &RepositoryRuleSetEditedSource{ + From: String("e"), + }, + Conditions: &RepositoryRuleSetEditedConditions{ + Added: []*RepositoryRuleSetRefCondition{ + { + RefName: &RulesetRefConditionParameters{ + Include: []string{"refs/heads/main", "refs/heads/master"}, + Exclude: []string{"refs/heads/dev*"}, + }, + }, + }, + Deleted: []*RepositoryRuleSetRefCondition{ + { + RefName: &RulesetRefConditionParameters{ + Include: []string{"refs/heads/main", "refs/heads/master"}, + Exclude: []string{"refs/heads/dev*"}, + }, + }, + }, + Updated: []*RepositoryRuleSetEditedUpdatedConditions{ + { + Condition: &RepositoryRuleSetRefCondition{ + RefName: &RulesetRefConditionParameters{ + Include: []string{"refs/heads/main", "refs/heads/master"}, + Exclude: []string{"refs/heads/dev*"}, + }, + }, + Changes: &RepositoryRuleSetUpdatedConditionsEdited{ + ConditionType: &RepositoryRuleSetEditedSource{ + From: String("c"), + }, + Target: &RepositoryRuleSetEditedSource{ + From: String("t"), + }, + Include: &RepositoryRuleSetEditedSources{ + From: []*string{String("from")}, + }, + Exclude: &RepositoryRuleSetEditedSources{ + From: []*string{String("to")}, + }, + }, + }, + }, + }, + Rules: &RepositoryRuleSetEditedRules{ + Added: []*RepositoryRuleSetRule{ + //Creating just one object with all the possible rules for testing + { + Creation: &RepositoryRuleSetRuleType{ + Type: "creation", + }, + Update: &RepositoryRuleSetUpdateRule{ + Type: "update", + Parameters: &UpdateAllowsFetchAndMergeRuleParameters{ + UpdateAllowsFetchAndMerge: true, + }, + }, + Deletion: &RepositoryRuleSetRuleType{ + Type: "deletion", + }, + RequireLinearHistory: &RepositoryRuleSetRuleType{ + Type: "require_linear_history", + }, + MergeQueue: &RepositoryRuleSetMergeQueueRule{ + Type: "merge_queue", + Parameters: &MergeQueueRuleParameters{ + CheckResponseTimeoutMinutes: 35, + GroupingStrategy: "HEADGREEN", + MaxEntriesToBuild: 8, + MaxEntriesToMerge: 4, + MergeMethod: "SQUASH", + MinEntriesToMerge: 2, + MinEntriesToMergeWaitMinutes: 13, + }, + }, + RequireDeployments: &RepositoryRuleSetRequireDeploymentsRule{ + Type: "required_deployments", + Parameters: &RequiredDeploymentEnvironmentsRuleParameters{ + RequiredDeploymentEnvironments: []string{"test"}, + }, + }, + RequiredSignatures: &RepositoryRuleSetRuleType{ + Type: "required_signatures", + }, + PullRequest: &RepositoryRuleSetPullRequestRule{ + Type: "pull_request", + Parameters: &PullRequestRuleParameters{ + RequireCodeOwnerReview: true, + RequireLastPushApproval: true, + RequiredApprovingReviewCount: 1, + RequiredReviewThreadResolution: true, + DismissStaleReviewsOnPush: true, + }, + }, + RequiredStatusChecks: &RepositoryRuleSetRequiredStatusChecksRule{ + Type: "required_status_checks", + Parameters: &RequiredStatusChecksRuleParameters{ + RequiredStatusChecks: []RuleRequiredStatusChecks{ + { + Context: "test", + IntegrationID: Int64(1), + }, + }, + StrictRequiredStatusChecksPolicy: true, + }, + }, + NonFastForward: &RepositoryRuleSetRuleType{ + Type: "non_fast_forward", + }, + CommitMessagePattern: &RepositoryRuleSetPatternRule{ + Type: "commit_message_pattern", + Parameters: &RulePatternParameters{ + Name: String("avoid test commits"), + Negate: Bool(true), + Operator: "starts_with", + Pattern: "[test]", + }, + }, + CommitAuthorEmailPattern: &RepositoryRuleSetPatternRule{ + Type: "commit_author_email_pattern", + Parameters: &RulePatternParameters{ + Operator: "contains", + Pattern: "github", + }, + }, + CommitterEmailPattern: &RepositoryRuleSetPatternRule{ + Type: "committer_email_pattern", + Parameters: &RulePatternParameters{ + Name: String("avoid commit emails"), + Negate: Bool(true), + Operator: "ends_with", + Pattern: "abc", + }, + }, + BranchNamePattern: &RepositoryRuleSetPatternRule{ + Type: "branch_name_pattern", + Parameters: &RulePatternParameters{ + Name: String("avoid branch names"), + Negate: Bool(true), + Operator: "regex", + Pattern: "github$", + }, + }, + TagNamePattern: &RepositoryRuleSetPatternRule{ + Type: "tag_name_pattern", + Parameters: &RulePatternParameters{ + Name: String("avoid tag names"), + Negate: Bool(true), + Operator: "contains", + Pattern: "github", + }, + }, + FilePathRestriction: &RepositoryRuleSetFilePathRestrictionRule{ + Type: "file_path_restriction", + Parameters: &RuleFileParameters{ + RestrictedFilePaths: &[]string{"/a/file"}, + }, + }, + MaxFilePathLength: &RepositoryRuleSetMaxFilePathLengthRule{ + Type: "max_file_path_length", + Parameters: &RuleMaxFilePathLengthParameters{ + MaxFilePathLength: 255, + }, + }, + FileExtensionRestriction: &RepositoryRuleSetFileExtensionRestrictionRule{ + Type: "file_extension_restriction", + Parameters: &RuleFileExtensionRestrictionParameters{ + RestrictedFileExtensions: []string{".exe"}, + }, + }, + MaxFileSize: &RepositoryRuleSetMaxFileSizeRule{ + Type: "max_file_size", + Parameters: &RuleMaxFileSizeParameters{ + MaxFileSize: 1024, + }, + }, + Workflows: &RepositoryRuleSetWorkflowsRule{ + Type: "workflows", + Parameters: &RequiredWorkflowsRuleParameters{ + RequiredWorkflows: []*RuleRequiredWorkflow{ + { + Path: ".github/workflows/test.yml", + RepositoryID: Int64(1), + }, + }, + }, + }, + CodeScanning: &RepositoryRuleSetCodeScanningRule{ + Type: "code_scanning", + Parameters: &RuleCodeScanningParameters{ + CodeScanningTools: []CodeScanningTool{{ + AlertsThreshold: "alert", + SecurityAlertsThreshold: "security", + Tool: "tool", + }}, + }, + }, + }, + }, + Deleted: []*RepositoryRuleSetRule{ + //Creating just one object with all the possible rules for testing + { + Creation: &RepositoryRuleSetRuleType{ + Type: "creation", + }, + Update: &RepositoryRuleSetUpdateRule{ + Type: "update", + Parameters: &UpdateAllowsFetchAndMergeRuleParameters{ + UpdateAllowsFetchAndMerge: true, + }, + }, + Deletion: &RepositoryRuleSetRuleType{ + Type: "deletion", + }, + RequireLinearHistory: &RepositoryRuleSetRuleType{ + Type: "require_linear_history", + }, + MergeQueue: &RepositoryRuleSetMergeQueueRule{ + Type: "merge_queue", + Parameters: &MergeQueueRuleParameters{ + CheckResponseTimeoutMinutes: 35, + GroupingStrategy: "HEADGREEN", + MaxEntriesToBuild: 8, + MaxEntriesToMerge: 4, + MergeMethod: "SQUASH", + MinEntriesToMerge: 2, + MinEntriesToMergeWaitMinutes: 13, + }, + }, + RequireDeployments: &RepositoryRuleSetRequireDeploymentsRule{ + Type: "required_deployments", + Parameters: &RequiredDeploymentEnvironmentsRuleParameters{ + RequiredDeploymentEnvironments: []string{"test"}, + }, + }, + RequiredSignatures: &RepositoryRuleSetRuleType{ + Type: "required_signatures", + }, + PullRequest: &RepositoryRuleSetPullRequestRule{ + Type: "pull_request", + Parameters: &PullRequestRuleParameters{ + RequireCodeOwnerReview: true, + RequireLastPushApproval: true, + RequiredApprovingReviewCount: 1, + RequiredReviewThreadResolution: true, + DismissStaleReviewsOnPush: true, + }, + }, + RequiredStatusChecks: &RepositoryRuleSetRequiredStatusChecksRule{ + Type: "required_status_checks", + Parameters: &RequiredStatusChecksRuleParameters{ + RequiredStatusChecks: []RuleRequiredStatusChecks{ + { + Context: "test", + IntegrationID: Int64(1), + }, + }, + StrictRequiredStatusChecksPolicy: true, + }, + }, + NonFastForward: &RepositoryRuleSetRuleType{ + Type: "non_fast_forward", + }, + CommitMessagePattern: &RepositoryRuleSetPatternRule{ + Type: "commit_message_pattern", + Parameters: &RulePatternParameters{ + Name: String("avoid test commits"), + Negate: Bool(true), + Operator: "starts_with", + Pattern: "[test]", + }, + }, + CommitAuthorEmailPattern: &RepositoryRuleSetPatternRule{ + Type: "commit_author_email_pattern", + Parameters: &RulePatternParameters{ + Operator: "contains", + Pattern: "github", + }, + }, + CommitterEmailPattern: &RepositoryRuleSetPatternRule{ + Type: "committer_email_pattern", + Parameters: &RulePatternParameters{ + Name: String("avoid commit emails"), + Negate: Bool(true), + Operator: "ends_with", + Pattern: "abc", + }, + }, + BranchNamePattern: &RepositoryRuleSetPatternRule{ + Type: "branch_name_pattern", + Parameters: &RulePatternParameters{ + Name: String("avoid branch names"), + Negate: Bool(true), + Operator: "regex", + Pattern: "github$", + }, + }, + TagNamePattern: &RepositoryRuleSetPatternRule{ + Type: "tag_name_pattern", + Parameters: &RulePatternParameters{ + Name: String("avoid tag names"), + Negate: Bool(true), + Operator: "contains", + Pattern: "github", + }, + }, + FilePathRestriction: &RepositoryRuleSetFilePathRestrictionRule{ + Type: "file_path_restriction", + Parameters: &RuleFileParameters{ + RestrictedFilePaths: &[]string{"/a/file"}, + }, + }, + MaxFilePathLength: &RepositoryRuleSetMaxFilePathLengthRule{ + Type: "max_file_path_length", + Parameters: &RuleMaxFilePathLengthParameters{ + MaxFilePathLength: 255, + }, + }, + FileExtensionRestriction: &RepositoryRuleSetFileExtensionRestrictionRule{ + Type: "file_extension_restriction", + Parameters: &RuleFileExtensionRestrictionParameters{ + RestrictedFileExtensions: []string{".exe"}, + }, + }, + MaxFileSize: &RepositoryRuleSetMaxFileSizeRule{ + Type: "max_file_size", + Parameters: &RuleMaxFileSizeParameters{ + MaxFileSize: 1024, + }, + }, + Workflows: &RepositoryRuleSetWorkflowsRule{ + Type: "workflows", + Parameters: &RequiredWorkflowsRuleParameters{ + RequiredWorkflows: []*RuleRequiredWorkflow{ + { + Path: ".github/workflows/test.yml", + RepositoryID: Int64(1), + }, + }, + }, + }, + CodeScanning: &RepositoryRuleSetCodeScanningRule{ + Type: "code_scanning", + Parameters: &RuleCodeScanningParameters{ + CodeScanningTools: []CodeScanningTool{{ + AlertsThreshold: "alert", + SecurityAlertsThreshold: "security", + Tool: "tool", + }}, + }, + }, + }, + }, + Updated: []*RepositoryRuleSetUpdatedRules{ + { + Rule: &RepositoryRuleSetRule{ + Creation: &RepositoryRuleSetRuleType{ + Type: "creation", + }, + Update: &RepositoryRuleSetUpdateRule{ + Type: "update", + Parameters: &UpdateAllowsFetchAndMergeRuleParameters{ + UpdateAllowsFetchAndMerge: true, + }, + }, + Deletion: &RepositoryRuleSetRuleType{ + Type: "deletion", + }, + RequireLinearHistory: &RepositoryRuleSetRuleType{ + Type: "require_linear_history", + }, + MergeQueue: &RepositoryRuleSetMergeQueueRule{ + Type: "merge_queue", + Parameters: &MergeQueueRuleParameters{ + CheckResponseTimeoutMinutes: 35, + GroupingStrategy: "HEADGREEN", + MaxEntriesToBuild: 8, + MaxEntriesToMerge: 4, + MergeMethod: "SQUASH", + MinEntriesToMerge: 2, + MinEntriesToMergeWaitMinutes: 13, + }, + }, + RequireDeployments: &RepositoryRuleSetRequireDeploymentsRule{ + Type: "required_deployments", + Parameters: &RequiredDeploymentEnvironmentsRuleParameters{ + RequiredDeploymentEnvironments: []string{"test"}, + }, + }, + RequiredSignatures: &RepositoryRuleSetRuleType{ + Type: "required_signatures", + }, + PullRequest: &RepositoryRuleSetPullRequestRule{ + Type: "pull_request", + Parameters: &PullRequestRuleParameters{ + RequireCodeOwnerReview: true, + RequireLastPushApproval: true, + RequiredApprovingReviewCount: 1, + RequiredReviewThreadResolution: true, + DismissStaleReviewsOnPush: true, + }, + }, + RequiredStatusChecks: &RepositoryRuleSetRequiredStatusChecksRule{ + Type: "required_status_checks", + Parameters: &RequiredStatusChecksRuleParameters{ + RequiredStatusChecks: []RuleRequiredStatusChecks{ + { + Context: "test", + IntegrationID: Int64(1), + }, + }, + StrictRequiredStatusChecksPolicy: true, + }, + }, + NonFastForward: &RepositoryRuleSetRuleType{ + Type: "non_fast_forward", + }, + CommitMessagePattern: &RepositoryRuleSetPatternRule{ + Type: "commit_message_pattern", + Parameters: &RulePatternParameters{ + Name: String("avoid test commits"), + Negate: Bool(true), + Operator: "starts_with", + Pattern: "[test]", + }, + }, + CommitAuthorEmailPattern: &RepositoryRuleSetPatternRule{ + Type: "commit_author_email_pattern", + Parameters: &RulePatternParameters{ + Operator: "contains", + Pattern: "github", + }, + }, + CommitterEmailPattern: &RepositoryRuleSetPatternRule{ + Type: "committer_email_pattern", + Parameters: &RulePatternParameters{ + Name: String("avoid commit emails"), + Negate: Bool(true), + Operator: "ends_with", + Pattern: "abc", + }, + }, + BranchNamePattern: &RepositoryRuleSetPatternRule{ + Type: "branch_name_pattern", + Parameters: &RulePatternParameters{ + Name: String("avoid branch names"), + Negate: Bool(true), + Operator: "regex", + Pattern: "github$", + }, + }, + TagNamePattern: &RepositoryRuleSetPatternRule{ + Type: "tag_name_pattern", + Parameters: &RulePatternParameters{ + Name: String("avoid tag names"), + Negate: Bool(true), + Operator: "contains", + Pattern: "github", + }, + }, + FilePathRestriction: &RepositoryRuleSetFilePathRestrictionRule{ + Type: "file_path_restriction", + Parameters: &RuleFileParameters{ + RestrictedFilePaths: &[]string{"/a/file"}, + }, + }, + MaxFilePathLength: &RepositoryRuleSetMaxFilePathLengthRule{ + Type: "max_file_path_length", + Parameters: &RuleMaxFilePathLengthParameters{ + MaxFilePathLength: 255, + }, + }, + FileExtensionRestriction: &RepositoryRuleSetFileExtensionRestrictionRule{ + Type: "file_extension_restriction", + Parameters: &RuleFileExtensionRestrictionParameters{ + RestrictedFileExtensions: []string{".exe"}, + }, + }, + MaxFileSize: &RepositoryRuleSetMaxFileSizeRule{ + Type: "max_file_size", + Parameters: &RuleMaxFileSizeParameters{ + MaxFileSize: 1024, + }, + }, + Workflows: &RepositoryRuleSetWorkflowsRule{ + Type: "workflows", + Parameters: &RequiredWorkflowsRuleParameters{ + RequiredWorkflows: []*RuleRequiredWorkflow{ + { + Path: ".github/workflows/test.yml", + RepositoryID: Int64(1), + }, + }, + }, + }, + CodeScanning: &RepositoryRuleSetCodeScanningRule{ + Type: "code_scanning", + Parameters: &RuleCodeScanningParameters{ + CodeScanningTools: []CodeScanningTool{{ + AlertsThreshold: "alert", + SecurityAlertsThreshold: "security", + Tool: "tool", + }}, + }, + }, + }, + Changes: &RepositoryRuleSetEditedRuleChanges{ + Configuration: &RepositoryRuleSetEditedSources{ + From: []*string{String("from")}, + }, + RuleType: &RepositoryRuleSetEditedSources{ + From: []*string{String("from")}, + }, + Pattern: &RepositoryRuleSetEditedSources{ + From: []*string{String("from")}, + }, + }, + }, + }, + }, + }, Sender: &User{ Login: String("l"), ID: Int64(1), @@ -9784,171 +10309,171 @@ func TestRepositoryRuleSetEvent_Marshal(t *testing.T) { } want := `{ - "action": "a", - "enterprise": { - "id": 1, - "slug": "s", - "name": "n", - "node_id": "nid", - "avatar_url": "au", - "description": "d", - "website_url": "wu", - "html_url": "hu", - "created_at": ` + referenceTimeStr + `, - "updated_at": ` + referenceTimeStr + ` - }, - "installation": { - "id": 1, - "node_id": "nid", - "app_id": 1, - "app_slug": "as", - "target_id": 1, - "account": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" - }, - "access_tokens_url": "atu", - "repositories_url": "ru", - "html_url": "hu", - "target_type": "tt", - "single_file_name": "sfn", - "repository_selection": "rs", - "events": [ - "e" - ], - "single_file_paths": [ - "s" - ], - "permissions": { - "actions": "a", - "administration": "ad", - "checks": "c", - "contents": "co", - "content_references": "cr", - "deployments": "d", - "environments": "e", - "issues": "i", - "metadata": "md", - "members": "m", - "organization_administration": "oa", - "organization_hooks": "oh", - "organization_plan": "op", - "organization_pre_receive_hooks": "opr", - "organization_projects": "op", - "organization_secrets": "os", - "organization_self_hosted_runners": "osh", - "organization_user_blocking": "oub", - "packages": "pkg", - "pages": "pg", - "pull_requests": "pr", - "repository_hooks": "rh", - "repository_projects": "rp", - "repository_pre_receive_hooks": "rprh", - "secrets": "s", - "secret_scanning_alerts": "ssa", - "security_events": "se", - "single_file": "sf", - "statuses": "s", - "team_discussions": "td", - "vulnerability_alerts": "va", - "workflows": "w" - }, - "created_at": ` + referenceTimeStr + `, - "updated_at": ` + referenceTimeStr + `, - "has_multiple_single_files": false, - "suspended_by": { - "login": "l", - "id": 1, - "avatar_url": "a", - "gravatar_id": "g", - "name": "n", - "company": "c", - "blog": "b", - "location": "l", - "email": "e", - "hireable": true, - "bio": "b", - "twitter_username": "t", - "public_repos": 1, - "followers": 1, - "following": 1, - "created_at": ` + referenceTimeStr + `, - "suspended_at": ` + referenceTimeStr + `, - "url": "u" - }, - "suspended_at": ` + referenceTimeStr + ` - }, - "organization": { - "name": "n", - "company": "c", - "blog": "b", - "location": "loc", - "email": "e", - "twitter_username": "tu", - "description": "d", - "billing_email": "be", - "is_verified": true, - "has_organization_projects": true, - "has_repository_projects": true, - "default_repository_permission": "drp", - "members_can_create_repositories": true, - "members_can_create_public_repositories": false, - "members_can_create_private_repositories": true, - "members_can_create_internal_repositories": true, - "members_allowed_repository_creation_type": "marct", - "members_can_create_pages": true, - "members_can_create_public_pages": false, - "members_can_create_private_pages": true - }, - "repository": { - "id": 1, - "url": "u", - "name": "n" - }, - "repository_ruleset": { - "id": 1, - "name": "n", - "target": "branch", - "source_type": "Repository", - "source": "s", - "enforcement": "disabled", - "bypass_actors": [ - { - "actor_id": 234, - "actor_type": "Team", - "bypass_mode": "Always" - } - ], - "current_user_can_bypass": "always", - "node_id": "n", - "_links": { - "self": { - "href": "href" - }, - "html": { - "href": "href" - } - }, - "conditions": { - "key": "value" - }, - "rules": [ + "action": "a", + "enterprise": { + "id": 1, + "slug": "s", + "name": "n", + "node_id": "nid", + "avatar_url": "au", + "description": "d", + "website_url": "wu", + "html_url": "hu", + "created_at": ` + referenceTimeStr + `, + "updated_at": ` + referenceTimeStr + ` + }, + "installation": { + "id": 1, + "node_id": "nid", + "app_id": 1, + "app_slug": "as", + "target_id": 1, + "account": { + "login": "l", + "id": 1, + "avatar_url": "a", + "gravatar_id": "g", + "name": "n", + "company": "c", + "blog": "b", + "location": "l", + "email": "e", + "hireable": true, + "bio": "b", + "twitter_username": "t", + "public_repos": 1, + "followers": 1, + "following": 1, + "created_at": ` + referenceTimeStr + `, + "suspended_at": ` + referenceTimeStr + `, + "url": "u" + }, + "access_tokens_url": "atu", + "repositories_url": "ru", + "html_url": "hu", + "target_type": "tt", + "single_file_name": "sfn", + "repository_selection": "rs", + "events": [ + "e" + ], + "single_file_paths": [ + "s" + ], + "permissions": { + "actions": "a", + "administration": "ad", + "checks": "c", + "contents": "co", + "content_references": "cr", + "deployments": "d", + "environments": "e", + "issues": "i", + "metadata": "md", + "members": "m", + "organization_administration": "oa", + "organization_hooks": "oh", + "organization_plan": "op", + "organization_pre_receive_hooks": "opr", + "organization_projects": "op", + "organization_secrets": "os", + "organization_self_hosted_runners": "osh", + "organization_user_blocking": "oub", + "packages": "pkg", + "pages": "pg", + "pull_requests": "pr", + "repository_hooks": "rh", + "repository_projects": "rp", + "repository_pre_receive_hooks": "rprh", + "secrets": "s", + "secret_scanning_alerts": "ssa", + "security_events": "se", + "single_file": "sf", + "statuses": "s", + "team_discussions": "td", + "vulnerability_alerts": "va", + "workflows": "w" + }, + "created_at": ` + referenceTimeStr + `, + "updated_at": ` + referenceTimeStr + `, + "has_multiple_single_files": false, + "suspended_by": { + "login": "l", + "id": 1, + "avatar_url": "a", + "gravatar_id": "g", + "name": "n", + "company": "c", + "blog": "b", + "location": "l", + "email": "e", + "hireable": true, + "bio": "b", + "twitter_username": "t", + "public_repos": 1, + "followers": 1, + "following": 1, + "created_at": ` + referenceTimeStr + `, + "suspended_at": ` + referenceTimeStr + `, + "url": "u" + }, + "suspended_at": ` + referenceTimeStr + ` + }, + "organization": { + "name": "n", + "company": "c", + "blog": "b", + "location": "loc", + "email": "e", + "twitter_username": "tu", + "description": "d", + "billing_email": "be", + "is_verified": true, + "has_organization_projects": true, + "has_repository_projects": true, + "default_repository_permission": "drp", + "members_can_create_repositories": true, + "members_can_create_public_repositories": false, + "members_can_create_private_repositories": true, + "members_can_create_internal_repositories": true, + "members_allowed_repository_creation_type": "marct", + "members_can_create_pages": true, + "members_can_create_public_pages": false, + "members_can_create_private_pages": true + }, + "repository": { + "id": 1, + "name": "n", + "url": "u" + }, + "repository_ruleset": { + "id": 1, + "name": "n", + "target": "branch", + "source_type": "Repository", + "source": "s", + "enforcement": "disabled", + "bypass_actors": [ + { + "actor_id": 234, + "actor_type": "Team", + "bypass_mode": "Always" + } + ], + "current_user_can_bypass": "always", + "node_id": "n", + "_links": { + "self": { + "href": "href" + }, + "html": { + "href": "href" + } + }, + "conditions": { + "key": "value" + }, + "rules": [ { "creation": { "type": "creation" @@ -10109,23 +10634,594 @@ func TestRepositoryRuleSetEvent_Marshal(t *testing.T) { } } ], - "created_at": ` + referenceTimeStr + `, - "updated_at": ` + referenceTimeStr + ` - }, - - "sender": { - "login": "l", - "id": 1, - "node_id": "n", - "avatar_url": "a", - "url": "u", - "events_url": "e", - "repos_url": "r" - } -}` + "created_at": ` + referenceTimeStr + `, + "updated_at": ` + referenceTimeStr + ` + }, + "changes": { + "name": { + "from": "f" + }, + "enforcement": { + "from": "e" + }, + "conditions": { + "added": [ + { + "ref_name": { + "include": [ + "refs/heads/main", + "refs/heads/master" + ], + "exclude": [ + "refs/heads/dev*" + ] + } + } + ], + "deleted": [ + { + "ref_name": { + "include": [ + "refs/heads/main", + "refs/heads/master" + ], + "exclude": [ + "refs/heads/dev*" + ] + } + } + ], + "updated": [ + { + "condition": { + "ref_name": { + "include": [ + "refs/heads/main", + "refs/heads/master" + ], + "exclude": [ + "refs/heads/dev*" + ] + } + }, + "changes": { + "condition_type": { + "from": "c" + }, + "target": { + "from": "t" + }, + "include": { + "from": [ + "from" + ] + }, + "exclude": { + "from": [ + "to" + ] + } + } + } + ] + }, + "rules": { + "added": [ + { + "creation": { + "type": "creation" + }, + "update": { + "type": "update", + "parameters": { + "update_allows_fetch_and_merge": true + } + }, + "deletion": { + "type": "deletion" + }, + "required_linear_history": { + "type": "require_linear_history" + }, + "merge_queue": { + "type": "merge_queue", + "parameters": { + "check_response_timeout_minutes": 35, + "grouping_strategy": "HEADGREEN", + "max_entries_to_build": 8, + "max_entries_to_merge": 4, + "merge_method": "SQUASH", + "min_entries_to_merge": 2, + "min_entries_to_merge_wait_minutes": 13 + } + }, + "required_deployments": { + "type": "required_deployments", + "parameters": { + "required_deployment_environments": [ + "test" + ] + } + }, + "required_signatures": { + "type": "required_signatures" + }, + "pull_request": { + "type": "pull_request", + "parameters": { + "dismiss_stale_reviews_on_push": true, + "require_code_owner_review": true, + "require_last_push_approval": true, + "required_approving_review_count": 1, + "required_review_thread_resolution": true + } + }, + "required_status_checks": { + "type": "required_status_checks", + "parameters": { + "required_status_checks": [ + { + "context": "test", + "integration_id": 1 + } + ], + "strict_required_status_checks_policy": true + } + }, + "non_fast_forward": { + "type": "non_fast_forward" + }, + "commit_message_pattern": { + "type": "commit_message_pattern", + "parameters": { + "name": "avoid test commits", + "negate": true, + "operator": "starts_with", + "pattern": "[test]" + } + }, + "commit_author_email_pattern": { + "type": "commit_author_email_pattern", + "parameters": { + "operator": "contains", + "pattern": "github" + } + }, + "committer_email_pattern": { + "type": "committer_email_pattern", + "parameters": { + "name": "avoid commit emails", + "negate": true, + "operator": "ends_with", + "pattern": "abc" + } + }, + "branch_name_pattern": { + "type": "branch_name_pattern", + "parameters": { + "name": "avoid branch names", + "negate": true, + "operator": "regex", + "pattern": "github$" + } + }, + "tag_name_pattern": { + "type": "tag_name_pattern", + "parameters": { + "name": "avoid tag names", + "negate": true, + "operator": "contains", + "pattern": "github" + } + }, + "file_path_restriction": { + "type": "file_path_restriction", + "parameters": { + "restricted_file_paths": [ + "/a/file" + ] + } + }, + "max_file_path_length": { + "type": "max_file_path_length", + "parameters": { + "max_file_path_length": 255 + } + }, + "file_extension_restriction": { + "type": "file_extension_restriction", + "parameters": { + "restricted_file_extensions": [ + ".exe" + ] + } + }, + "max_file_size": { + "type": "max_file_size", + "parameters": { + "max_file_size": 1024 + } + }, + "workflows": { + "type": "workflows", + "parameters": { + "workflows": [ + { + "path": ".github/workflows/test.yml", + "repository_id": 1 + } + ] + } + }, + "code_scanning": { + "type": "code_scanning", + "parameters": { + "code_scanning_tools": [ + { + "alerts_threshold": "alert", + "security_alerts_threshold": "security", + "tool": "tool" + } + ] + } + } + } + ], + "deleted": [ + { + "creation": { + "type": "creation" + }, + "update": { + "type": "update", + "parameters": { + "update_allows_fetch_and_merge": true + } + }, + "deletion": { + "type": "deletion" + }, + "required_linear_history": { + "type": "require_linear_history" + }, + "merge_queue": { + "type": "merge_queue", + "parameters": { + "check_response_timeout_minutes": 35, + "grouping_strategy": "HEADGREEN", + "max_entries_to_build": 8, + "max_entries_to_merge": 4, + "merge_method": "SQUASH", + "min_entries_to_merge": 2, + "min_entries_to_merge_wait_minutes": 13 + } + }, + "required_deployments": { + "type": "required_deployments", + "parameters": { + "required_deployment_environments": [ + "test" + ] + } + }, + "required_signatures": { + "type": "required_signatures" + }, + "pull_request": { + "type": "pull_request", + "parameters": { + "dismiss_stale_reviews_on_push": true, + "require_code_owner_review": true, + "require_last_push_approval": true, + "required_approving_review_count": 1, + "required_review_thread_resolution": true + } + }, + "required_status_checks": { + "type": "required_status_checks", + "parameters": { + "required_status_checks": [ + { + "context": "test", + "integration_id": 1 + } + ], + "strict_required_status_checks_policy": true + } + }, + "non_fast_forward": { + "type": "non_fast_forward" + }, + "commit_message_pattern": { + "type": "commit_message_pattern", + "parameters": { + "name": "avoid test commits", + "negate": true, + "operator": "starts_with", + "pattern": "[test]" + } + }, + "commit_author_email_pattern": { + "type": "commit_author_email_pattern", + "parameters": { + "operator": "contains", + "pattern": "github" + } + }, + "committer_email_pattern": { + "type": "committer_email_pattern", + "parameters": { + "name": "avoid commit emails", + "negate": true, + "operator": "ends_with", + "pattern": "abc" + } + }, + "branch_name_pattern": { + "type": "branch_name_pattern", + "parameters": { + "name": "avoid branch names", + "negate": true, + "operator": "regex", + "pattern": "github$" + } + }, + "tag_name_pattern": { + "type": "tag_name_pattern", + "parameters": { + "name": "avoid tag names", + "negate": true, + "operator": "contains", + "pattern": "github" + } + }, + "file_path_restriction": { + "type": "file_path_restriction", + "parameters": { + "restricted_file_paths": [ + "/a/file" + ] + } + }, + "max_file_path_length": { + "type": "max_file_path_length", + "parameters": { + "max_file_path_length": 255 + } + }, + "file_extension_restriction": { + "type": "file_extension_restriction", + "parameters": { + "restricted_file_extensions": [ + ".exe" + ] + } + }, + "max_file_size": { + "type": "max_file_size", + "parameters": { + "max_file_size": 1024 + } + }, + "workflows": { + "type": "workflows", + "parameters": { + "workflows": [ + { + "path": ".github/workflows/test.yml", + "repository_id": 1 + } + ] + } + }, + "code_scanning": { + "type": "code_scanning", + "parameters": { + "code_scanning_tools": [ + { + "alerts_threshold": "alert", + "security_alerts_threshold": "security", + "tool": "tool" + } + ] + } + } + } + ], + "updated": [ + { + "rule": { + "creation": { + "type": "creation" + }, + "update": { + "type": "update", + "parameters": { + "update_allows_fetch_and_merge": true + } + }, + "deletion": { + "type": "deletion" + }, + "required_linear_history": { + "type": "require_linear_history" + }, + "merge_queue": { + "type": "merge_queue", + "parameters": { + "check_response_timeout_minutes": 35, + "grouping_strategy": "HEADGREEN", + "max_entries_to_build": 8, + "max_entries_to_merge": 4, + "merge_method": "SQUASH", + "min_entries_to_merge": 2, + "min_entries_to_merge_wait_minutes": 13 + } + }, + "required_deployments": { + "type": "required_deployments", + "parameters": { + "required_deployment_environments": [ + "test" + ] + } + }, + "required_signatures": { + "type": "required_signatures" + }, + "pull_request": { + "type": "pull_request", + "parameters": { + "dismiss_stale_reviews_on_push": true, + "require_code_owner_review": true, + "require_last_push_approval": true, + "required_approving_review_count": 1, + "required_review_thread_resolution": true + } + }, + "required_status_checks": { + "type": "required_status_checks", + "parameters": { + "required_status_checks": [ + { + "context": "test", + "integration_id": 1 + } + ], + "strict_required_status_checks_policy": true + } + }, + "non_fast_forward": { + "type": "non_fast_forward" + }, + "commit_message_pattern": { + "type": "commit_message_pattern", + "parameters": { + "name": "avoid test commits", + "negate": true, + "operator": "starts_with", + "pattern": "[test]" + } + }, + "commit_author_email_pattern": { + "type": "commit_author_email_pattern", + "parameters": { + "operator": "contains", + "pattern": "github" + } + }, + "committer_email_pattern": { + "type": "committer_email_pattern", + "parameters": { + "name": "avoid commit emails", + "negate": true, + "operator": "ends_with", + "pattern": "abc" + } + }, + "branch_name_pattern": { + "type": "branch_name_pattern", + "parameters": { + "name": "avoid branch names", + "negate": true, + "operator": "regex", + "pattern": "github$" + } + }, + "tag_name_pattern": { + "type": "tag_name_pattern", + "parameters": { + "name": "avoid tag names", + "negate": true, + "operator": "contains", + "pattern": "github" + } + }, + "file_path_restriction": { + "type": "file_path_restriction", + "parameters": { + "restricted_file_paths": [ + "/a/file" + ] + } + }, + "max_file_path_length": { + "type": "max_file_path_length", + "parameters": { + "max_file_path_length": 255 + } + }, + "file_extension_restriction": { + "type": "file_extension_restriction", + "parameters": { + "restricted_file_extensions": [ + ".exe" + ] + } + }, + "max_file_size": { + "type": "max_file_size", + "parameters": { + "max_file_size": 1024 + } + }, + "workflows": { + "type": "workflows", + "parameters": { + "workflows": [ + { + "path": ".github/workflows/test.yml", + "repository_id": 1 + } + ] + } + }, + "code_scanning": { + "type": "code_scanning", + "parameters": { + "code_scanning_tools": [ + { + "alerts_threshold": "alert", + "security_alerts_threshold": "security", + "tool": "tool" + } + ] + } + } + }, + "changes": { + "configuration": { + "from": [ + "from" + ] + }, + "rule_type": { + "from": [ + "from" + ] + }, + "pattern": { + "from": [ + "from" + ] + } + } + } + ] + } + }, + "sender": { + "login": "l", + "id": 1, + "node_id": "n", + "avatar_url": "a", + "url": "u", + "events_url": "e", + "repos_url": "r" + } + }` testJSONMarshal(t, u, want) - } func TestContentReferenceEvent_Marshal(t *testing.T) { diff --git a/github/github-accessors.go b/github/github-accessors.go index f8e303c4362..96e9011f57e 100644 --- a/github/github-accessors.go +++ b/github/github-accessors.go @@ -20606,6 +20606,550 @@ func (r *RepositoryRule) GetParameters() json.RawMessage { return *r.Parameters } +// GetConditions returns the Conditions field if it's non-nil, zero value otherwise. +func (r *RepositoryRuleSet) GetConditions() json.RawMessage { + if r == nil || r.Conditions == nil { + return json.RawMessage{} + } + return *r.Conditions +} + +// GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. +func (r *RepositoryRuleSet) GetCreatedAt() Timestamp { + if r == nil || r.CreatedAt == nil { + return Timestamp{} + } + return *r.CreatedAt +} + +// GetCurrentUserCanBypass returns the CurrentUserCanBypass field if it's non-nil, zero value otherwise. +func (r *RepositoryRuleSet) GetCurrentUserCanBypass() string { + if r == nil || r.CurrentUserCanBypass == nil { + return "" + } + return *r.CurrentUserCanBypass +} + +// GetLinks returns the Links field. +func (r *RepositoryRuleSet) GetLinks() *RepositoryRuleSetLink { + if r == nil { + return nil + } + return r.Links +} + +// GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. +func (r *RepositoryRuleSet) GetNodeID() string { + if r == nil || r.NodeID == nil { + return "" + } + return *r.NodeID +} + +// GetSourceType returns the SourceType field if it's non-nil, zero value otherwise. +func (r *RepositoryRuleSet) GetSourceType() string { + if r == nil || r.SourceType == nil { + return "" + } + return *r.SourceType +} + +// GetTarget returns the Target field if it's non-nil, zero value otherwise. +func (r *RepositoryRuleSet) GetTarget() string { + if r == nil || r.Target == nil { + return "" + } + return *r.Target +} + +// GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. +func (r *RepositoryRuleSet) GetUpdatedAt() Timestamp { + if r == nil || r.UpdatedAt == nil { + return Timestamp{} + } + return *r.UpdatedAt +} + +// GetParameters returns the Parameters field. +func (r *RepositoryRuleSetCodeScanningRule) GetParameters() *RuleCodeScanningParameters { + if r == nil { + return nil + } + return r.Parameters +} + +// GetConditions returns the Conditions field. +func (r *RepositoryRuleSetEditedChanges) GetConditions() *RepositoryRuleSetEditedConditions { + if r == nil { + return nil + } + return r.Conditions +} + +// GetEnforcement returns the Enforcement field. +func (r *RepositoryRuleSetEditedChanges) GetEnforcement() *RepositoryRuleSetEditedSource { + if r == nil { + return nil + } + return r.Enforcement +} + +// GetName returns the Name field. +func (r *RepositoryRuleSetEditedChanges) GetName() *RepositoryRuleSetEditedSource { + if r == nil { + return nil + } + return r.Name +} + +// GetRules returns the Rules field. +func (r *RepositoryRuleSetEditedChanges) GetRules() *RepositoryRuleSetEditedRules { + if r == nil { + return nil + } + return r.Rules +} + +// GetConfiguration returns the Configuration field. +func (r *RepositoryRuleSetEditedRuleChanges) GetConfiguration() *RepositoryRuleSetEditedSources { + if r == nil { + return nil + } + return r.Configuration +} + +// GetPattern returns the Pattern field. +func (r *RepositoryRuleSetEditedRuleChanges) GetPattern() *RepositoryRuleSetEditedSources { + if r == nil { + return nil + } + return r.Pattern +} + +// GetRuleType returns the RuleType field. +func (r *RepositoryRuleSetEditedRuleChanges) GetRuleType() *RepositoryRuleSetEditedSources { + if r == nil { + return nil + } + return r.RuleType +} + +// GetFrom returns the From field if it's non-nil, zero value otherwise. +func (r *RepositoryRuleSetEditedSource) GetFrom() string { + if r == nil || r.From == nil { + return "" + } + return *r.From +} + +// GetChanges returns the Changes field. +func (r *RepositoryRuleSetEditedUpdatedConditions) GetChanges() *RepositoryRuleSetUpdatedConditionsEdited { + if r == nil { + return nil + } + return r.Changes +} + +// GetCondition returns the Condition field. +func (r *RepositoryRuleSetEditedUpdatedConditions) GetCondition() *RepositoryRuleSetRefCondition { + if r == nil { + return nil + } + return r.Condition +} + +// GetAction returns the Action field if it's non-nil, zero value otherwise. +func (r *RepositoryRuleSetEvent) GetAction() string { + if r == nil || r.Action == nil { + return "" + } + return *r.Action +} + +// GetChanges returns the Changes field. +func (r *RepositoryRuleSetEvent) GetChanges() *RepositoryRuleSetEditedChanges { + if r == nil { + return nil + } + return r.Changes +} + +// GetEnterprise returns the Enterprise field. +func (r *RepositoryRuleSetEvent) GetEnterprise() *Enterprise { + if r == nil { + return nil + } + return r.Enterprise +} + +// GetInstallation returns the Installation field. +func (r *RepositoryRuleSetEvent) GetInstallation() *Installation { + if r == nil { + return nil + } + return r.Installation +} + +// GetOrganization returns the Organization field. +func (r *RepositoryRuleSetEvent) GetOrganization() *Organization { + if r == nil { + return nil + } + return r.Organization +} + +// GetRepository returns the Repository field. +func (r *RepositoryRuleSetEvent) GetRepository() *Repository { + if r == nil { + return nil + } + return r.Repository +} + +// GetRepositoryRuleSet returns the RepositoryRuleSet field. +func (r *RepositoryRuleSetEvent) GetRepositoryRuleSet() *RepositoryRuleSet { + if r == nil { + return nil + } + return r.RepositoryRuleSet +} + +// GetSender returns the Sender field. +func (r *RepositoryRuleSetEvent) GetSender() *User { + if r == nil { + return nil + } + return r.Sender +} + +// GetParameters returns the Parameters field. +func (r *RepositoryRuleSetFileExtensionRestrictionRule) GetParameters() *RuleFileExtensionRestrictionParameters { + if r == nil { + return nil + } + return r.Parameters +} + +// GetParameters returns the Parameters field. +func (r *RepositoryRuleSetFilePathRestrictionRule) GetParameters() *RuleFileParameters { + if r == nil { + return nil + } + return r.Parameters +} + +// GetHTML returns the HTML field. +func (r *RepositoryRuleSetLink) GetHTML() *RulesetLink { + if r == nil { + return nil + } + return r.HTML +} + +// GetSelf returns the Self field. +func (r *RepositoryRuleSetLink) GetSelf() *RulesetLink { + if r == nil { + return nil + } + return r.Self +} + +// GetParameters returns the Parameters field. +func (r *RepositoryRuleSetMaxFilePathLengthRule) GetParameters() *RuleMaxFilePathLengthParameters { + if r == nil { + return nil + } + return r.Parameters +} + +// GetParameters returns the Parameters field. +func (r *RepositoryRuleSetMaxFileSizeRule) GetParameters() *RuleMaxFileSizeParameters { + if r == nil { + return nil + } + return r.Parameters +} + +// GetParameters returns the Parameters field. +func (r *RepositoryRuleSetMergeQueueRule) GetParameters() *MergeQueueRuleParameters { + if r == nil { + return nil + } + return r.Parameters +} + +// GetParameters returns the Parameters field. +func (r *RepositoryRuleSetPatternRule) GetParameters() *RulePatternParameters { + if r == nil { + return nil + } + return r.Parameters +} + +// GetParameters returns the Parameters field. +func (r *RepositoryRuleSetPullRequestRule) GetParameters() *PullRequestRuleParameters { + if r == nil { + return nil + } + return r.Parameters +} + +// GetRefName returns the RefName field. +func (r *RepositoryRuleSetRefCondition) GetRefName() *RulesetRefConditionParameters { + if r == nil { + return nil + } + return r.RefName +} + +// GetParameters returns the Parameters field. +func (r *RepositoryRuleSetRequireDeploymentsRule) GetParameters() *RequiredDeploymentEnvironmentsRuleParameters { + if r == nil { + return nil + } + return r.Parameters +} + +// GetParameters returns the Parameters field. +func (r *RepositoryRuleSetRequiredStatusChecksRule) GetParameters() *RequiredStatusChecksRuleParameters { + if r == nil { + return nil + } + return r.Parameters +} + +// GetBranchNamePattern returns the BranchNamePattern field. +func (r *RepositoryRuleSetRule) GetBranchNamePattern() *RepositoryRuleSetPatternRule { + if r == nil { + return nil + } + return r.BranchNamePattern +} + +// GetCodeScanning returns the CodeScanning field. +func (r *RepositoryRuleSetRule) GetCodeScanning() *RepositoryRuleSetCodeScanningRule { + if r == nil { + return nil + } + return r.CodeScanning +} + +// GetCommitAuthorEmailPattern returns the CommitAuthorEmailPattern field. +func (r *RepositoryRuleSetRule) GetCommitAuthorEmailPattern() *RepositoryRuleSetPatternRule { + if r == nil { + return nil + } + return r.CommitAuthorEmailPattern +} + +// GetCommitMessagePattern returns the CommitMessagePattern field. +func (r *RepositoryRuleSetRule) GetCommitMessagePattern() *RepositoryRuleSetPatternRule { + if r == nil { + return nil + } + return r.CommitMessagePattern +} + +// GetCommitterEmailPattern returns the CommitterEmailPattern field. +func (r *RepositoryRuleSetRule) GetCommitterEmailPattern() *RepositoryRuleSetPatternRule { + if r == nil { + return nil + } + return r.CommitterEmailPattern +} + +// GetCreation returns the Creation field. +func (r *RepositoryRuleSetRule) GetCreation() *RepositoryRuleSetRuleType { + if r == nil { + return nil + } + return r.Creation +} + +// GetDeletion returns the Deletion field. +func (r *RepositoryRuleSetRule) GetDeletion() *RepositoryRuleSetRuleType { + if r == nil { + return nil + } + return r.Deletion +} + +// GetFileExtensionRestriction returns the FileExtensionRestriction field. +func (r *RepositoryRuleSetRule) GetFileExtensionRestriction() *RepositoryRuleSetFileExtensionRestrictionRule { + if r == nil { + return nil + } + return r.FileExtensionRestriction +} + +// GetFilePathRestriction returns the FilePathRestriction field. +func (r *RepositoryRuleSetRule) GetFilePathRestriction() *RepositoryRuleSetFilePathRestrictionRule { + if r == nil { + return nil + } + return r.FilePathRestriction +} + +// GetMaxFilePathLength returns the MaxFilePathLength field. +func (r *RepositoryRuleSetRule) GetMaxFilePathLength() *RepositoryRuleSetMaxFilePathLengthRule { + if r == nil { + return nil + } + return r.MaxFilePathLength +} + +// GetMaxFileSize returns the MaxFileSize field. +func (r *RepositoryRuleSetRule) GetMaxFileSize() *RepositoryRuleSetMaxFileSizeRule { + if r == nil { + return nil + } + return r.MaxFileSize +} + +// GetMergeQueue returns the MergeQueue field. +func (r *RepositoryRuleSetRule) GetMergeQueue() *RepositoryRuleSetMergeQueueRule { + if r == nil { + return nil + } + return r.MergeQueue +} + +// GetNonFastForward returns the NonFastForward field. +func (r *RepositoryRuleSetRule) GetNonFastForward() *RepositoryRuleSetRuleType { + if r == nil { + return nil + } + return r.NonFastForward +} + +// GetPullRequest returns the PullRequest field. +func (r *RepositoryRuleSetRule) GetPullRequest() *RepositoryRuleSetPullRequestRule { + if r == nil { + return nil + } + return r.PullRequest +} + +// GetRequireDeployments returns the RequireDeployments field. +func (r *RepositoryRuleSetRule) GetRequireDeployments() *RepositoryRuleSetRequireDeploymentsRule { + if r == nil { + return nil + } + return r.RequireDeployments +} + +// GetRequiredSignatures returns the RequiredSignatures field. +func (r *RepositoryRuleSetRule) GetRequiredSignatures() *RepositoryRuleSetRuleType { + if r == nil { + return nil + } + return r.RequiredSignatures +} + +// GetRequiredStatusChecks returns the RequiredStatusChecks field. +func (r *RepositoryRuleSetRule) GetRequiredStatusChecks() *RepositoryRuleSetRequiredStatusChecksRule { + if r == nil { + return nil + } + return r.RequiredStatusChecks +} + +// GetRequireLinearHistory returns the RequireLinearHistory field. +func (r *RepositoryRuleSetRule) GetRequireLinearHistory() *RepositoryRuleSetRuleType { + if r == nil { + return nil + } + return r.RequireLinearHistory +} + +// GetTagNamePattern returns the TagNamePattern field. +func (r *RepositoryRuleSetRule) GetTagNamePattern() *RepositoryRuleSetPatternRule { + if r == nil { + return nil + } + return r.TagNamePattern +} + +// GetUpdate returns the Update field. +func (r *RepositoryRuleSetRule) GetUpdate() *RepositoryRuleSetUpdateRule { + if r == nil { + return nil + } + return r.Update +} + +// GetWorkflows returns the Workflows field. +func (r *RepositoryRuleSetRule) GetWorkflows() *RepositoryRuleSetWorkflowsRule { + if r == nil { + return nil + } + return r.Workflows +} + +// GetConditionType returns the ConditionType field. +func (r *RepositoryRuleSetUpdatedConditionsEdited) GetConditionType() *RepositoryRuleSetEditedSource { + if r == nil { + return nil + } + return r.ConditionType +} + +// GetExclude returns the Exclude field. +func (r *RepositoryRuleSetUpdatedConditionsEdited) GetExclude() *RepositoryRuleSetEditedSources { + if r == nil { + return nil + } + return r.Exclude +} + +// GetInclude returns the Include field. +func (r *RepositoryRuleSetUpdatedConditionsEdited) GetInclude() *RepositoryRuleSetEditedSources { + if r == nil { + return nil + } + return r.Include +} + +// GetTarget returns the Target field. +func (r *RepositoryRuleSetUpdatedConditionsEdited) GetTarget() *RepositoryRuleSetEditedSource { + if r == nil { + return nil + } + return r.Target +} + +// GetChanges returns the Changes field. +func (r *RepositoryRuleSetUpdatedRules) GetChanges() *RepositoryRuleSetEditedRuleChanges { + if r == nil { + return nil + } + return r.Changes +} + +// GetRule returns the Rule field. +func (r *RepositoryRuleSetUpdatedRules) GetRule() *RepositoryRuleSetRule { + if r == nil { + return nil + } + return r.Rule +} + +// GetParameters returns the Parameters field. +func (r *RepositoryRuleSetUpdateRule) GetParameters() *UpdateAllowsFetchAndMergeRuleParameters { + if r == nil { + return nil + } + return r.Parameters +} + +// GetParameters returns the Parameters field. +func (r *RepositoryRuleSetWorkflowsRule) GetParameters() *RequiredWorkflowsRuleParameters { + if r == nil { + return nil + } + return r.Parameters +} + // GetCommit returns the Commit field. func (r *RepositoryTag) GetCommit() *Commit { if r == nil { @@ -21006,6 +21550,14 @@ func (r *RequiredStatusChecksRequest) GetStrict() bool { return *r.Strict } +// GetDoNotEnforceOnCreate returns the DoNotEnforceOnCreate field if it's non-nil, zero value otherwise. +func (r *RequiredStatusChecksRuleParameters) GetDoNotEnforceOnCreate() bool { + if r == nil || r.DoNotEnforceOnCreate == nil { + return false + } + return *r.DoNotEnforceOnCreate +} + // GetTotalCount returns the TotalCount field if it's non-nil, zero value otherwise. func (r *RequiredWorkflowSelectedRepos) GetTotalCount() int { if r == nil || r.TotalCount == nil { diff --git a/github/github-accessors_test.go b/github/github-accessors_test.go index 8af9a9b54d2..74508d8b6e1 100644 --- a/github/github-accessors_test.go +++ b/github/github-accessors_test.go @@ -23913,6 +23913,509 @@ func TestRepositoryRule_GetParameters(tt *testing.T) { r.GetParameters() } +func TestRepositoryRuleSet_GetConditions(tt *testing.T) { + var zeroValue json.RawMessage + r := &RepositoryRuleSet{Conditions: &zeroValue} + r.GetConditions() + r = &RepositoryRuleSet{} + r.GetConditions() + r = nil + r.GetConditions() +} + +func TestRepositoryRuleSet_GetCreatedAt(tt *testing.T) { + var zeroValue Timestamp + r := &RepositoryRuleSet{CreatedAt: &zeroValue} + r.GetCreatedAt() + r = &RepositoryRuleSet{} + r.GetCreatedAt() + r = nil + r.GetCreatedAt() +} + +func TestRepositoryRuleSet_GetCurrentUserCanBypass(tt *testing.T) { + var zeroValue string + r := &RepositoryRuleSet{CurrentUserCanBypass: &zeroValue} + r.GetCurrentUserCanBypass() + r = &RepositoryRuleSet{} + r.GetCurrentUserCanBypass() + r = nil + r.GetCurrentUserCanBypass() +} + +func TestRepositoryRuleSet_GetLinks(tt *testing.T) { + r := &RepositoryRuleSet{} + r.GetLinks() + r = nil + r.GetLinks() +} + +func TestRepositoryRuleSet_GetNodeID(tt *testing.T) { + var zeroValue string + r := &RepositoryRuleSet{NodeID: &zeroValue} + r.GetNodeID() + r = &RepositoryRuleSet{} + r.GetNodeID() + r = nil + r.GetNodeID() +} + +func TestRepositoryRuleSet_GetSourceType(tt *testing.T) { + var zeroValue string + r := &RepositoryRuleSet{SourceType: &zeroValue} + r.GetSourceType() + r = &RepositoryRuleSet{} + r.GetSourceType() + r = nil + r.GetSourceType() +} + +func TestRepositoryRuleSet_GetTarget(tt *testing.T) { + var zeroValue string + r := &RepositoryRuleSet{Target: &zeroValue} + r.GetTarget() + r = &RepositoryRuleSet{} + r.GetTarget() + r = nil + r.GetTarget() +} + +func TestRepositoryRuleSet_GetUpdatedAt(tt *testing.T) { + var zeroValue Timestamp + r := &RepositoryRuleSet{UpdatedAt: &zeroValue} + r.GetUpdatedAt() + r = &RepositoryRuleSet{} + r.GetUpdatedAt() + r = nil + r.GetUpdatedAt() +} + +func TestRepositoryRuleSetCodeScanningRule_GetParameters(tt *testing.T) { + r := &RepositoryRuleSetCodeScanningRule{} + r.GetParameters() + r = nil + r.GetParameters() +} + +func TestRepositoryRuleSetEditedChanges_GetConditions(tt *testing.T) { + r := &RepositoryRuleSetEditedChanges{} + r.GetConditions() + r = nil + r.GetConditions() +} + +func TestRepositoryRuleSetEditedChanges_GetEnforcement(tt *testing.T) { + r := &RepositoryRuleSetEditedChanges{} + r.GetEnforcement() + r = nil + r.GetEnforcement() +} + +func TestRepositoryRuleSetEditedChanges_GetName(tt *testing.T) { + r := &RepositoryRuleSetEditedChanges{} + r.GetName() + r = nil + r.GetName() +} + +func TestRepositoryRuleSetEditedChanges_GetRules(tt *testing.T) { + r := &RepositoryRuleSetEditedChanges{} + r.GetRules() + r = nil + r.GetRules() +} + +func TestRepositoryRuleSetEditedRuleChanges_GetConfiguration(tt *testing.T) { + r := &RepositoryRuleSetEditedRuleChanges{} + r.GetConfiguration() + r = nil + r.GetConfiguration() +} + +func TestRepositoryRuleSetEditedRuleChanges_GetPattern(tt *testing.T) { + r := &RepositoryRuleSetEditedRuleChanges{} + r.GetPattern() + r = nil + r.GetPattern() +} + +func TestRepositoryRuleSetEditedRuleChanges_GetRuleType(tt *testing.T) { + r := &RepositoryRuleSetEditedRuleChanges{} + r.GetRuleType() + r = nil + r.GetRuleType() +} + +func TestRepositoryRuleSetEditedSource_GetFrom(tt *testing.T) { + var zeroValue string + r := &RepositoryRuleSetEditedSource{From: &zeroValue} + r.GetFrom() + r = &RepositoryRuleSetEditedSource{} + r.GetFrom() + r = nil + r.GetFrom() +} + +func TestRepositoryRuleSetEditedUpdatedConditions_GetChanges(tt *testing.T) { + r := &RepositoryRuleSetEditedUpdatedConditions{} + r.GetChanges() + r = nil + r.GetChanges() +} + +func TestRepositoryRuleSetEditedUpdatedConditions_GetCondition(tt *testing.T) { + r := &RepositoryRuleSetEditedUpdatedConditions{} + r.GetCondition() + r = nil + r.GetCondition() +} + +func TestRepositoryRuleSetEvent_GetAction(tt *testing.T) { + var zeroValue string + r := &RepositoryRuleSetEvent{Action: &zeroValue} + r.GetAction() + r = &RepositoryRuleSetEvent{} + r.GetAction() + r = nil + r.GetAction() +} + +func TestRepositoryRuleSetEvent_GetChanges(tt *testing.T) { + r := &RepositoryRuleSetEvent{} + r.GetChanges() + r = nil + r.GetChanges() +} + +func TestRepositoryRuleSetEvent_GetEnterprise(tt *testing.T) { + r := &RepositoryRuleSetEvent{} + r.GetEnterprise() + r = nil + r.GetEnterprise() +} + +func TestRepositoryRuleSetEvent_GetInstallation(tt *testing.T) { + r := &RepositoryRuleSetEvent{} + r.GetInstallation() + r = nil + r.GetInstallation() +} + +func TestRepositoryRuleSetEvent_GetOrganization(tt *testing.T) { + r := &RepositoryRuleSetEvent{} + r.GetOrganization() + r = nil + r.GetOrganization() +} + +func TestRepositoryRuleSetEvent_GetRepository(tt *testing.T) { + r := &RepositoryRuleSetEvent{} + r.GetRepository() + r = nil + r.GetRepository() +} + +func TestRepositoryRuleSetEvent_GetRepositoryRuleSet(tt *testing.T) { + r := &RepositoryRuleSetEvent{} + r.GetRepositoryRuleSet() + r = nil + r.GetRepositoryRuleSet() +} + +func TestRepositoryRuleSetEvent_GetSender(tt *testing.T) { + r := &RepositoryRuleSetEvent{} + r.GetSender() + r = nil + r.GetSender() +} + +func TestRepositoryRuleSetFileExtensionRestrictionRule_GetParameters(tt *testing.T) { + r := &RepositoryRuleSetFileExtensionRestrictionRule{} + r.GetParameters() + r = nil + r.GetParameters() +} + +func TestRepositoryRuleSetFilePathRestrictionRule_GetParameters(tt *testing.T) { + r := &RepositoryRuleSetFilePathRestrictionRule{} + r.GetParameters() + r = nil + r.GetParameters() +} + +func TestRepositoryRuleSetLink_GetHTML(tt *testing.T) { + r := &RepositoryRuleSetLink{} + r.GetHTML() + r = nil + r.GetHTML() +} + +func TestRepositoryRuleSetLink_GetSelf(tt *testing.T) { + r := &RepositoryRuleSetLink{} + r.GetSelf() + r = nil + r.GetSelf() +} + +func TestRepositoryRuleSetMaxFilePathLengthRule_GetParameters(tt *testing.T) { + r := &RepositoryRuleSetMaxFilePathLengthRule{} + r.GetParameters() + r = nil + r.GetParameters() +} + +func TestRepositoryRuleSetMaxFileSizeRule_GetParameters(tt *testing.T) { + r := &RepositoryRuleSetMaxFileSizeRule{} + r.GetParameters() + r = nil + r.GetParameters() +} + +func TestRepositoryRuleSetMergeQueueRule_GetParameters(tt *testing.T) { + r := &RepositoryRuleSetMergeQueueRule{} + r.GetParameters() + r = nil + r.GetParameters() +} + +func TestRepositoryRuleSetPatternRule_GetParameters(tt *testing.T) { + r := &RepositoryRuleSetPatternRule{} + r.GetParameters() + r = nil + r.GetParameters() +} + +func TestRepositoryRuleSetPullRequestRule_GetParameters(tt *testing.T) { + r := &RepositoryRuleSetPullRequestRule{} + r.GetParameters() + r = nil + r.GetParameters() +} + +func TestRepositoryRuleSetRefCondition_GetRefName(tt *testing.T) { + r := &RepositoryRuleSetRefCondition{} + r.GetRefName() + r = nil + r.GetRefName() +} + +func TestRepositoryRuleSetRequireDeploymentsRule_GetParameters(tt *testing.T) { + r := &RepositoryRuleSetRequireDeploymentsRule{} + r.GetParameters() + r = nil + r.GetParameters() +} + +func TestRepositoryRuleSetRequiredStatusChecksRule_GetParameters(tt *testing.T) { + r := &RepositoryRuleSetRequiredStatusChecksRule{} + r.GetParameters() + r = nil + r.GetParameters() +} + +func TestRepositoryRuleSetRule_GetBranchNamePattern(tt *testing.T) { + r := &RepositoryRuleSetRule{} + r.GetBranchNamePattern() + r = nil + r.GetBranchNamePattern() +} + +func TestRepositoryRuleSetRule_GetCodeScanning(tt *testing.T) { + r := &RepositoryRuleSetRule{} + r.GetCodeScanning() + r = nil + r.GetCodeScanning() +} + +func TestRepositoryRuleSetRule_GetCommitAuthorEmailPattern(tt *testing.T) { + r := &RepositoryRuleSetRule{} + r.GetCommitAuthorEmailPattern() + r = nil + r.GetCommitAuthorEmailPattern() +} + +func TestRepositoryRuleSetRule_GetCommitMessagePattern(tt *testing.T) { + r := &RepositoryRuleSetRule{} + r.GetCommitMessagePattern() + r = nil + r.GetCommitMessagePattern() +} + +func TestRepositoryRuleSetRule_GetCommitterEmailPattern(tt *testing.T) { + r := &RepositoryRuleSetRule{} + r.GetCommitterEmailPattern() + r = nil + r.GetCommitterEmailPattern() +} + +func TestRepositoryRuleSetRule_GetCreation(tt *testing.T) { + r := &RepositoryRuleSetRule{} + r.GetCreation() + r = nil + r.GetCreation() +} + +func TestRepositoryRuleSetRule_GetDeletion(tt *testing.T) { + r := &RepositoryRuleSetRule{} + r.GetDeletion() + r = nil + r.GetDeletion() +} + +func TestRepositoryRuleSetRule_GetFileExtensionRestriction(tt *testing.T) { + r := &RepositoryRuleSetRule{} + r.GetFileExtensionRestriction() + r = nil + r.GetFileExtensionRestriction() +} + +func TestRepositoryRuleSetRule_GetFilePathRestriction(tt *testing.T) { + r := &RepositoryRuleSetRule{} + r.GetFilePathRestriction() + r = nil + r.GetFilePathRestriction() +} + +func TestRepositoryRuleSetRule_GetMaxFilePathLength(tt *testing.T) { + r := &RepositoryRuleSetRule{} + r.GetMaxFilePathLength() + r = nil + r.GetMaxFilePathLength() +} + +func TestRepositoryRuleSetRule_GetMaxFileSize(tt *testing.T) { + r := &RepositoryRuleSetRule{} + r.GetMaxFileSize() + r = nil + r.GetMaxFileSize() +} + +func TestRepositoryRuleSetRule_GetMergeQueue(tt *testing.T) { + r := &RepositoryRuleSetRule{} + r.GetMergeQueue() + r = nil + r.GetMergeQueue() +} + +func TestRepositoryRuleSetRule_GetNonFastForward(tt *testing.T) { + r := &RepositoryRuleSetRule{} + r.GetNonFastForward() + r = nil + r.GetNonFastForward() +} + +func TestRepositoryRuleSetRule_GetPullRequest(tt *testing.T) { + r := &RepositoryRuleSetRule{} + r.GetPullRequest() + r = nil + r.GetPullRequest() +} + +func TestRepositoryRuleSetRule_GetRequireDeployments(tt *testing.T) { + r := &RepositoryRuleSetRule{} + r.GetRequireDeployments() + r = nil + r.GetRequireDeployments() +} + +func TestRepositoryRuleSetRule_GetRequiredSignatures(tt *testing.T) { + r := &RepositoryRuleSetRule{} + r.GetRequiredSignatures() + r = nil + r.GetRequiredSignatures() +} + +func TestRepositoryRuleSetRule_GetRequiredStatusChecks(tt *testing.T) { + r := &RepositoryRuleSetRule{} + r.GetRequiredStatusChecks() + r = nil + r.GetRequiredStatusChecks() +} + +func TestRepositoryRuleSetRule_GetRequireLinearHistory(tt *testing.T) { + r := &RepositoryRuleSetRule{} + r.GetRequireLinearHistory() + r = nil + r.GetRequireLinearHistory() +} + +func TestRepositoryRuleSetRule_GetTagNamePattern(tt *testing.T) { + r := &RepositoryRuleSetRule{} + r.GetTagNamePattern() + r = nil + r.GetTagNamePattern() +} + +func TestRepositoryRuleSetRule_GetUpdate(tt *testing.T) { + r := &RepositoryRuleSetRule{} + r.GetUpdate() + r = nil + r.GetUpdate() +} + +func TestRepositoryRuleSetRule_GetWorkflows(tt *testing.T) { + r := &RepositoryRuleSetRule{} + r.GetWorkflows() + r = nil + r.GetWorkflows() +} + +func TestRepositoryRuleSetUpdatedConditionsEdited_GetConditionType(tt *testing.T) { + r := &RepositoryRuleSetUpdatedConditionsEdited{} + r.GetConditionType() + r = nil + r.GetConditionType() +} + +func TestRepositoryRuleSetUpdatedConditionsEdited_GetExclude(tt *testing.T) { + r := &RepositoryRuleSetUpdatedConditionsEdited{} + r.GetExclude() + r = nil + r.GetExclude() +} + +func TestRepositoryRuleSetUpdatedConditionsEdited_GetInclude(tt *testing.T) { + r := &RepositoryRuleSetUpdatedConditionsEdited{} + r.GetInclude() + r = nil + r.GetInclude() +} + +func TestRepositoryRuleSetUpdatedConditionsEdited_GetTarget(tt *testing.T) { + r := &RepositoryRuleSetUpdatedConditionsEdited{} + r.GetTarget() + r = nil + r.GetTarget() +} + +func TestRepositoryRuleSetUpdatedRules_GetChanges(tt *testing.T) { + r := &RepositoryRuleSetUpdatedRules{} + r.GetChanges() + r = nil + r.GetChanges() +} + +func TestRepositoryRuleSetUpdatedRules_GetRule(tt *testing.T) { + r := &RepositoryRuleSetUpdatedRules{} + r.GetRule() + r = nil + r.GetRule() +} + +func TestRepositoryRuleSetUpdateRule_GetParameters(tt *testing.T) { + r := &RepositoryRuleSetUpdateRule{} + r.GetParameters() + r = nil + r.GetParameters() +} + +func TestRepositoryRuleSetWorkflowsRule_GetParameters(tt *testing.T) { + r := &RepositoryRuleSetWorkflowsRule{} + r.GetParameters() + r = nil + r.GetParameters() +} + func TestRepositoryTag_GetCommit(tt *testing.T) { r := &RepositoryTag{} r.GetCommit() @@ -24389,6 +24892,16 @@ func TestRequiredStatusChecksRequest_GetStrict(tt *testing.T) { r.GetStrict() } +func TestRequiredStatusChecksRuleParameters_GetDoNotEnforceOnCreate(tt *testing.T) { + var zeroValue bool + r := &RequiredStatusChecksRuleParameters{DoNotEnforceOnCreate: &zeroValue} + r.GetDoNotEnforceOnCreate() + r = &RequiredStatusChecksRuleParameters{} + r.GetDoNotEnforceOnCreate() + r = nil + r.GetDoNotEnforceOnCreate() +} + func TestRequiredWorkflowSelectedRepos_GetTotalCount(tt *testing.T) { var zeroValue int r := &RequiredWorkflowSelectedRepos{TotalCount: &zeroValue} diff --git a/github/messages.go b/github/messages.go index 30c4fca9304..197234c866e 100644 --- a/github/messages.go +++ b/github/messages.go @@ -98,6 +98,7 @@ var ( "repository": &RepositoryEvent{}, "repository_dispatch": &RepositoryDispatchEvent{}, "repository_import": &RepositoryImportEvent{}, + "repository_ruleset": &RepositoryRuleSetEvent{}, "repository_vulnerability_alert": &RepositoryVulnerabilityAlertEvent{}, "release": &ReleaseEvent{}, "secret_scanning_alert": &SecretScanningAlertEvent{}, diff --git a/github/messages_test.go b/github/messages_test.go index 322505f65c6..2f7e4460e7e 100644 --- a/github/messages_test.go +++ b/github/messages_test.go @@ -456,6 +456,10 @@ func TestParseWebHook(t *testing.T) { payload: &RepositoryEvent{}, messageType: "repository", }, + { + payload: &RepositoryRuleSetEvent{}, + messageType: "repository_ruleset", + }, { payload: &RepositoryVulnerabilityAlertEvent{}, messageType: "repository_vulnerability_alert", diff --git a/github/repos_rules.go b/github/repos_rules.go index 192b5e56b0b..8b14c40558a 100644 --- a/github/repos_rules.go +++ b/github/repos_rules.go @@ -267,7 +267,7 @@ type RepositoryRuleSetRule struct { } type RepositoryRuleSetLink struct { Self *RulesetLink `json:"self,omitempty"` - Html *RulesetLink `json:"html,omitempty"` + HTML *RulesetLink `json:"html,omitempty"` } type RepositoryRuleSetRuleType struct { @@ -281,21 +281,27 @@ type RepositoryRuleSetUpdateRule struct { } type RepositoryRuleSetMergeQueueRule struct { + //Value for Type: "merge_queue" Type string `json:"type"` Parameters *MergeQueueRuleParameters `json:"parameters,omitempty"` } type RepositoryRuleSetRequireDeploymentsRule struct { + //Value for Type: "required_deployments" Type string `json:"type"` Parameters *RequiredDeploymentEnvironmentsRuleParameters `json:"parameters,omitempty"` } type RepositoryRuleSetPullRequestRule struct { + //Value for Type: "pull_request" + Type string `json:"type"` Parameters *PullRequestRuleParameters `json:"parameters,omitempty"` } type RepositoryRuleSetRequiredStatusChecksRule struct { + //Value for Type: "required_status_checks" + Type string `json:"type"` Parameters *RequiredStatusChecksRuleParameters `json:"parameters,omitempty"` } @@ -306,31 +312,38 @@ type RepositoryRuleSetPatternRule struct { } type RepositoryRuleSetFilePathRestrictionRule struct { + //Value for Type: "file_path_restriction" Type string `json:"type"` Parameters *RuleFileParameters `json:"parameters,omitempty"` } type RepositoryRuleSetMaxFilePathLengthRule struct { + //Value for Type: "max_file_path_length" + Type string `json:"type"` Parameters *RuleMaxFilePathLengthParameters `json:"parameters,omitempty"` } type RepositoryRuleSetFileExtensionRestrictionRule struct { + //Value for Type: "file_extension_restriction" Type string `json:"type"` Parameters *RuleFileExtensionRestrictionParameters `json:"parameters,omitempty"` } type RepositoryRuleSetMaxFileSizeRule struct { + //Value for Type: "max_file_size" Type string `json:"type"` Parameters *RuleMaxFileSizeParameters `json:"parameters,omitempty"` } type RepositoryRuleSetWorkflowsRule struct { + //Value for Type: "workflows" Type string `json:"type"` Parameters *RequiredWorkflowsRuleParameters `json:"parameters,omitempty"` } type RepositoryRuleSetCodeScanningRule struct { + //Value for Type:"code_scanning" Type string `json:"type"` Parameters *RuleCodeScanningParameters `json:"parameters,omitempty"` } diff --git a/github/repos_rules_test.go b/github/repos_rules_test.go index 0c4c4072069..9ab8026a7c8 100644 --- a/github/repos_rules_test.go +++ b/github/repos_rules_test.go @@ -268,7 +268,7 @@ func TestRepositoryRule_UnmarshalJSON(t *testing.T) { "Valid required_status_checks params": { data: `{"type":"required_status_checks","parameters":{"required_status_checks":[{"context":"test","integration_id":1}],"strict_required_status_checks_policy":true,"do_not_enforce_on_create":true}}`, want: NewRequiredStatusChecksRule(&RequiredStatusChecksRuleParameters{ - DoNotEnforceOnCreate: true, + DoNotEnforceOnCreate: Bool(true), RequiredStatusChecks: []RuleRequiredStatusChecks{ { Context: "test", From e63118c13383d84ed40b73d0a6b5db1c8a7980a3 Mon Sep 17 00:00:00 2001 From: Udit Date: Fri, 4 Oct 2024 20:51:48 +0530 Subject: [PATCH 04/42] improved comment for documentation; replaced with as given in github docs --- github/event_types.go | 10 +- github/event_types_test.go | 224 ++++++++++++------------ github/github-accessors.go | 140 +++++++-------- github/github-accessors_test.go | 294 ++++++++++++++++---------------- github/messages.go | 2 +- github/messages_test.go | 2 +- github/repos_rules.go | 142 +++++++-------- 7 files changed, 407 insertions(+), 407 deletions(-) diff --git a/github/event_types.go b/github/event_types.go index 018904dbbab..be8008dacab 100644 --- a/github/event_types.go +++ b/github/event_types.go @@ -1505,17 +1505,17 @@ type RepositoryImportEvent struct { Sender *User `json:"sender,omitempty"` } -// RepositoryRuleSetEvent event occurs when there is activity relating to repository rulesets -// +// RepositoryRulesetEvent triggers whenever there is a change to the repository's ruleset configuration. +// This can include updates to protection rules, required status checks, code owners, or other related configurations. // GitHub API docs: https://docs.github.com/en/webhooks/webhook-events-and-payloads#repository_ruleset -type RepositoryRuleSetEvent struct { +type RepositoryRulesetEvent struct { Action *string `json:"action,omitempty"` Enterprise *Enterprise `json:"enterprise,omitempty"` Installation *Installation `json:"installation,omitempty"` Organization *Organization `json:"organization,omitempty"` Repository *Repository `json:"repository,omitempty"` - RepositoryRuleSet *RepositoryRuleSet `json:"repository_ruleset"` - Changes *RepositoryRuleSetEditedChanges `json:"changes,omitempty"` + RepositoryRuleset *RepositoryRuleset `json:"repository_ruleset"` + Changes *RepositoryRulesetEditedChanges `json:"changes,omitempty"` Sender *User `json:"sender"` } diff --git a/github/event_types_test.go b/github/event_types_test.go index 107f9d8c36e..7e0dd4743d5 100644 --- a/github/event_types_test.go +++ b/github/event_types_test.go @@ -9448,15 +9448,15 @@ func TestReleaseEvent_Marshal(t *testing.T) { testJSONMarshal(t, u, want) } -func TestRepositoryRuleSetEvent_Marshal(t *testing.T) { - testJSONMarshal(t, &RepositoryRuleSetEvent{}, "{}") +func TestRepositoryRulesetEvent_Marshal(t *testing.T) { + testJSONMarshal(t, &RepositoryRulesetEvent{}, "{}") l := make(map[string]interface{}) l["key"] = "value" jsonMsg, _ := json.Marshal(&l) - u := &RepositoryRuleSetEvent{ + u := &RepositoryRulesetEvent{ Action: String("a"), Enterprise: &Enterprise{ ID: Int(1), @@ -9590,7 +9590,7 @@ func TestRepositoryRuleSetEvent_Marshal(t *testing.T) { URL: String("u"), Name: String("n"), }, - RepositoryRuleSet: &RepositoryRuleSet{ + RepositoryRuleset: &RepositoryRuleset{ ID: 1, Name: "n", Target: String("branch"), @@ -9606,7 +9606,7 @@ func TestRepositoryRuleSetEvent_Marshal(t *testing.T) { }, CurrentUserCanBypass: String("always"), NodeID: String("n"), - Links: &RepositoryRuleSetLink{ + Links: &RepositoryRulesetLink{ Self: &RulesetLink{ HRef: String("href"), }, @@ -9615,24 +9615,24 @@ func TestRepositoryRuleSetEvent_Marshal(t *testing.T) { }, }, Conditions: (*json.RawMessage)(&jsonMsg), - Rules: []*RepositoryRuleSetRule{ + Rules: []*RepositoryRulesetRule{ { - Creation: &RepositoryRuleSetRuleType{ + Creation: &RepositoryRulesetRuleType{ Type: "creation", }, - Update: &RepositoryRuleSetUpdateRule{ + Update: &RepositoryRulesetUpdateRule{ Type: "update", Parameters: &UpdateAllowsFetchAndMergeRuleParameters{ UpdateAllowsFetchAndMerge: true, }, }, - Deletion: &RepositoryRuleSetRuleType{ + Deletion: &RepositoryRulesetRuleType{ Type: "deletion", }, - RequireLinearHistory: &RepositoryRuleSetRuleType{ + RequireLinearHistory: &RepositoryRulesetRuleType{ Type: "require_linear_history", }, - MergeQueue: &RepositoryRuleSetMergeQueueRule{ + MergeQueue: &RepositoryRulesetMergeQueueRule{ Type: "merge_queue", Parameters: &MergeQueueRuleParameters{ CheckResponseTimeoutMinutes: 35, @@ -9644,16 +9644,16 @@ func TestRepositoryRuleSetEvent_Marshal(t *testing.T) { MinEntriesToMergeWaitMinutes: 13, }, }, - RequireDeployments: &RepositoryRuleSetRequireDeploymentsRule{ + RequireDeployments: &RepositoryRulesetRequireDeploymentsRule{ Type: "required_deployments", Parameters: &RequiredDeploymentEnvironmentsRuleParameters{ RequiredDeploymentEnvironments: []string{"test"}, }, }, - RequiredSignatures: &RepositoryRuleSetRuleType{ + RequiredSignatures: &RepositoryRulesetRuleType{ Type: "required_signatures", }, - PullRequest: &RepositoryRuleSetPullRequestRule{ + PullRequest: &RepositoryRulesetPullRequestRule{ Type: "pull_request", Parameters: &PullRequestRuleParameters{ RequireCodeOwnerReview: true, @@ -9663,7 +9663,7 @@ func TestRepositoryRuleSetEvent_Marshal(t *testing.T) { DismissStaleReviewsOnPush: true, }, }, - RequiredStatusChecks: &RepositoryRuleSetRequiredStatusChecksRule{ + RequiredStatusChecks: &RepositoryRulesetRequiredStatusChecksRule{ Type: "required_status_checks", Parameters: &RequiredStatusChecksRuleParameters{ RequiredStatusChecks: []RuleRequiredStatusChecks{ @@ -9675,10 +9675,10 @@ func TestRepositoryRuleSetEvent_Marshal(t *testing.T) { StrictRequiredStatusChecksPolicy: true, }, }, - NonFastForward: &RepositoryRuleSetRuleType{ + NonFastForward: &RepositoryRulesetRuleType{ Type: "non_fast_forward", }, - CommitMessagePattern: &RepositoryRuleSetPatternRule{ + CommitMessagePattern: &RepositoryRulesetPatternRule{ Type: "commit_message_pattern", Parameters: &RulePatternParameters{ Name: String("avoid test commits"), @@ -9687,14 +9687,14 @@ func TestRepositoryRuleSetEvent_Marshal(t *testing.T) { Pattern: "[test]", }, }, - CommitAuthorEmailPattern: &RepositoryRuleSetPatternRule{ + CommitAuthorEmailPattern: &RepositoryRulesetPatternRule{ Type: "commit_author_email_pattern", Parameters: &RulePatternParameters{ Operator: "contains", Pattern: "github", }, }, - CommitterEmailPattern: &RepositoryRuleSetPatternRule{ + CommitterEmailPattern: &RepositoryRulesetPatternRule{ Type: "committer_email_pattern", Parameters: &RulePatternParameters{ Name: String("avoid commit emails"), @@ -9703,7 +9703,7 @@ func TestRepositoryRuleSetEvent_Marshal(t *testing.T) { Pattern: "abc", }, }, - BranchNamePattern: &RepositoryRuleSetPatternRule{ + BranchNamePattern: &RepositoryRulesetPatternRule{ Type: "branch_name_pattern", Parameters: &RulePatternParameters{ Name: String("avoid branch names"), @@ -9712,7 +9712,7 @@ func TestRepositoryRuleSetEvent_Marshal(t *testing.T) { Pattern: "github$", }, }, - TagNamePattern: &RepositoryRuleSetPatternRule{ + TagNamePattern: &RepositoryRulesetPatternRule{ Type: "tag_name_pattern", Parameters: &RulePatternParameters{ Name: String("avoid tag names"), @@ -9721,31 +9721,31 @@ func TestRepositoryRuleSetEvent_Marshal(t *testing.T) { Pattern: "github", }, }, - FilePathRestriction: &RepositoryRuleSetFilePathRestrictionRule{ + FilePathRestriction: &RepositoryRulesetFilePathRestrictionRule{ Type: "file_path_restriction", Parameters: &RuleFileParameters{ RestrictedFilePaths: &[]string{"/a/file"}, }, }, - MaxFilePathLength: &RepositoryRuleSetMaxFilePathLengthRule{ + MaxFilePathLength: &RepositoryRulesetMaxFilePathLengthRule{ Type: "max_file_path_length", Parameters: &RuleMaxFilePathLengthParameters{ MaxFilePathLength: 255, }, }, - FileExtensionRestriction: &RepositoryRuleSetFileExtensionRestrictionRule{ + FileExtensionRestriction: &RepositoryRulesetFileExtensionRestrictionRule{ Type: "file_extension_restriction", Parameters: &RuleFileExtensionRestrictionParameters{ RestrictedFileExtensions: []string{".exe"}, }, }, - MaxFileSize: &RepositoryRuleSetMaxFileSizeRule{ + MaxFileSize: &RepositoryRulesetMaxFileSizeRule{ Type: "max_file_size", Parameters: &RuleMaxFileSizeParameters{ MaxFileSize: 1024, }, }, - Workflows: &RepositoryRuleSetWorkflowsRule{ + Workflows: &RepositoryRulesetWorkflowsRule{ Type: "workflows", Parameters: &RequiredWorkflowsRuleParameters{ RequiredWorkflows: []*RuleRequiredWorkflow{ @@ -9756,7 +9756,7 @@ func TestRepositoryRuleSetEvent_Marshal(t *testing.T) { }, }, }, - CodeScanning: &RepositoryRuleSetCodeScanningRule{ + CodeScanning: &RepositoryRulesetCodeScanningRule{ Type: "code_scanning", Parameters: &RuleCodeScanningParameters{ CodeScanningTools: []CodeScanningTool{{ @@ -9771,15 +9771,15 @@ func TestRepositoryRuleSetEvent_Marshal(t *testing.T) { CreatedAt: &Timestamp{referenceTime}, UpdatedAt: &Timestamp{referenceTime}, }, - Changes: &RepositoryRuleSetEditedChanges{ - Name: &RepositoryRuleSetEditedSource{ + Changes: &RepositoryRulesetEditedChanges{ + Name: &RepositoryRulesetEditedSource{ From: String("f"), }, - Enforcement: &RepositoryRuleSetEditedSource{ + Enforcement: &RepositoryRulesetEditedSource{ From: String("e"), }, - Conditions: &RepositoryRuleSetEditedConditions{ - Added: []*RepositoryRuleSetRefCondition{ + Conditions: &RepositoryRulesetEditedConditions{ + Added: []*RepositoryRulesetRefCondition{ { RefName: &RulesetRefConditionParameters{ Include: []string{"refs/heads/main", "refs/heads/master"}, @@ -9787,7 +9787,7 @@ func TestRepositoryRuleSetEvent_Marshal(t *testing.T) { }, }, }, - Deleted: []*RepositoryRuleSetRefCondition{ + Deleted: []*RepositoryRulesetRefCondition{ { RefName: &RulesetRefConditionParameters{ Include: []string{"refs/heads/main", "refs/heads/master"}, @@ -9795,51 +9795,51 @@ func TestRepositoryRuleSetEvent_Marshal(t *testing.T) { }, }, }, - Updated: []*RepositoryRuleSetEditedUpdatedConditions{ + Updated: []*RepositoryRulesetEditedUpdatedConditions{ { - Condition: &RepositoryRuleSetRefCondition{ + Condition: &RepositoryRulesetRefCondition{ RefName: &RulesetRefConditionParameters{ Include: []string{"refs/heads/main", "refs/heads/master"}, Exclude: []string{"refs/heads/dev*"}, }, }, - Changes: &RepositoryRuleSetUpdatedConditionsEdited{ - ConditionType: &RepositoryRuleSetEditedSource{ + Changes: &RepositoryRulesetUpdatedConditionsEdited{ + ConditionType: &RepositoryRulesetEditedSource{ From: String("c"), }, - Target: &RepositoryRuleSetEditedSource{ + Target: &RepositoryRulesetEditedSource{ From: String("t"), }, - Include: &RepositoryRuleSetEditedSources{ + Include: &RepositoryRulesetEditedSources{ From: []*string{String("from")}, }, - Exclude: &RepositoryRuleSetEditedSources{ + Exclude: &RepositoryRulesetEditedSources{ From: []*string{String("to")}, }, }, }, }, }, - Rules: &RepositoryRuleSetEditedRules{ - Added: []*RepositoryRuleSetRule{ + Rules: &RepositoryRulesetEditedRules{ + Added: []*RepositoryRulesetRule{ //Creating just one object with all the possible rules for testing { - Creation: &RepositoryRuleSetRuleType{ + Creation: &RepositoryRulesetRuleType{ Type: "creation", }, - Update: &RepositoryRuleSetUpdateRule{ + Update: &RepositoryRulesetUpdateRule{ Type: "update", Parameters: &UpdateAllowsFetchAndMergeRuleParameters{ UpdateAllowsFetchAndMerge: true, }, }, - Deletion: &RepositoryRuleSetRuleType{ + Deletion: &RepositoryRulesetRuleType{ Type: "deletion", }, - RequireLinearHistory: &RepositoryRuleSetRuleType{ + RequireLinearHistory: &RepositoryRulesetRuleType{ Type: "require_linear_history", }, - MergeQueue: &RepositoryRuleSetMergeQueueRule{ + MergeQueue: &RepositoryRulesetMergeQueueRule{ Type: "merge_queue", Parameters: &MergeQueueRuleParameters{ CheckResponseTimeoutMinutes: 35, @@ -9851,16 +9851,16 @@ func TestRepositoryRuleSetEvent_Marshal(t *testing.T) { MinEntriesToMergeWaitMinutes: 13, }, }, - RequireDeployments: &RepositoryRuleSetRequireDeploymentsRule{ + RequireDeployments: &RepositoryRulesetRequireDeploymentsRule{ Type: "required_deployments", Parameters: &RequiredDeploymentEnvironmentsRuleParameters{ RequiredDeploymentEnvironments: []string{"test"}, }, }, - RequiredSignatures: &RepositoryRuleSetRuleType{ + RequiredSignatures: &RepositoryRulesetRuleType{ Type: "required_signatures", }, - PullRequest: &RepositoryRuleSetPullRequestRule{ + PullRequest: &RepositoryRulesetPullRequestRule{ Type: "pull_request", Parameters: &PullRequestRuleParameters{ RequireCodeOwnerReview: true, @@ -9870,7 +9870,7 @@ func TestRepositoryRuleSetEvent_Marshal(t *testing.T) { DismissStaleReviewsOnPush: true, }, }, - RequiredStatusChecks: &RepositoryRuleSetRequiredStatusChecksRule{ + RequiredStatusChecks: &RepositoryRulesetRequiredStatusChecksRule{ Type: "required_status_checks", Parameters: &RequiredStatusChecksRuleParameters{ RequiredStatusChecks: []RuleRequiredStatusChecks{ @@ -9882,10 +9882,10 @@ func TestRepositoryRuleSetEvent_Marshal(t *testing.T) { StrictRequiredStatusChecksPolicy: true, }, }, - NonFastForward: &RepositoryRuleSetRuleType{ + NonFastForward: &RepositoryRulesetRuleType{ Type: "non_fast_forward", }, - CommitMessagePattern: &RepositoryRuleSetPatternRule{ + CommitMessagePattern: &RepositoryRulesetPatternRule{ Type: "commit_message_pattern", Parameters: &RulePatternParameters{ Name: String("avoid test commits"), @@ -9894,14 +9894,14 @@ func TestRepositoryRuleSetEvent_Marshal(t *testing.T) { Pattern: "[test]", }, }, - CommitAuthorEmailPattern: &RepositoryRuleSetPatternRule{ + CommitAuthorEmailPattern: &RepositoryRulesetPatternRule{ Type: "commit_author_email_pattern", Parameters: &RulePatternParameters{ Operator: "contains", Pattern: "github", }, }, - CommitterEmailPattern: &RepositoryRuleSetPatternRule{ + CommitterEmailPattern: &RepositoryRulesetPatternRule{ Type: "committer_email_pattern", Parameters: &RulePatternParameters{ Name: String("avoid commit emails"), @@ -9910,7 +9910,7 @@ func TestRepositoryRuleSetEvent_Marshal(t *testing.T) { Pattern: "abc", }, }, - BranchNamePattern: &RepositoryRuleSetPatternRule{ + BranchNamePattern: &RepositoryRulesetPatternRule{ Type: "branch_name_pattern", Parameters: &RulePatternParameters{ Name: String("avoid branch names"), @@ -9919,7 +9919,7 @@ func TestRepositoryRuleSetEvent_Marshal(t *testing.T) { Pattern: "github$", }, }, - TagNamePattern: &RepositoryRuleSetPatternRule{ + TagNamePattern: &RepositoryRulesetPatternRule{ Type: "tag_name_pattern", Parameters: &RulePatternParameters{ Name: String("avoid tag names"), @@ -9928,31 +9928,31 @@ func TestRepositoryRuleSetEvent_Marshal(t *testing.T) { Pattern: "github", }, }, - FilePathRestriction: &RepositoryRuleSetFilePathRestrictionRule{ + FilePathRestriction: &RepositoryRulesetFilePathRestrictionRule{ Type: "file_path_restriction", Parameters: &RuleFileParameters{ RestrictedFilePaths: &[]string{"/a/file"}, }, }, - MaxFilePathLength: &RepositoryRuleSetMaxFilePathLengthRule{ + MaxFilePathLength: &RepositoryRulesetMaxFilePathLengthRule{ Type: "max_file_path_length", Parameters: &RuleMaxFilePathLengthParameters{ MaxFilePathLength: 255, }, }, - FileExtensionRestriction: &RepositoryRuleSetFileExtensionRestrictionRule{ + FileExtensionRestriction: &RepositoryRulesetFileExtensionRestrictionRule{ Type: "file_extension_restriction", Parameters: &RuleFileExtensionRestrictionParameters{ RestrictedFileExtensions: []string{".exe"}, }, }, - MaxFileSize: &RepositoryRuleSetMaxFileSizeRule{ + MaxFileSize: &RepositoryRulesetMaxFileSizeRule{ Type: "max_file_size", Parameters: &RuleMaxFileSizeParameters{ MaxFileSize: 1024, }, }, - Workflows: &RepositoryRuleSetWorkflowsRule{ + Workflows: &RepositoryRulesetWorkflowsRule{ Type: "workflows", Parameters: &RequiredWorkflowsRuleParameters{ RequiredWorkflows: []*RuleRequiredWorkflow{ @@ -9963,7 +9963,7 @@ func TestRepositoryRuleSetEvent_Marshal(t *testing.T) { }, }, }, - CodeScanning: &RepositoryRuleSetCodeScanningRule{ + CodeScanning: &RepositoryRulesetCodeScanningRule{ Type: "code_scanning", Parameters: &RuleCodeScanningParameters{ CodeScanningTools: []CodeScanningTool{{ @@ -9975,25 +9975,25 @@ func TestRepositoryRuleSetEvent_Marshal(t *testing.T) { }, }, }, - Deleted: []*RepositoryRuleSetRule{ + Deleted: []*RepositoryRulesetRule{ //Creating just one object with all the possible rules for testing { - Creation: &RepositoryRuleSetRuleType{ + Creation: &RepositoryRulesetRuleType{ Type: "creation", }, - Update: &RepositoryRuleSetUpdateRule{ + Update: &RepositoryRulesetUpdateRule{ Type: "update", Parameters: &UpdateAllowsFetchAndMergeRuleParameters{ UpdateAllowsFetchAndMerge: true, }, }, - Deletion: &RepositoryRuleSetRuleType{ + Deletion: &RepositoryRulesetRuleType{ Type: "deletion", }, - RequireLinearHistory: &RepositoryRuleSetRuleType{ + RequireLinearHistory: &RepositoryRulesetRuleType{ Type: "require_linear_history", }, - MergeQueue: &RepositoryRuleSetMergeQueueRule{ + MergeQueue: &RepositoryRulesetMergeQueueRule{ Type: "merge_queue", Parameters: &MergeQueueRuleParameters{ CheckResponseTimeoutMinutes: 35, @@ -10005,16 +10005,16 @@ func TestRepositoryRuleSetEvent_Marshal(t *testing.T) { MinEntriesToMergeWaitMinutes: 13, }, }, - RequireDeployments: &RepositoryRuleSetRequireDeploymentsRule{ + RequireDeployments: &RepositoryRulesetRequireDeploymentsRule{ Type: "required_deployments", Parameters: &RequiredDeploymentEnvironmentsRuleParameters{ RequiredDeploymentEnvironments: []string{"test"}, }, }, - RequiredSignatures: &RepositoryRuleSetRuleType{ + RequiredSignatures: &RepositoryRulesetRuleType{ Type: "required_signatures", }, - PullRequest: &RepositoryRuleSetPullRequestRule{ + PullRequest: &RepositoryRulesetPullRequestRule{ Type: "pull_request", Parameters: &PullRequestRuleParameters{ RequireCodeOwnerReview: true, @@ -10024,7 +10024,7 @@ func TestRepositoryRuleSetEvent_Marshal(t *testing.T) { DismissStaleReviewsOnPush: true, }, }, - RequiredStatusChecks: &RepositoryRuleSetRequiredStatusChecksRule{ + RequiredStatusChecks: &RepositoryRulesetRequiredStatusChecksRule{ Type: "required_status_checks", Parameters: &RequiredStatusChecksRuleParameters{ RequiredStatusChecks: []RuleRequiredStatusChecks{ @@ -10036,10 +10036,10 @@ func TestRepositoryRuleSetEvent_Marshal(t *testing.T) { StrictRequiredStatusChecksPolicy: true, }, }, - NonFastForward: &RepositoryRuleSetRuleType{ + NonFastForward: &RepositoryRulesetRuleType{ Type: "non_fast_forward", }, - CommitMessagePattern: &RepositoryRuleSetPatternRule{ + CommitMessagePattern: &RepositoryRulesetPatternRule{ Type: "commit_message_pattern", Parameters: &RulePatternParameters{ Name: String("avoid test commits"), @@ -10048,14 +10048,14 @@ func TestRepositoryRuleSetEvent_Marshal(t *testing.T) { Pattern: "[test]", }, }, - CommitAuthorEmailPattern: &RepositoryRuleSetPatternRule{ + CommitAuthorEmailPattern: &RepositoryRulesetPatternRule{ Type: "commit_author_email_pattern", Parameters: &RulePatternParameters{ Operator: "contains", Pattern: "github", }, }, - CommitterEmailPattern: &RepositoryRuleSetPatternRule{ + CommitterEmailPattern: &RepositoryRulesetPatternRule{ Type: "committer_email_pattern", Parameters: &RulePatternParameters{ Name: String("avoid commit emails"), @@ -10064,7 +10064,7 @@ func TestRepositoryRuleSetEvent_Marshal(t *testing.T) { Pattern: "abc", }, }, - BranchNamePattern: &RepositoryRuleSetPatternRule{ + BranchNamePattern: &RepositoryRulesetPatternRule{ Type: "branch_name_pattern", Parameters: &RulePatternParameters{ Name: String("avoid branch names"), @@ -10073,7 +10073,7 @@ func TestRepositoryRuleSetEvent_Marshal(t *testing.T) { Pattern: "github$", }, }, - TagNamePattern: &RepositoryRuleSetPatternRule{ + TagNamePattern: &RepositoryRulesetPatternRule{ Type: "tag_name_pattern", Parameters: &RulePatternParameters{ Name: String("avoid tag names"), @@ -10082,31 +10082,31 @@ func TestRepositoryRuleSetEvent_Marshal(t *testing.T) { Pattern: "github", }, }, - FilePathRestriction: &RepositoryRuleSetFilePathRestrictionRule{ + FilePathRestriction: &RepositoryRulesetFilePathRestrictionRule{ Type: "file_path_restriction", Parameters: &RuleFileParameters{ RestrictedFilePaths: &[]string{"/a/file"}, }, }, - MaxFilePathLength: &RepositoryRuleSetMaxFilePathLengthRule{ + MaxFilePathLength: &RepositoryRulesetMaxFilePathLengthRule{ Type: "max_file_path_length", Parameters: &RuleMaxFilePathLengthParameters{ MaxFilePathLength: 255, }, }, - FileExtensionRestriction: &RepositoryRuleSetFileExtensionRestrictionRule{ + FileExtensionRestriction: &RepositoryRulesetFileExtensionRestrictionRule{ Type: "file_extension_restriction", Parameters: &RuleFileExtensionRestrictionParameters{ RestrictedFileExtensions: []string{".exe"}, }, }, - MaxFileSize: &RepositoryRuleSetMaxFileSizeRule{ + MaxFileSize: &RepositoryRulesetMaxFileSizeRule{ Type: "max_file_size", Parameters: &RuleMaxFileSizeParameters{ MaxFileSize: 1024, }, }, - Workflows: &RepositoryRuleSetWorkflowsRule{ + Workflows: &RepositoryRulesetWorkflowsRule{ Type: "workflows", Parameters: &RequiredWorkflowsRuleParameters{ RequiredWorkflows: []*RuleRequiredWorkflow{ @@ -10117,7 +10117,7 @@ func TestRepositoryRuleSetEvent_Marshal(t *testing.T) { }, }, }, - CodeScanning: &RepositoryRuleSetCodeScanningRule{ + CodeScanning: &RepositoryRulesetCodeScanningRule{ Type: "code_scanning", Parameters: &RuleCodeScanningParameters{ CodeScanningTools: []CodeScanningTool{{ @@ -10129,25 +10129,25 @@ func TestRepositoryRuleSetEvent_Marshal(t *testing.T) { }, }, }, - Updated: []*RepositoryRuleSetUpdatedRules{ + Updated: []*RepositoryRulesetUpdatedRules{ { - Rule: &RepositoryRuleSetRule{ - Creation: &RepositoryRuleSetRuleType{ + Rule: &RepositoryRulesetRule{ + Creation: &RepositoryRulesetRuleType{ Type: "creation", }, - Update: &RepositoryRuleSetUpdateRule{ + Update: &RepositoryRulesetUpdateRule{ Type: "update", Parameters: &UpdateAllowsFetchAndMergeRuleParameters{ UpdateAllowsFetchAndMerge: true, }, }, - Deletion: &RepositoryRuleSetRuleType{ + Deletion: &RepositoryRulesetRuleType{ Type: "deletion", }, - RequireLinearHistory: &RepositoryRuleSetRuleType{ + RequireLinearHistory: &RepositoryRulesetRuleType{ Type: "require_linear_history", }, - MergeQueue: &RepositoryRuleSetMergeQueueRule{ + MergeQueue: &RepositoryRulesetMergeQueueRule{ Type: "merge_queue", Parameters: &MergeQueueRuleParameters{ CheckResponseTimeoutMinutes: 35, @@ -10159,16 +10159,16 @@ func TestRepositoryRuleSetEvent_Marshal(t *testing.T) { MinEntriesToMergeWaitMinutes: 13, }, }, - RequireDeployments: &RepositoryRuleSetRequireDeploymentsRule{ + RequireDeployments: &RepositoryRulesetRequireDeploymentsRule{ Type: "required_deployments", Parameters: &RequiredDeploymentEnvironmentsRuleParameters{ RequiredDeploymentEnvironments: []string{"test"}, }, }, - RequiredSignatures: &RepositoryRuleSetRuleType{ + RequiredSignatures: &RepositoryRulesetRuleType{ Type: "required_signatures", }, - PullRequest: &RepositoryRuleSetPullRequestRule{ + PullRequest: &RepositoryRulesetPullRequestRule{ Type: "pull_request", Parameters: &PullRequestRuleParameters{ RequireCodeOwnerReview: true, @@ -10178,7 +10178,7 @@ func TestRepositoryRuleSetEvent_Marshal(t *testing.T) { DismissStaleReviewsOnPush: true, }, }, - RequiredStatusChecks: &RepositoryRuleSetRequiredStatusChecksRule{ + RequiredStatusChecks: &RepositoryRulesetRequiredStatusChecksRule{ Type: "required_status_checks", Parameters: &RequiredStatusChecksRuleParameters{ RequiredStatusChecks: []RuleRequiredStatusChecks{ @@ -10190,10 +10190,10 @@ func TestRepositoryRuleSetEvent_Marshal(t *testing.T) { StrictRequiredStatusChecksPolicy: true, }, }, - NonFastForward: &RepositoryRuleSetRuleType{ + NonFastForward: &RepositoryRulesetRuleType{ Type: "non_fast_forward", }, - CommitMessagePattern: &RepositoryRuleSetPatternRule{ + CommitMessagePattern: &RepositoryRulesetPatternRule{ Type: "commit_message_pattern", Parameters: &RulePatternParameters{ Name: String("avoid test commits"), @@ -10202,14 +10202,14 @@ func TestRepositoryRuleSetEvent_Marshal(t *testing.T) { Pattern: "[test]", }, }, - CommitAuthorEmailPattern: &RepositoryRuleSetPatternRule{ + CommitAuthorEmailPattern: &RepositoryRulesetPatternRule{ Type: "commit_author_email_pattern", Parameters: &RulePatternParameters{ Operator: "contains", Pattern: "github", }, }, - CommitterEmailPattern: &RepositoryRuleSetPatternRule{ + CommitterEmailPattern: &RepositoryRulesetPatternRule{ Type: "committer_email_pattern", Parameters: &RulePatternParameters{ Name: String("avoid commit emails"), @@ -10218,7 +10218,7 @@ func TestRepositoryRuleSetEvent_Marshal(t *testing.T) { Pattern: "abc", }, }, - BranchNamePattern: &RepositoryRuleSetPatternRule{ + BranchNamePattern: &RepositoryRulesetPatternRule{ Type: "branch_name_pattern", Parameters: &RulePatternParameters{ Name: String("avoid branch names"), @@ -10227,7 +10227,7 @@ func TestRepositoryRuleSetEvent_Marshal(t *testing.T) { Pattern: "github$", }, }, - TagNamePattern: &RepositoryRuleSetPatternRule{ + TagNamePattern: &RepositoryRulesetPatternRule{ Type: "tag_name_pattern", Parameters: &RulePatternParameters{ Name: String("avoid tag names"), @@ -10236,31 +10236,31 @@ func TestRepositoryRuleSetEvent_Marshal(t *testing.T) { Pattern: "github", }, }, - FilePathRestriction: &RepositoryRuleSetFilePathRestrictionRule{ + FilePathRestriction: &RepositoryRulesetFilePathRestrictionRule{ Type: "file_path_restriction", Parameters: &RuleFileParameters{ RestrictedFilePaths: &[]string{"/a/file"}, }, }, - MaxFilePathLength: &RepositoryRuleSetMaxFilePathLengthRule{ + MaxFilePathLength: &RepositoryRulesetMaxFilePathLengthRule{ Type: "max_file_path_length", Parameters: &RuleMaxFilePathLengthParameters{ MaxFilePathLength: 255, }, }, - FileExtensionRestriction: &RepositoryRuleSetFileExtensionRestrictionRule{ + FileExtensionRestriction: &RepositoryRulesetFileExtensionRestrictionRule{ Type: "file_extension_restriction", Parameters: &RuleFileExtensionRestrictionParameters{ RestrictedFileExtensions: []string{".exe"}, }, }, - MaxFileSize: &RepositoryRuleSetMaxFileSizeRule{ + MaxFileSize: &RepositoryRulesetMaxFileSizeRule{ Type: "max_file_size", Parameters: &RuleMaxFileSizeParameters{ MaxFileSize: 1024, }, }, - Workflows: &RepositoryRuleSetWorkflowsRule{ + Workflows: &RepositoryRulesetWorkflowsRule{ Type: "workflows", Parameters: &RequiredWorkflowsRuleParameters{ RequiredWorkflows: []*RuleRequiredWorkflow{ @@ -10271,7 +10271,7 @@ func TestRepositoryRuleSetEvent_Marshal(t *testing.T) { }, }, }, - CodeScanning: &RepositoryRuleSetCodeScanningRule{ + CodeScanning: &RepositoryRulesetCodeScanningRule{ Type: "code_scanning", Parameters: &RuleCodeScanningParameters{ CodeScanningTools: []CodeScanningTool{{ @@ -10282,14 +10282,14 @@ func TestRepositoryRuleSetEvent_Marshal(t *testing.T) { }, }, }, - Changes: &RepositoryRuleSetEditedRuleChanges{ - Configuration: &RepositoryRuleSetEditedSources{ + Changes: &RepositoryRulesetEditedRuleChanges{ + Configuration: &RepositoryRulesetEditedSources{ From: []*string{String("from")}, }, - RuleType: &RepositoryRuleSetEditedSources{ + RuleType: &RepositoryRulesetEditedSources{ From: []*string{String("from")}, }, - Pattern: &RepositoryRuleSetEditedSources{ + Pattern: &RepositoryRulesetEditedSources{ From: []*string{String("from")}, }, }, diff --git a/github/github-accessors.go b/github/github-accessors.go index 96e9011f57e..1131f45dd47 100644 --- a/github/github-accessors.go +++ b/github/github-accessors.go @@ -20607,7 +20607,7 @@ func (r *RepositoryRule) GetParameters() json.RawMessage { } // GetConditions returns the Conditions field if it's non-nil, zero value otherwise. -func (r *RepositoryRuleSet) GetConditions() json.RawMessage { +func (r *RepositoryRuleset) GetConditions() json.RawMessage { if r == nil || r.Conditions == nil { return json.RawMessage{} } @@ -20615,7 +20615,7 @@ func (r *RepositoryRuleSet) GetConditions() json.RawMessage { } // GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. -func (r *RepositoryRuleSet) GetCreatedAt() Timestamp { +func (r *RepositoryRuleset) GetCreatedAt() Timestamp { if r == nil || r.CreatedAt == nil { return Timestamp{} } @@ -20623,7 +20623,7 @@ func (r *RepositoryRuleSet) GetCreatedAt() Timestamp { } // GetCurrentUserCanBypass returns the CurrentUserCanBypass field if it's non-nil, zero value otherwise. -func (r *RepositoryRuleSet) GetCurrentUserCanBypass() string { +func (r *RepositoryRuleset) GetCurrentUserCanBypass() string { if r == nil || r.CurrentUserCanBypass == nil { return "" } @@ -20631,7 +20631,7 @@ func (r *RepositoryRuleSet) GetCurrentUserCanBypass() string { } // GetLinks returns the Links field. -func (r *RepositoryRuleSet) GetLinks() *RepositoryRuleSetLink { +func (r *RepositoryRuleset) GetLinks() *RepositoryRulesetLink { if r == nil { return nil } @@ -20639,7 +20639,7 @@ func (r *RepositoryRuleSet) GetLinks() *RepositoryRuleSetLink { } // GetNodeID returns the NodeID field if it's non-nil, zero value otherwise. -func (r *RepositoryRuleSet) GetNodeID() string { +func (r *RepositoryRuleset) GetNodeID() string { if r == nil || r.NodeID == nil { return "" } @@ -20647,7 +20647,7 @@ func (r *RepositoryRuleSet) GetNodeID() string { } // GetSourceType returns the SourceType field if it's non-nil, zero value otherwise. -func (r *RepositoryRuleSet) GetSourceType() string { +func (r *RepositoryRuleset) GetSourceType() string { if r == nil || r.SourceType == nil { return "" } @@ -20655,7 +20655,7 @@ func (r *RepositoryRuleSet) GetSourceType() string { } // GetTarget returns the Target field if it's non-nil, zero value otherwise. -func (r *RepositoryRuleSet) GetTarget() string { +func (r *RepositoryRuleset) GetTarget() string { if r == nil || r.Target == nil { return "" } @@ -20663,7 +20663,7 @@ func (r *RepositoryRuleSet) GetTarget() string { } // GetUpdatedAt returns the UpdatedAt field if it's non-nil, zero value otherwise. -func (r *RepositoryRuleSet) GetUpdatedAt() Timestamp { +func (r *RepositoryRuleset) GetUpdatedAt() Timestamp { if r == nil || r.UpdatedAt == nil { return Timestamp{} } @@ -20671,7 +20671,7 @@ func (r *RepositoryRuleSet) GetUpdatedAt() Timestamp { } // GetParameters returns the Parameters field. -func (r *RepositoryRuleSetCodeScanningRule) GetParameters() *RuleCodeScanningParameters { +func (r *RepositoryRulesetCodeScanningRule) GetParameters() *RuleCodeScanningParameters { if r == nil { return nil } @@ -20679,7 +20679,7 @@ func (r *RepositoryRuleSetCodeScanningRule) GetParameters() *RuleCodeScanningPar } // GetConditions returns the Conditions field. -func (r *RepositoryRuleSetEditedChanges) GetConditions() *RepositoryRuleSetEditedConditions { +func (r *RepositoryRulesetEditedChanges) GetConditions() *RepositoryRulesetEditedConditions { if r == nil { return nil } @@ -20687,7 +20687,7 @@ func (r *RepositoryRuleSetEditedChanges) GetConditions() *RepositoryRuleSetEdite } // GetEnforcement returns the Enforcement field. -func (r *RepositoryRuleSetEditedChanges) GetEnforcement() *RepositoryRuleSetEditedSource { +func (r *RepositoryRulesetEditedChanges) GetEnforcement() *RepositoryRulesetEditedSource { if r == nil { return nil } @@ -20695,7 +20695,7 @@ func (r *RepositoryRuleSetEditedChanges) GetEnforcement() *RepositoryRuleSetEdit } // GetName returns the Name field. -func (r *RepositoryRuleSetEditedChanges) GetName() *RepositoryRuleSetEditedSource { +func (r *RepositoryRulesetEditedChanges) GetName() *RepositoryRulesetEditedSource { if r == nil { return nil } @@ -20703,7 +20703,7 @@ func (r *RepositoryRuleSetEditedChanges) GetName() *RepositoryRuleSetEditedSourc } // GetRules returns the Rules field. -func (r *RepositoryRuleSetEditedChanges) GetRules() *RepositoryRuleSetEditedRules { +func (r *RepositoryRulesetEditedChanges) GetRules() *RepositoryRulesetEditedRules { if r == nil { return nil } @@ -20711,7 +20711,7 @@ func (r *RepositoryRuleSetEditedChanges) GetRules() *RepositoryRuleSetEditedRule } // GetConfiguration returns the Configuration field. -func (r *RepositoryRuleSetEditedRuleChanges) GetConfiguration() *RepositoryRuleSetEditedSources { +func (r *RepositoryRulesetEditedRuleChanges) GetConfiguration() *RepositoryRulesetEditedSources { if r == nil { return nil } @@ -20719,7 +20719,7 @@ func (r *RepositoryRuleSetEditedRuleChanges) GetConfiguration() *RepositoryRuleS } // GetPattern returns the Pattern field. -func (r *RepositoryRuleSetEditedRuleChanges) GetPattern() *RepositoryRuleSetEditedSources { +func (r *RepositoryRulesetEditedRuleChanges) GetPattern() *RepositoryRulesetEditedSources { if r == nil { return nil } @@ -20727,7 +20727,7 @@ func (r *RepositoryRuleSetEditedRuleChanges) GetPattern() *RepositoryRuleSetEdit } // GetRuleType returns the RuleType field. -func (r *RepositoryRuleSetEditedRuleChanges) GetRuleType() *RepositoryRuleSetEditedSources { +func (r *RepositoryRulesetEditedRuleChanges) GetRuleType() *RepositoryRulesetEditedSources { if r == nil { return nil } @@ -20735,7 +20735,7 @@ func (r *RepositoryRuleSetEditedRuleChanges) GetRuleType() *RepositoryRuleSetEdi } // GetFrom returns the From field if it's non-nil, zero value otherwise. -func (r *RepositoryRuleSetEditedSource) GetFrom() string { +func (r *RepositoryRulesetEditedSource) GetFrom() string { if r == nil || r.From == nil { return "" } @@ -20743,7 +20743,7 @@ func (r *RepositoryRuleSetEditedSource) GetFrom() string { } // GetChanges returns the Changes field. -func (r *RepositoryRuleSetEditedUpdatedConditions) GetChanges() *RepositoryRuleSetUpdatedConditionsEdited { +func (r *RepositoryRulesetEditedUpdatedConditions) GetChanges() *RepositoryRulesetUpdatedConditionsEdited { if r == nil { return nil } @@ -20751,7 +20751,7 @@ func (r *RepositoryRuleSetEditedUpdatedConditions) GetChanges() *RepositoryRuleS } // GetCondition returns the Condition field. -func (r *RepositoryRuleSetEditedUpdatedConditions) GetCondition() *RepositoryRuleSetRefCondition { +func (r *RepositoryRulesetEditedUpdatedConditions) GetCondition() *RepositoryRulesetRefCondition { if r == nil { return nil } @@ -20759,7 +20759,7 @@ func (r *RepositoryRuleSetEditedUpdatedConditions) GetCondition() *RepositoryRul } // GetAction returns the Action field if it's non-nil, zero value otherwise. -func (r *RepositoryRuleSetEvent) GetAction() string { +func (r *RepositoryRulesetEvent) GetAction() string { if r == nil || r.Action == nil { return "" } @@ -20767,7 +20767,7 @@ func (r *RepositoryRuleSetEvent) GetAction() string { } // GetChanges returns the Changes field. -func (r *RepositoryRuleSetEvent) GetChanges() *RepositoryRuleSetEditedChanges { +func (r *RepositoryRulesetEvent) GetChanges() *RepositoryRulesetEditedChanges { if r == nil { return nil } @@ -20775,7 +20775,7 @@ func (r *RepositoryRuleSetEvent) GetChanges() *RepositoryRuleSetEditedChanges { } // GetEnterprise returns the Enterprise field. -func (r *RepositoryRuleSetEvent) GetEnterprise() *Enterprise { +func (r *RepositoryRulesetEvent) GetEnterprise() *Enterprise { if r == nil { return nil } @@ -20783,7 +20783,7 @@ func (r *RepositoryRuleSetEvent) GetEnterprise() *Enterprise { } // GetInstallation returns the Installation field. -func (r *RepositoryRuleSetEvent) GetInstallation() *Installation { +func (r *RepositoryRulesetEvent) GetInstallation() *Installation { if r == nil { return nil } @@ -20791,7 +20791,7 @@ func (r *RepositoryRuleSetEvent) GetInstallation() *Installation { } // GetOrganization returns the Organization field. -func (r *RepositoryRuleSetEvent) GetOrganization() *Organization { +func (r *RepositoryRulesetEvent) GetOrganization() *Organization { if r == nil { return nil } @@ -20799,23 +20799,23 @@ func (r *RepositoryRuleSetEvent) GetOrganization() *Organization { } // GetRepository returns the Repository field. -func (r *RepositoryRuleSetEvent) GetRepository() *Repository { +func (r *RepositoryRulesetEvent) GetRepository() *Repository { if r == nil { return nil } return r.Repository } -// GetRepositoryRuleSet returns the RepositoryRuleSet field. -func (r *RepositoryRuleSetEvent) GetRepositoryRuleSet() *RepositoryRuleSet { +// GetRepositoryRuleset returns the RepositoryRuleset field. +func (r *RepositoryRulesetEvent) GetRepositoryRuleset() *RepositoryRuleset { if r == nil { return nil } - return r.RepositoryRuleSet + return r.RepositoryRuleset } // GetSender returns the Sender field. -func (r *RepositoryRuleSetEvent) GetSender() *User { +func (r *RepositoryRulesetEvent) GetSender() *User { if r == nil { return nil } @@ -20823,7 +20823,7 @@ func (r *RepositoryRuleSetEvent) GetSender() *User { } // GetParameters returns the Parameters field. -func (r *RepositoryRuleSetFileExtensionRestrictionRule) GetParameters() *RuleFileExtensionRestrictionParameters { +func (r *RepositoryRulesetFileExtensionRestrictionRule) GetParameters() *RuleFileExtensionRestrictionParameters { if r == nil { return nil } @@ -20831,7 +20831,7 @@ func (r *RepositoryRuleSetFileExtensionRestrictionRule) GetParameters() *RuleFil } // GetParameters returns the Parameters field. -func (r *RepositoryRuleSetFilePathRestrictionRule) GetParameters() *RuleFileParameters { +func (r *RepositoryRulesetFilePathRestrictionRule) GetParameters() *RuleFileParameters { if r == nil { return nil } @@ -20839,7 +20839,7 @@ func (r *RepositoryRuleSetFilePathRestrictionRule) GetParameters() *RuleFilePara } // GetHTML returns the HTML field. -func (r *RepositoryRuleSetLink) GetHTML() *RulesetLink { +func (r *RepositoryRulesetLink) GetHTML() *RulesetLink { if r == nil { return nil } @@ -20847,7 +20847,7 @@ func (r *RepositoryRuleSetLink) GetHTML() *RulesetLink { } // GetSelf returns the Self field. -func (r *RepositoryRuleSetLink) GetSelf() *RulesetLink { +func (r *RepositoryRulesetLink) GetSelf() *RulesetLink { if r == nil { return nil } @@ -20855,7 +20855,7 @@ func (r *RepositoryRuleSetLink) GetSelf() *RulesetLink { } // GetParameters returns the Parameters field. -func (r *RepositoryRuleSetMaxFilePathLengthRule) GetParameters() *RuleMaxFilePathLengthParameters { +func (r *RepositoryRulesetMaxFilePathLengthRule) GetParameters() *RuleMaxFilePathLengthParameters { if r == nil { return nil } @@ -20863,7 +20863,7 @@ func (r *RepositoryRuleSetMaxFilePathLengthRule) GetParameters() *RuleMaxFilePat } // GetParameters returns the Parameters field. -func (r *RepositoryRuleSetMaxFileSizeRule) GetParameters() *RuleMaxFileSizeParameters { +func (r *RepositoryRulesetMaxFileSizeRule) GetParameters() *RuleMaxFileSizeParameters { if r == nil { return nil } @@ -20871,7 +20871,7 @@ func (r *RepositoryRuleSetMaxFileSizeRule) GetParameters() *RuleMaxFileSizeParam } // GetParameters returns the Parameters field. -func (r *RepositoryRuleSetMergeQueueRule) GetParameters() *MergeQueueRuleParameters { +func (r *RepositoryRulesetMergeQueueRule) GetParameters() *MergeQueueRuleParameters { if r == nil { return nil } @@ -20879,7 +20879,7 @@ func (r *RepositoryRuleSetMergeQueueRule) GetParameters() *MergeQueueRuleParamet } // GetParameters returns the Parameters field. -func (r *RepositoryRuleSetPatternRule) GetParameters() *RulePatternParameters { +func (r *RepositoryRulesetPatternRule) GetParameters() *RulePatternParameters { if r == nil { return nil } @@ -20887,7 +20887,7 @@ func (r *RepositoryRuleSetPatternRule) GetParameters() *RulePatternParameters { } // GetParameters returns the Parameters field. -func (r *RepositoryRuleSetPullRequestRule) GetParameters() *PullRequestRuleParameters { +func (r *RepositoryRulesetPullRequestRule) GetParameters() *PullRequestRuleParameters { if r == nil { return nil } @@ -20895,7 +20895,7 @@ func (r *RepositoryRuleSetPullRequestRule) GetParameters() *PullRequestRuleParam } // GetRefName returns the RefName field. -func (r *RepositoryRuleSetRefCondition) GetRefName() *RulesetRefConditionParameters { +func (r *RepositoryRulesetRefCondition) GetRefName() *RulesetRefConditionParameters { if r == nil { return nil } @@ -20903,7 +20903,7 @@ func (r *RepositoryRuleSetRefCondition) GetRefName() *RulesetRefConditionParamet } // GetParameters returns the Parameters field. -func (r *RepositoryRuleSetRequireDeploymentsRule) GetParameters() *RequiredDeploymentEnvironmentsRuleParameters { +func (r *RepositoryRulesetRequireDeploymentsRule) GetParameters() *RequiredDeploymentEnvironmentsRuleParameters { if r == nil { return nil } @@ -20911,7 +20911,7 @@ func (r *RepositoryRuleSetRequireDeploymentsRule) GetParameters() *RequiredDeplo } // GetParameters returns the Parameters field. -func (r *RepositoryRuleSetRequiredStatusChecksRule) GetParameters() *RequiredStatusChecksRuleParameters { +func (r *RepositoryRulesetRequiredStatusChecksRule) GetParameters() *RequiredStatusChecksRuleParameters { if r == nil { return nil } @@ -20919,7 +20919,7 @@ func (r *RepositoryRuleSetRequiredStatusChecksRule) GetParameters() *RequiredSta } // GetBranchNamePattern returns the BranchNamePattern field. -func (r *RepositoryRuleSetRule) GetBranchNamePattern() *RepositoryRuleSetPatternRule { +func (r *RepositoryRulesetRule) GetBranchNamePattern() *RepositoryRulesetPatternRule { if r == nil { return nil } @@ -20927,7 +20927,7 @@ func (r *RepositoryRuleSetRule) GetBranchNamePattern() *RepositoryRuleSetPattern } // GetCodeScanning returns the CodeScanning field. -func (r *RepositoryRuleSetRule) GetCodeScanning() *RepositoryRuleSetCodeScanningRule { +func (r *RepositoryRulesetRule) GetCodeScanning() *RepositoryRulesetCodeScanningRule { if r == nil { return nil } @@ -20935,7 +20935,7 @@ func (r *RepositoryRuleSetRule) GetCodeScanning() *RepositoryRuleSetCodeScanning } // GetCommitAuthorEmailPattern returns the CommitAuthorEmailPattern field. -func (r *RepositoryRuleSetRule) GetCommitAuthorEmailPattern() *RepositoryRuleSetPatternRule { +func (r *RepositoryRulesetRule) GetCommitAuthorEmailPattern() *RepositoryRulesetPatternRule { if r == nil { return nil } @@ -20943,7 +20943,7 @@ func (r *RepositoryRuleSetRule) GetCommitAuthorEmailPattern() *RepositoryRuleSet } // GetCommitMessagePattern returns the CommitMessagePattern field. -func (r *RepositoryRuleSetRule) GetCommitMessagePattern() *RepositoryRuleSetPatternRule { +func (r *RepositoryRulesetRule) GetCommitMessagePattern() *RepositoryRulesetPatternRule { if r == nil { return nil } @@ -20951,7 +20951,7 @@ func (r *RepositoryRuleSetRule) GetCommitMessagePattern() *RepositoryRuleSetPatt } // GetCommitterEmailPattern returns the CommitterEmailPattern field. -func (r *RepositoryRuleSetRule) GetCommitterEmailPattern() *RepositoryRuleSetPatternRule { +func (r *RepositoryRulesetRule) GetCommitterEmailPattern() *RepositoryRulesetPatternRule { if r == nil { return nil } @@ -20959,7 +20959,7 @@ func (r *RepositoryRuleSetRule) GetCommitterEmailPattern() *RepositoryRuleSetPat } // GetCreation returns the Creation field. -func (r *RepositoryRuleSetRule) GetCreation() *RepositoryRuleSetRuleType { +func (r *RepositoryRulesetRule) GetCreation() *RepositoryRulesetRuleType { if r == nil { return nil } @@ -20967,7 +20967,7 @@ func (r *RepositoryRuleSetRule) GetCreation() *RepositoryRuleSetRuleType { } // GetDeletion returns the Deletion field. -func (r *RepositoryRuleSetRule) GetDeletion() *RepositoryRuleSetRuleType { +func (r *RepositoryRulesetRule) GetDeletion() *RepositoryRulesetRuleType { if r == nil { return nil } @@ -20975,7 +20975,7 @@ func (r *RepositoryRuleSetRule) GetDeletion() *RepositoryRuleSetRuleType { } // GetFileExtensionRestriction returns the FileExtensionRestriction field. -func (r *RepositoryRuleSetRule) GetFileExtensionRestriction() *RepositoryRuleSetFileExtensionRestrictionRule { +func (r *RepositoryRulesetRule) GetFileExtensionRestriction() *RepositoryRulesetFileExtensionRestrictionRule { if r == nil { return nil } @@ -20983,7 +20983,7 @@ func (r *RepositoryRuleSetRule) GetFileExtensionRestriction() *RepositoryRuleSet } // GetFilePathRestriction returns the FilePathRestriction field. -func (r *RepositoryRuleSetRule) GetFilePathRestriction() *RepositoryRuleSetFilePathRestrictionRule { +func (r *RepositoryRulesetRule) GetFilePathRestriction() *RepositoryRulesetFilePathRestrictionRule { if r == nil { return nil } @@ -20991,7 +20991,7 @@ func (r *RepositoryRuleSetRule) GetFilePathRestriction() *RepositoryRuleSetFileP } // GetMaxFilePathLength returns the MaxFilePathLength field. -func (r *RepositoryRuleSetRule) GetMaxFilePathLength() *RepositoryRuleSetMaxFilePathLengthRule { +func (r *RepositoryRulesetRule) GetMaxFilePathLength() *RepositoryRulesetMaxFilePathLengthRule { if r == nil { return nil } @@ -20999,7 +20999,7 @@ func (r *RepositoryRuleSetRule) GetMaxFilePathLength() *RepositoryRuleSetMaxFile } // GetMaxFileSize returns the MaxFileSize field. -func (r *RepositoryRuleSetRule) GetMaxFileSize() *RepositoryRuleSetMaxFileSizeRule { +func (r *RepositoryRulesetRule) GetMaxFileSize() *RepositoryRulesetMaxFileSizeRule { if r == nil { return nil } @@ -21007,7 +21007,7 @@ func (r *RepositoryRuleSetRule) GetMaxFileSize() *RepositoryRuleSetMaxFileSizeRu } // GetMergeQueue returns the MergeQueue field. -func (r *RepositoryRuleSetRule) GetMergeQueue() *RepositoryRuleSetMergeQueueRule { +func (r *RepositoryRulesetRule) GetMergeQueue() *RepositoryRulesetMergeQueueRule { if r == nil { return nil } @@ -21015,7 +21015,7 @@ func (r *RepositoryRuleSetRule) GetMergeQueue() *RepositoryRuleSetMergeQueueRule } // GetNonFastForward returns the NonFastForward field. -func (r *RepositoryRuleSetRule) GetNonFastForward() *RepositoryRuleSetRuleType { +func (r *RepositoryRulesetRule) GetNonFastForward() *RepositoryRulesetRuleType { if r == nil { return nil } @@ -21023,7 +21023,7 @@ func (r *RepositoryRuleSetRule) GetNonFastForward() *RepositoryRuleSetRuleType { } // GetPullRequest returns the PullRequest field. -func (r *RepositoryRuleSetRule) GetPullRequest() *RepositoryRuleSetPullRequestRule { +func (r *RepositoryRulesetRule) GetPullRequest() *RepositoryRulesetPullRequestRule { if r == nil { return nil } @@ -21031,7 +21031,7 @@ func (r *RepositoryRuleSetRule) GetPullRequest() *RepositoryRuleSetPullRequestRu } // GetRequireDeployments returns the RequireDeployments field. -func (r *RepositoryRuleSetRule) GetRequireDeployments() *RepositoryRuleSetRequireDeploymentsRule { +func (r *RepositoryRulesetRule) GetRequireDeployments() *RepositoryRulesetRequireDeploymentsRule { if r == nil { return nil } @@ -21039,7 +21039,7 @@ func (r *RepositoryRuleSetRule) GetRequireDeployments() *RepositoryRuleSetRequir } // GetRequiredSignatures returns the RequiredSignatures field. -func (r *RepositoryRuleSetRule) GetRequiredSignatures() *RepositoryRuleSetRuleType { +func (r *RepositoryRulesetRule) GetRequiredSignatures() *RepositoryRulesetRuleType { if r == nil { return nil } @@ -21047,7 +21047,7 @@ func (r *RepositoryRuleSetRule) GetRequiredSignatures() *RepositoryRuleSetRuleTy } // GetRequiredStatusChecks returns the RequiredStatusChecks field. -func (r *RepositoryRuleSetRule) GetRequiredStatusChecks() *RepositoryRuleSetRequiredStatusChecksRule { +func (r *RepositoryRulesetRule) GetRequiredStatusChecks() *RepositoryRulesetRequiredStatusChecksRule { if r == nil { return nil } @@ -21055,7 +21055,7 @@ func (r *RepositoryRuleSetRule) GetRequiredStatusChecks() *RepositoryRuleSetRequ } // GetRequireLinearHistory returns the RequireLinearHistory field. -func (r *RepositoryRuleSetRule) GetRequireLinearHistory() *RepositoryRuleSetRuleType { +func (r *RepositoryRulesetRule) GetRequireLinearHistory() *RepositoryRulesetRuleType { if r == nil { return nil } @@ -21063,7 +21063,7 @@ func (r *RepositoryRuleSetRule) GetRequireLinearHistory() *RepositoryRuleSetRule } // GetTagNamePattern returns the TagNamePattern field. -func (r *RepositoryRuleSetRule) GetTagNamePattern() *RepositoryRuleSetPatternRule { +func (r *RepositoryRulesetRule) GetTagNamePattern() *RepositoryRulesetPatternRule { if r == nil { return nil } @@ -21071,7 +21071,7 @@ func (r *RepositoryRuleSetRule) GetTagNamePattern() *RepositoryRuleSetPatternRul } // GetUpdate returns the Update field. -func (r *RepositoryRuleSetRule) GetUpdate() *RepositoryRuleSetUpdateRule { +func (r *RepositoryRulesetRule) GetUpdate() *RepositoryRulesetUpdateRule { if r == nil { return nil } @@ -21079,7 +21079,7 @@ func (r *RepositoryRuleSetRule) GetUpdate() *RepositoryRuleSetUpdateRule { } // GetWorkflows returns the Workflows field. -func (r *RepositoryRuleSetRule) GetWorkflows() *RepositoryRuleSetWorkflowsRule { +func (r *RepositoryRulesetRule) GetWorkflows() *RepositoryRulesetWorkflowsRule { if r == nil { return nil } @@ -21087,7 +21087,7 @@ func (r *RepositoryRuleSetRule) GetWorkflows() *RepositoryRuleSetWorkflowsRule { } // GetConditionType returns the ConditionType field. -func (r *RepositoryRuleSetUpdatedConditionsEdited) GetConditionType() *RepositoryRuleSetEditedSource { +func (r *RepositoryRulesetUpdatedConditionsEdited) GetConditionType() *RepositoryRulesetEditedSource { if r == nil { return nil } @@ -21095,7 +21095,7 @@ func (r *RepositoryRuleSetUpdatedConditionsEdited) GetConditionType() *Repositor } // GetExclude returns the Exclude field. -func (r *RepositoryRuleSetUpdatedConditionsEdited) GetExclude() *RepositoryRuleSetEditedSources { +func (r *RepositoryRulesetUpdatedConditionsEdited) GetExclude() *RepositoryRulesetEditedSources { if r == nil { return nil } @@ -21103,7 +21103,7 @@ func (r *RepositoryRuleSetUpdatedConditionsEdited) GetExclude() *RepositoryRuleS } // GetInclude returns the Include field. -func (r *RepositoryRuleSetUpdatedConditionsEdited) GetInclude() *RepositoryRuleSetEditedSources { +func (r *RepositoryRulesetUpdatedConditionsEdited) GetInclude() *RepositoryRulesetEditedSources { if r == nil { return nil } @@ -21111,7 +21111,7 @@ func (r *RepositoryRuleSetUpdatedConditionsEdited) GetInclude() *RepositoryRuleS } // GetTarget returns the Target field. -func (r *RepositoryRuleSetUpdatedConditionsEdited) GetTarget() *RepositoryRuleSetEditedSource { +func (r *RepositoryRulesetUpdatedConditionsEdited) GetTarget() *RepositoryRulesetEditedSource { if r == nil { return nil } @@ -21119,7 +21119,7 @@ func (r *RepositoryRuleSetUpdatedConditionsEdited) GetTarget() *RepositoryRuleSe } // GetChanges returns the Changes field. -func (r *RepositoryRuleSetUpdatedRules) GetChanges() *RepositoryRuleSetEditedRuleChanges { +func (r *RepositoryRulesetUpdatedRules) GetChanges() *RepositoryRulesetEditedRuleChanges { if r == nil { return nil } @@ -21127,7 +21127,7 @@ func (r *RepositoryRuleSetUpdatedRules) GetChanges() *RepositoryRuleSetEditedRul } // GetRule returns the Rule field. -func (r *RepositoryRuleSetUpdatedRules) GetRule() *RepositoryRuleSetRule { +func (r *RepositoryRulesetUpdatedRules) GetRule() *RepositoryRulesetRule { if r == nil { return nil } @@ -21135,7 +21135,7 @@ func (r *RepositoryRuleSetUpdatedRules) GetRule() *RepositoryRuleSetRule { } // GetParameters returns the Parameters field. -func (r *RepositoryRuleSetUpdateRule) GetParameters() *UpdateAllowsFetchAndMergeRuleParameters { +func (r *RepositoryRulesetUpdateRule) GetParameters() *UpdateAllowsFetchAndMergeRuleParameters { if r == nil { return nil } @@ -21143,7 +21143,7 @@ func (r *RepositoryRuleSetUpdateRule) GetParameters() *UpdateAllowsFetchAndMerge } // GetParameters returns the Parameters field. -func (r *RepositoryRuleSetWorkflowsRule) GetParameters() *RequiredWorkflowsRuleParameters { +func (r *RepositoryRulesetWorkflowsRule) GetParameters() *RequiredWorkflowsRuleParameters { if r == nil { return nil } diff --git a/github/github-accessors_test.go b/github/github-accessors_test.go index 74508d8b6e1..198ed5db249 100644 --- a/github/github-accessors_test.go +++ b/github/github-accessors_test.go @@ -23913,504 +23913,504 @@ func TestRepositoryRule_GetParameters(tt *testing.T) { r.GetParameters() } -func TestRepositoryRuleSet_GetConditions(tt *testing.T) { +func TestRepositoryRuleset_GetConditions(tt *testing.T) { var zeroValue json.RawMessage - r := &RepositoryRuleSet{Conditions: &zeroValue} + r := &RepositoryRuleset{Conditions: &zeroValue} r.GetConditions() - r = &RepositoryRuleSet{} + r = &RepositoryRuleset{} r.GetConditions() r = nil r.GetConditions() } -func TestRepositoryRuleSet_GetCreatedAt(tt *testing.T) { +func TestRepositoryRuleset_GetCreatedAt(tt *testing.T) { var zeroValue Timestamp - r := &RepositoryRuleSet{CreatedAt: &zeroValue} + r := &RepositoryRuleset{CreatedAt: &zeroValue} r.GetCreatedAt() - r = &RepositoryRuleSet{} + r = &RepositoryRuleset{} r.GetCreatedAt() r = nil r.GetCreatedAt() } -func TestRepositoryRuleSet_GetCurrentUserCanBypass(tt *testing.T) { +func TestRepositoryRuleset_GetCurrentUserCanBypass(tt *testing.T) { var zeroValue string - r := &RepositoryRuleSet{CurrentUserCanBypass: &zeroValue} + r := &RepositoryRuleset{CurrentUserCanBypass: &zeroValue} r.GetCurrentUserCanBypass() - r = &RepositoryRuleSet{} + r = &RepositoryRuleset{} r.GetCurrentUserCanBypass() r = nil r.GetCurrentUserCanBypass() } -func TestRepositoryRuleSet_GetLinks(tt *testing.T) { - r := &RepositoryRuleSet{} +func TestRepositoryRuleset_GetLinks(tt *testing.T) { + r := &RepositoryRuleset{} r.GetLinks() r = nil r.GetLinks() } -func TestRepositoryRuleSet_GetNodeID(tt *testing.T) { +func TestRepositoryRuleset_GetNodeID(tt *testing.T) { var zeroValue string - r := &RepositoryRuleSet{NodeID: &zeroValue} + r := &RepositoryRuleset{NodeID: &zeroValue} r.GetNodeID() - r = &RepositoryRuleSet{} + r = &RepositoryRuleset{} r.GetNodeID() r = nil r.GetNodeID() } -func TestRepositoryRuleSet_GetSourceType(tt *testing.T) { +func TestRepositoryRuleset_GetSourceType(tt *testing.T) { var zeroValue string - r := &RepositoryRuleSet{SourceType: &zeroValue} + r := &RepositoryRuleset{SourceType: &zeroValue} r.GetSourceType() - r = &RepositoryRuleSet{} + r = &RepositoryRuleset{} r.GetSourceType() r = nil r.GetSourceType() } -func TestRepositoryRuleSet_GetTarget(tt *testing.T) { +func TestRepositoryRuleset_GetTarget(tt *testing.T) { var zeroValue string - r := &RepositoryRuleSet{Target: &zeroValue} + r := &RepositoryRuleset{Target: &zeroValue} r.GetTarget() - r = &RepositoryRuleSet{} + r = &RepositoryRuleset{} r.GetTarget() r = nil r.GetTarget() } -func TestRepositoryRuleSet_GetUpdatedAt(tt *testing.T) { +func TestRepositoryRuleset_GetUpdatedAt(tt *testing.T) { var zeroValue Timestamp - r := &RepositoryRuleSet{UpdatedAt: &zeroValue} + r := &RepositoryRuleset{UpdatedAt: &zeroValue} r.GetUpdatedAt() - r = &RepositoryRuleSet{} + r = &RepositoryRuleset{} r.GetUpdatedAt() r = nil r.GetUpdatedAt() } -func TestRepositoryRuleSetCodeScanningRule_GetParameters(tt *testing.T) { - r := &RepositoryRuleSetCodeScanningRule{} +func TestRepositoryRulesetCodeScanningRule_GetParameters(tt *testing.T) { + r := &RepositoryRulesetCodeScanningRule{} r.GetParameters() r = nil r.GetParameters() } -func TestRepositoryRuleSetEditedChanges_GetConditions(tt *testing.T) { - r := &RepositoryRuleSetEditedChanges{} +func TestRepositoryRulesetEditedChanges_GetConditions(tt *testing.T) { + r := &RepositoryRulesetEditedChanges{} r.GetConditions() r = nil r.GetConditions() } -func TestRepositoryRuleSetEditedChanges_GetEnforcement(tt *testing.T) { - r := &RepositoryRuleSetEditedChanges{} +func TestRepositoryRulesetEditedChanges_GetEnforcement(tt *testing.T) { + r := &RepositoryRulesetEditedChanges{} r.GetEnforcement() r = nil r.GetEnforcement() } -func TestRepositoryRuleSetEditedChanges_GetName(tt *testing.T) { - r := &RepositoryRuleSetEditedChanges{} +func TestRepositoryRulesetEditedChanges_GetName(tt *testing.T) { + r := &RepositoryRulesetEditedChanges{} r.GetName() r = nil r.GetName() } -func TestRepositoryRuleSetEditedChanges_GetRules(tt *testing.T) { - r := &RepositoryRuleSetEditedChanges{} +func TestRepositoryRulesetEditedChanges_GetRules(tt *testing.T) { + r := &RepositoryRulesetEditedChanges{} r.GetRules() r = nil r.GetRules() } -func TestRepositoryRuleSetEditedRuleChanges_GetConfiguration(tt *testing.T) { - r := &RepositoryRuleSetEditedRuleChanges{} +func TestRepositoryRulesetEditedRuleChanges_GetConfiguration(tt *testing.T) { + r := &RepositoryRulesetEditedRuleChanges{} r.GetConfiguration() r = nil r.GetConfiguration() } -func TestRepositoryRuleSetEditedRuleChanges_GetPattern(tt *testing.T) { - r := &RepositoryRuleSetEditedRuleChanges{} +func TestRepositoryRulesetEditedRuleChanges_GetPattern(tt *testing.T) { + r := &RepositoryRulesetEditedRuleChanges{} r.GetPattern() r = nil r.GetPattern() } -func TestRepositoryRuleSetEditedRuleChanges_GetRuleType(tt *testing.T) { - r := &RepositoryRuleSetEditedRuleChanges{} +func TestRepositoryRulesetEditedRuleChanges_GetRuleType(tt *testing.T) { + r := &RepositoryRulesetEditedRuleChanges{} r.GetRuleType() r = nil r.GetRuleType() } -func TestRepositoryRuleSetEditedSource_GetFrom(tt *testing.T) { +func TestRepositoryRulesetEditedSource_GetFrom(tt *testing.T) { var zeroValue string - r := &RepositoryRuleSetEditedSource{From: &zeroValue} + r := &RepositoryRulesetEditedSource{From: &zeroValue} r.GetFrom() - r = &RepositoryRuleSetEditedSource{} + r = &RepositoryRulesetEditedSource{} r.GetFrom() r = nil r.GetFrom() } -func TestRepositoryRuleSetEditedUpdatedConditions_GetChanges(tt *testing.T) { - r := &RepositoryRuleSetEditedUpdatedConditions{} +func TestRepositoryRulesetEditedUpdatedConditions_GetChanges(tt *testing.T) { + r := &RepositoryRulesetEditedUpdatedConditions{} r.GetChanges() r = nil r.GetChanges() } -func TestRepositoryRuleSetEditedUpdatedConditions_GetCondition(tt *testing.T) { - r := &RepositoryRuleSetEditedUpdatedConditions{} +func TestRepositoryRulesetEditedUpdatedConditions_GetCondition(tt *testing.T) { + r := &RepositoryRulesetEditedUpdatedConditions{} r.GetCondition() r = nil r.GetCondition() } -func TestRepositoryRuleSetEvent_GetAction(tt *testing.T) { +func TestRepositoryRulesetEvent_GetAction(tt *testing.T) { var zeroValue string - r := &RepositoryRuleSetEvent{Action: &zeroValue} + r := &RepositoryRulesetEvent{Action: &zeroValue} r.GetAction() - r = &RepositoryRuleSetEvent{} + r = &RepositoryRulesetEvent{} r.GetAction() r = nil r.GetAction() } -func TestRepositoryRuleSetEvent_GetChanges(tt *testing.T) { - r := &RepositoryRuleSetEvent{} +func TestRepositoryRulesetEvent_GetChanges(tt *testing.T) { + r := &RepositoryRulesetEvent{} r.GetChanges() r = nil r.GetChanges() } -func TestRepositoryRuleSetEvent_GetEnterprise(tt *testing.T) { - r := &RepositoryRuleSetEvent{} +func TestRepositoryRulesetEvent_GetEnterprise(tt *testing.T) { + r := &RepositoryRulesetEvent{} r.GetEnterprise() r = nil r.GetEnterprise() } -func TestRepositoryRuleSetEvent_GetInstallation(tt *testing.T) { - r := &RepositoryRuleSetEvent{} +func TestRepositoryRulesetEvent_GetInstallation(tt *testing.T) { + r := &RepositoryRulesetEvent{} r.GetInstallation() r = nil r.GetInstallation() } -func TestRepositoryRuleSetEvent_GetOrganization(tt *testing.T) { - r := &RepositoryRuleSetEvent{} +func TestRepositoryRulesetEvent_GetOrganization(tt *testing.T) { + r := &RepositoryRulesetEvent{} r.GetOrganization() r = nil r.GetOrganization() } -func TestRepositoryRuleSetEvent_GetRepository(tt *testing.T) { - r := &RepositoryRuleSetEvent{} +func TestRepositoryRulesetEvent_GetRepository(tt *testing.T) { + r := &RepositoryRulesetEvent{} r.GetRepository() r = nil r.GetRepository() } -func TestRepositoryRuleSetEvent_GetRepositoryRuleSet(tt *testing.T) { - r := &RepositoryRuleSetEvent{} - r.GetRepositoryRuleSet() +func TestRepositoryRulesetEvent_GetRepositoryRuleset(tt *testing.T) { + r := &RepositoryRulesetEvent{} + r.GetRepositoryRuleset() r = nil - r.GetRepositoryRuleSet() + r.GetRepositoryRuleset() } -func TestRepositoryRuleSetEvent_GetSender(tt *testing.T) { - r := &RepositoryRuleSetEvent{} +func TestRepositoryRulesetEvent_GetSender(tt *testing.T) { + r := &RepositoryRulesetEvent{} r.GetSender() r = nil r.GetSender() } -func TestRepositoryRuleSetFileExtensionRestrictionRule_GetParameters(tt *testing.T) { - r := &RepositoryRuleSetFileExtensionRestrictionRule{} +func TestRepositoryRulesetFileExtensionRestrictionRule_GetParameters(tt *testing.T) { + r := &RepositoryRulesetFileExtensionRestrictionRule{} r.GetParameters() r = nil r.GetParameters() } -func TestRepositoryRuleSetFilePathRestrictionRule_GetParameters(tt *testing.T) { - r := &RepositoryRuleSetFilePathRestrictionRule{} +func TestRepositoryRulesetFilePathRestrictionRule_GetParameters(tt *testing.T) { + r := &RepositoryRulesetFilePathRestrictionRule{} r.GetParameters() r = nil r.GetParameters() } -func TestRepositoryRuleSetLink_GetHTML(tt *testing.T) { - r := &RepositoryRuleSetLink{} +func TestRepositoryRulesetLink_GetHTML(tt *testing.T) { + r := &RepositoryRulesetLink{} r.GetHTML() r = nil r.GetHTML() } -func TestRepositoryRuleSetLink_GetSelf(tt *testing.T) { - r := &RepositoryRuleSetLink{} +func TestRepositoryRulesetLink_GetSelf(tt *testing.T) { + r := &RepositoryRulesetLink{} r.GetSelf() r = nil r.GetSelf() } -func TestRepositoryRuleSetMaxFilePathLengthRule_GetParameters(tt *testing.T) { - r := &RepositoryRuleSetMaxFilePathLengthRule{} +func TestRepositoryRulesetMaxFilePathLengthRule_GetParameters(tt *testing.T) { + r := &RepositoryRulesetMaxFilePathLengthRule{} r.GetParameters() r = nil r.GetParameters() } -func TestRepositoryRuleSetMaxFileSizeRule_GetParameters(tt *testing.T) { - r := &RepositoryRuleSetMaxFileSizeRule{} +func TestRepositoryRulesetMaxFileSizeRule_GetParameters(tt *testing.T) { + r := &RepositoryRulesetMaxFileSizeRule{} r.GetParameters() r = nil r.GetParameters() } -func TestRepositoryRuleSetMergeQueueRule_GetParameters(tt *testing.T) { - r := &RepositoryRuleSetMergeQueueRule{} +func TestRepositoryRulesetMergeQueueRule_GetParameters(tt *testing.T) { + r := &RepositoryRulesetMergeQueueRule{} r.GetParameters() r = nil r.GetParameters() } -func TestRepositoryRuleSetPatternRule_GetParameters(tt *testing.T) { - r := &RepositoryRuleSetPatternRule{} +func TestRepositoryRulesetPatternRule_GetParameters(tt *testing.T) { + r := &RepositoryRulesetPatternRule{} r.GetParameters() r = nil r.GetParameters() } -func TestRepositoryRuleSetPullRequestRule_GetParameters(tt *testing.T) { - r := &RepositoryRuleSetPullRequestRule{} +func TestRepositoryRulesetPullRequestRule_GetParameters(tt *testing.T) { + r := &RepositoryRulesetPullRequestRule{} r.GetParameters() r = nil r.GetParameters() } -func TestRepositoryRuleSetRefCondition_GetRefName(tt *testing.T) { - r := &RepositoryRuleSetRefCondition{} +func TestRepositoryRulesetRefCondition_GetRefName(tt *testing.T) { + r := &RepositoryRulesetRefCondition{} r.GetRefName() r = nil r.GetRefName() } -func TestRepositoryRuleSetRequireDeploymentsRule_GetParameters(tt *testing.T) { - r := &RepositoryRuleSetRequireDeploymentsRule{} +func TestRepositoryRulesetRequireDeploymentsRule_GetParameters(tt *testing.T) { + r := &RepositoryRulesetRequireDeploymentsRule{} r.GetParameters() r = nil r.GetParameters() } -func TestRepositoryRuleSetRequiredStatusChecksRule_GetParameters(tt *testing.T) { - r := &RepositoryRuleSetRequiredStatusChecksRule{} +func TestRepositoryRulesetRequiredStatusChecksRule_GetParameters(tt *testing.T) { + r := &RepositoryRulesetRequiredStatusChecksRule{} r.GetParameters() r = nil r.GetParameters() } -func TestRepositoryRuleSetRule_GetBranchNamePattern(tt *testing.T) { - r := &RepositoryRuleSetRule{} +func TestRepositoryRulesetRule_GetBranchNamePattern(tt *testing.T) { + r := &RepositoryRulesetRule{} r.GetBranchNamePattern() r = nil r.GetBranchNamePattern() } -func TestRepositoryRuleSetRule_GetCodeScanning(tt *testing.T) { - r := &RepositoryRuleSetRule{} +func TestRepositoryRulesetRule_GetCodeScanning(tt *testing.T) { + r := &RepositoryRulesetRule{} r.GetCodeScanning() r = nil r.GetCodeScanning() } -func TestRepositoryRuleSetRule_GetCommitAuthorEmailPattern(tt *testing.T) { - r := &RepositoryRuleSetRule{} +func TestRepositoryRulesetRule_GetCommitAuthorEmailPattern(tt *testing.T) { + r := &RepositoryRulesetRule{} r.GetCommitAuthorEmailPattern() r = nil r.GetCommitAuthorEmailPattern() } -func TestRepositoryRuleSetRule_GetCommitMessagePattern(tt *testing.T) { - r := &RepositoryRuleSetRule{} +func TestRepositoryRulesetRule_GetCommitMessagePattern(tt *testing.T) { + r := &RepositoryRulesetRule{} r.GetCommitMessagePattern() r = nil r.GetCommitMessagePattern() } -func TestRepositoryRuleSetRule_GetCommitterEmailPattern(tt *testing.T) { - r := &RepositoryRuleSetRule{} +func TestRepositoryRulesetRule_GetCommitterEmailPattern(tt *testing.T) { + r := &RepositoryRulesetRule{} r.GetCommitterEmailPattern() r = nil r.GetCommitterEmailPattern() } -func TestRepositoryRuleSetRule_GetCreation(tt *testing.T) { - r := &RepositoryRuleSetRule{} +func TestRepositoryRulesetRule_GetCreation(tt *testing.T) { + r := &RepositoryRulesetRule{} r.GetCreation() r = nil r.GetCreation() } -func TestRepositoryRuleSetRule_GetDeletion(tt *testing.T) { - r := &RepositoryRuleSetRule{} +func TestRepositoryRulesetRule_GetDeletion(tt *testing.T) { + r := &RepositoryRulesetRule{} r.GetDeletion() r = nil r.GetDeletion() } -func TestRepositoryRuleSetRule_GetFileExtensionRestriction(tt *testing.T) { - r := &RepositoryRuleSetRule{} +func TestRepositoryRulesetRule_GetFileExtensionRestriction(tt *testing.T) { + r := &RepositoryRulesetRule{} r.GetFileExtensionRestriction() r = nil r.GetFileExtensionRestriction() } -func TestRepositoryRuleSetRule_GetFilePathRestriction(tt *testing.T) { - r := &RepositoryRuleSetRule{} +func TestRepositoryRulesetRule_GetFilePathRestriction(tt *testing.T) { + r := &RepositoryRulesetRule{} r.GetFilePathRestriction() r = nil r.GetFilePathRestriction() } -func TestRepositoryRuleSetRule_GetMaxFilePathLength(tt *testing.T) { - r := &RepositoryRuleSetRule{} +func TestRepositoryRulesetRule_GetMaxFilePathLength(tt *testing.T) { + r := &RepositoryRulesetRule{} r.GetMaxFilePathLength() r = nil r.GetMaxFilePathLength() } -func TestRepositoryRuleSetRule_GetMaxFileSize(tt *testing.T) { - r := &RepositoryRuleSetRule{} +func TestRepositoryRulesetRule_GetMaxFileSize(tt *testing.T) { + r := &RepositoryRulesetRule{} r.GetMaxFileSize() r = nil r.GetMaxFileSize() } -func TestRepositoryRuleSetRule_GetMergeQueue(tt *testing.T) { - r := &RepositoryRuleSetRule{} +func TestRepositoryRulesetRule_GetMergeQueue(tt *testing.T) { + r := &RepositoryRulesetRule{} r.GetMergeQueue() r = nil r.GetMergeQueue() } -func TestRepositoryRuleSetRule_GetNonFastForward(tt *testing.T) { - r := &RepositoryRuleSetRule{} +func TestRepositoryRulesetRule_GetNonFastForward(tt *testing.T) { + r := &RepositoryRulesetRule{} r.GetNonFastForward() r = nil r.GetNonFastForward() } -func TestRepositoryRuleSetRule_GetPullRequest(tt *testing.T) { - r := &RepositoryRuleSetRule{} +func TestRepositoryRulesetRule_GetPullRequest(tt *testing.T) { + r := &RepositoryRulesetRule{} r.GetPullRequest() r = nil r.GetPullRequest() } -func TestRepositoryRuleSetRule_GetRequireDeployments(tt *testing.T) { - r := &RepositoryRuleSetRule{} +func TestRepositoryRulesetRule_GetRequireDeployments(tt *testing.T) { + r := &RepositoryRulesetRule{} r.GetRequireDeployments() r = nil r.GetRequireDeployments() } -func TestRepositoryRuleSetRule_GetRequiredSignatures(tt *testing.T) { - r := &RepositoryRuleSetRule{} +func TestRepositoryRulesetRule_GetRequiredSignatures(tt *testing.T) { + r := &RepositoryRulesetRule{} r.GetRequiredSignatures() r = nil r.GetRequiredSignatures() } -func TestRepositoryRuleSetRule_GetRequiredStatusChecks(tt *testing.T) { - r := &RepositoryRuleSetRule{} +func TestRepositoryRulesetRule_GetRequiredStatusChecks(tt *testing.T) { + r := &RepositoryRulesetRule{} r.GetRequiredStatusChecks() r = nil r.GetRequiredStatusChecks() } -func TestRepositoryRuleSetRule_GetRequireLinearHistory(tt *testing.T) { - r := &RepositoryRuleSetRule{} +func TestRepositoryRulesetRule_GetRequireLinearHistory(tt *testing.T) { + r := &RepositoryRulesetRule{} r.GetRequireLinearHistory() r = nil r.GetRequireLinearHistory() } -func TestRepositoryRuleSetRule_GetTagNamePattern(tt *testing.T) { - r := &RepositoryRuleSetRule{} +func TestRepositoryRulesetRule_GetTagNamePattern(tt *testing.T) { + r := &RepositoryRulesetRule{} r.GetTagNamePattern() r = nil r.GetTagNamePattern() } -func TestRepositoryRuleSetRule_GetUpdate(tt *testing.T) { - r := &RepositoryRuleSetRule{} +func TestRepositoryRulesetRule_GetUpdate(tt *testing.T) { + r := &RepositoryRulesetRule{} r.GetUpdate() r = nil r.GetUpdate() } -func TestRepositoryRuleSetRule_GetWorkflows(tt *testing.T) { - r := &RepositoryRuleSetRule{} +func TestRepositoryRulesetRule_GetWorkflows(tt *testing.T) { + r := &RepositoryRulesetRule{} r.GetWorkflows() r = nil r.GetWorkflows() } -func TestRepositoryRuleSetUpdatedConditionsEdited_GetConditionType(tt *testing.T) { - r := &RepositoryRuleSetUpdatedConditionsEdited{} +func TestRepositoryRulesetUpdatedConditionsEdited_GetConditionType(tt *testing.T) { + r := &RepositoryRulesetUpdatedConditionsEdited{} r.GetConditionType() r = nil r.GetConditionType() } -func TestRepositoryRuleSetUpdatedConditionsEdited_GetExclude(tt *testing.T) { - r := &RepositoryRuleSetUpdatedConditionsEdited{} +func TestRepositoryRulesetUpdatedConditionsEdited_GetExclude(tt *testing.T) { + r := &RepositoryRulesetUpdatedConditionsEdited{} r.GetExclude() r = nil r.GetExclude() } -func TestRepositoryRuleSetUpdatedConditionsEdited_GetInclude(tt *testing.T) { - r := &RepositoryRuleSetUpdatedConditionsEdited{} +func TestRepositoryRulesetUpdatedConditionsEdited_GetInclude(tt *testing.T) { + r := &RepositoryRulesetUpdatedConditionsEdited{} r.GetInclude() r = nil r.GetInclude() } -func TestRepositoryRuleSetUpdatedConditionsEdited_GetTarget(tt *testing.T) { - r := &RepositoryRuleSetUpdatedConditionsEdited{} +func TestRepositoryRulesetUpdatedConditionsEdited_GetTarget(tt *testing.T) { + r := &RepositoryRulesetUpdatedConditionsEdited{} r.GetTarget() r = nil r.GetTarget() } -func TestRepositoryRuleSetUpdatedRules_GetChanges(tt *testing.T) { - r := &RepositoryRuleSetUpdatedRules{} +func TestRepositoryRulesetUpdatedRules_GetChanges(tt *testing.T) { + r := &RepositoryRulesetUpdatedRules{} r.GetChanges() r = nil r.GetChanges() } -func TestRepositoryRuleSetUpdatedRules_GetRule(tt *testing.T) { - r := &RepositoryRuleSetUpdatedRules{} +func TestRepositoryRulesetUpdatedRules_GetRule(tt *testing.T) { + r := &RepositoryRulesetUpdatedRules{} r.GetRule() r = nil r.GetRule() } -func TestRepositoryRuleSetUpdateRule_GetParameters(tt *testing.T) { - r := &RepositoryRuleSetUpdateRule{} +func TestRepositoryRulesetUpdateRule_GetParameters(tt *testing.T) { + r := &RepositoryRulesetUpdateRule{} r.GetParameters() r = nil r.GetParameters() } -func TestRepositoryRuleSetWorkflowsRule_GetParameters(tt *testing.T) { - r := &RepositoryRuleSetWorkflowsRule{} +func TestRepositoryRulesetWorkflowsRule_GetParameters(tt *testing.T) { + r := &RepositoryRulesetWorkflowsRule{} r.GetParameters() r = nil r.GetParameters() diff --git a/github/messages.go b/github/messages.go index 197234c866e..d4b9bfe09b6 100644 --- a/github/messages.go +++ b/github/messages.go @@ -98,7 +98,7 @@ var ( "repository": &RepositoryEvent{}, "repository_dispatch": &RepositoryDispatchEvent{}, "repository_import": &RepositoryImportEvent{}, - "repository_ruleset": &RepositoryRuleSetEvent{}, + "repository_ruleset": &RepositoryRulesetEvent{}, "repository_vulnerability_alert": &RepositoryVulnerabilityAlertEvent{}, "release": &ReleaseEvent{}, "secret_scanning_alert": &SecretScanningAlertEvent{}, diff --git a/github/messages_test.go b/github/messages_test.go index 2f7e4460e7e..65d87109f67 100644 --- a/github/messages_test.go +++ b/github/messages_test.go @@ -457,7 +457,7 @@ func TestParseWebHook(t *testing.T) { messageType: "repository", }, { - payload: &RepositoryRuleSetEvent{}, + payload: &RepositoryRulesetEvent{}, messageType: "repository_ruleset", }, { diff --git a/github/repos_rules.go b/github/repos_rules.go index 8b14c40558a..780644a900a 100644 --- a/github/repos_rules.go +++ b/github/repos_rules.go @@ -168,60 +168,60 @@ type RepositoryRule struct { RulesetID int64 `json:"ruleset_id"` } -type RepositoryRuleSetEditedChanges struct { - Name *RepositoryRuleSetEditedSource `json:"name,omitempty"` - Enforcement *RepositoryRuleSetEditedSource `json:"enforcement,omitempty"` - Conditions *RepositoryRuleSetEditedConditions `json:"conditions,omitempty"` - Rules *RepositoryRuleSetEditedRules `json:"rules,omitempty"` +type RepositoryRulesetEditedChanges struct { + Name *RepositoryRulesetEditedSource `json:"name,omitempty"` + Enforcement *RepositoryRulesetEditedSource `json:"enforcement,omitempty"` + Conditions *RepositoryRulesetEditedConditions `json:"conditions,omitempty"` + Rules *RepositoryRulesetEditedRules `json:"rules,omitempty"` } -type RepositoryRuleSetEditedSource struct { +type RepositoryRulesetEditedSource struct { From *string `json:"from,omitempty"` } -type RepositoryRuleSetEditedSources struct { +type RepositoryRulesetEditedSources struct { From []*string `json:"from,omitempty"` } -type RepositoryRuleSetEditedConditions struct { - Added []*RepositoryRuleSetRefCondition `json:"added,omitempty"` - Deleted []*RepositoryRuleSetRefCondition `json:"deleted,omitempty"` - Updated []*RepositoryRuleSetEditedUpdatedConditions `json:"updated,omitempty"` +type RepositoryRulesetEditedConditions struct { + Added []*RepositoryRulesetRefCondition `json:"added,omitempty"` + Deleted []*RepositoryRulesetRefCondition `json:"deleted,omitempty"` + Updated []*RepositoryRulesetEditedUpdatedConditions `json:"updated,omitempty"` } -type RepositoryRuleSetEditedRules struct { - Added []*RepositoryRuleSetRule `json:"added,omitempty"` - Deleted []*RepositoryRuleSetRule `json:"deleted,omitempty"` - Updated []*RepositoryRuleSetUpdatedRules `json:"updated,omitempty"` +type RepositoryRulesetEditedRules struct { + Added []*RepositoryRulesetRule `json:"added,omitempty"` + Deleted []*RepositoryRulesetRule `json:"deleted,omitempty"` + Updated []*RepositoryRulesetUpdatedRules `json:"updated,omitempty"` } -type RepositoryRuleSetRefCondition struct { +type RepositoryRulesetRefCondition struct { RefName *RulesetRefConditionParameters `json:"ref_name,omitempty"` } -type RepositoryRuleSetEditedUpdatedConditions struct { - Condition *RepositoryRuleSetRefCondition `json:"condition,omitempty"` - Changes *RepositoryRuleSetUpdatedConditionsEdited `json:"changes,omitempty"` +type RepositoryRulesetEditedUpdatedConditions struct { + Condition *RepositoryRulesetRefCondition `json:"condition,omitempty"` + Changes *RepositoryRulesetUpdatedConditionsEdited `json:"changes,omitempty"` } -type RepositoryRuleSetUpdatedConditionsEdited struct { - ConditionType *RepositoryRuleSetEditedSource `json:"condition_type,omitempty"` - Target *RepositoryRuleSetEditedSource `json:"target,omitempty"` - Include *RepositoryRuleSetEditedSources `json:"include,omitempty"` - Exclude *RepositoryRuleSetEditedSources `json:"exclude,omitempty"` +type RepositoryRulesetUpdatedConditionsEdited struct { + ConditionType *RepositoryRulesetEditedSource `json:"condition_type,omitempty"` + Target *RepositoryRulesetEditedSource `json:"target,omitempty"` + Include *RepositoryRulesetEditedSources `json:"include,omitempty"` + Exclude *RepositoryRulesetEditedSources `json:"exclude,omitempty"` } -type RepositoryRuleSetUpdatedRules struct { - Rule *RepositoryRuleSetRule `json:"rule,omitempty"` - Changes *RepositoryRuleSetEditedRuleChanges `json:"changes,omitempty"` +type RepositoryRulesetUpdatedRules struct { + Rule *RepositoryRulesetRule `json:"rule,omitempty"` + Changes *RepositoryRulesetEditedRuleChanges `json:"changes,omitempty"` } -type RepositoryRuleSetEditedRuleChanges struct { - Configuration *RepositoryRuleSetEditedSources `json:"configuration,omitempty"` - RuleType *RepositoryRuleSetEditedSources `json:"rule_type,omitempty"` - Pattern *RepositoryRuleSetEditedSources `json:"pattern,omitempty"` +type RepositoryRulesetEditedRuleChanges struct { + Configuration *RepositoryRulesetEditedSources `json:"configuration,omitempty"` + RuleType *RepositoryRulesetEditedSources `json:"rule_type,omitempty"` + Pattern *RepositoryRulesetEditedSources `json:"pattern,omitempty"` } -type RepositoryRuleSet struct { +type RepositoryRuleset struct { ID int64 `json:"id"` Name string `json:"name"` //Possible values for target: "branch", "tag", "push" @@ -235,114 +235,114 @@ type RepositoryRuleSet struct { // Possible values for current user can bypass: "always", "pull_requests_only", "never" CurrentUserCanBypass *string `json:"current_user_can_bypass,omitempty"` NodeID *string `json:"node_id,omitempty"` - Links *RepositoryRuleSetLink `json:"_links,omitempty"` + Links *RepositoryRulesetLink `json:"_links,omitempty"` Conditions *json.RawMessage `json:"conditions,omitempty"` - Rules []*RepositoryRuleSetRule `json:"rules,omitempty"` + Rules []*RepositoryRulesetRule `json:"rules,omitempty"` CreatedAt *Timestamp `json:"created_at,omitempty"` UpdatedAt *Timestamp `json:"updated_at,omitempty"` } -type RepositoryRuleSetRule struct { - Creation *RepositoryRuleSetRuleType `json:"creation,omitempty"` - Update *RepositoryRuleSetUpdateRule `json:"update,omitempty"` - Deletion *RepositoryRuleSetRuleType `json:"deletion,omitempty"` - RequireLinearHistory *RepositoryRuleSetRuleType `json:"required_linear_history,omitempty"` - MergeQueue *RepositoryRuleSetMergeQueueRule `json:"merge_queue,omitempty"` - RequireDeployments *RepositoryRuleSetRequireDeploymentsRule `json:"required_deployments,omitempty"` - RequiredSignatures *RepositoryRuleSetRuleType `json:"required_signatures,omitempty"` - PullRequest *RepositoryRuleSetPullRequestRule `json:"pull_request,omitempty"` - RequiredStatusChecks *RepositoryRuleSetRequiredStatusChecksRule `json:"required_status_checks,omitempty"` - NonFastForward *RepositoryRuleSetRuleType `json:"non_fast_forward,omitempty"` - CommitMessagePattern *RepositoryRuleSetPatternRule `json:"commit_message_pattern,omitempty"` - CommitAuthorEmailPattern *RepositoryRuleSetPatternRule `json:"commit_author_email_pattern,omitempty"` - CommitterEmailPattern *RepositoryRuleSetPatternRule `json:"committer_email_pattern,omitempty"` - BranchNamePattern *RepositoryRuleSetPatternRule `json:"branch_name_pattern,omitempty"` - TagNamePattern *RepositoryRuleSetPatternRule `json:"tag_name_pattern,omitempty"` - FilePathRestriction *RepositoryRuleSetFilePathRestrictionRule `json:"file_path_restriction,omitempty"` - MaxFilePathLength *RepositoryRuleSetMaxFilePathLengthRule `json:"max_file_path_length,omitempty"` - FileExtensionRestriction *RepositoryRuleSetFileExtensionRestrictionRule `json:"file_extension_restriction,omitempty"` - MaxFileSize *RepositoryRuleSetMaxFileSizeRule `json:"max_file_size,omitempty"` - Workflows *RepositoryRuleSetWorkflowsRule `json:"workflows,omitempty"` - CodeScanning *RepositoryRuleSetCodeScanningRule `json:"code_scanning,omitempty"` -} -type RepositoryRuleSetLink struct { +type RepositoryRulesetRule struct { + Creation *RepositoryRulesetRuleType `json:"creation,omitempty"` + Update *RepositoryRulesetUpdateRule `json:"update,omitempty"` + Deletion *RepositoryRulesetRuleType `json:"deletion,omitempty"` + RequireLinearHistory *RepositoryRulesetRuleType `json:"required_linear_history,omitempty"` + MergeQueue *RepositoryRulesetMergeQueueRule `json:"merge_queue,omitempty"` + RequireDeployments *RepositoryRulesetRequireDeploymentsRule `json:"required_deployments,omitempty"` + RequiredSignatures *RepositoryRulesetRuleType `json:"required_signatures,omitempty"` + PullRequest *RepositoryRulesetPullRequestRule `json:"pull_request,omitempty"` + RequiredStatusChecks *RepositoryRulesetRequiredStatusChecksRule `json:"required_status_checks,omitempty"` + NonFastForward *RepositoryRulesetRuleType `json:"non_fast_forward,omitempty"` + CommitMessagePattern *RepositoryRulesetPatternRule `json:"commit_message_pattern,omitempty"` + CommitAuthorEmailPattern *RepositoryRulesetPatternRule `json:"commit_author_email_pattern,omitempty"` + CommitterEmailPattern *RepositoryRulesetPatternRule `json:"committer_email_pattern,omitempty"` + BranchNamePattern *RepositoryRulesetPatternRule `json:"branch_name_pattern,omitempty"` + TagNamePattern *RepositoryRulesetPatternRule `json:"tag_name_pattern,omitempty"` + FilePathRestriction *RepositoryRulesetFilePathRestrictionRule `json:"file_path_restriction,omitempty"` + MaxFilePathLength *RepositoryRulesetMaxFilePathLengthRule `json:"max_file_path_length,omitempty"` + FileExtensionRestriction *RepositoryRulesetFileExtensionRestrictionRule `json:"file_extension_restriction,omitempty"` + MaxFileSize *RepositoryRulesetMaxFileSizeRule `json:"max_file_size,omitempty"` + Workflows *RepositoryRulesetWorkflowsRule `json:"workflows,omitempty"` + CodeScanning *RepositoryRulesetCodeScanningRule `json:"code_scanning,omitempty"` +} +type RepositoryRulesetLink struct { Self *RulesetLink `json:"self,omitempty"` HTML *RulesetLink `json:"html,omitempty"` } -type RepositoryRuleSetRuleType struct { +type RepositoryRulesetRuleType struct { Type string `json:"type"` } -type RepositoryRuleSetUpdateRule struct { +type RepositoryRulesetUpdateRule struct { //Value for Type: "update" Type string `json:"type"` Parameters *UpdateAllowsFetchAndMergeRuleParameters `json:"parameters,omitempty"` } -type RepositoryRuleSetMergeQueueRule struct { +type RepositoryRulesetMergeQueueRule struct { //Value for Type: "merge_queue" Type string `json:"type"` Parameters *MergeQueueRuleParameters `json:"parameters,omitempty"` } -type RepositoryRuleSetRequireDeploymentsRule struct { +type RepositoryRulesetRequireDeploymentsRule struct { //Value for Type: "required_deployments" Type string `json:"type"` Parameters *RequiredDeploymentEnvironmentsRuleParameters `json:"parameters,omitempty"` } -type RepositoryRuleSetPullRequestRule struct { +type RepositoryRulesetPullRequestRule struct { //Value for Type: "pull_request" Type string `json:"type"` Parameters *PullRequestRuleParameters `json:"parameters,omitempty"` } -type RepositoryRuleSetRequiredStatusChecksRule struct { +type RepositoryRulesetRequiredStatusChecksRule struct { //Value for Type: "required_status_checks" Type string `json:"type"` Parameters *RequiredStatusChecksRuleParameters `json:"parameters,omitempty"` } -type RepositoryRuleSetPatternRule struct { +type RepositoryRulesetPatternRule struct { Type string `json:"type"` Parameters *RulePatternParameters `json:"parameters,omitempty"` } -type RepositoryRuleSetFilePathRestrictionRule struct { +type RepositoryRulesetFilePathRestrictionRule struct { //Value for Type: "file_path_restriction" Type string `json:"type"` Parameters *RuleFileParameters `json:"parameters,omitempty"` } -type RepositoryRuleSetMaxFilePathLengthRule struct { +type RepositoryRulesetMaxFilePathLengthRule struct { //Value for Type: "max_file_path_length" Type string `json:"type"` Parameters *RuleMaxFilePathLengthParameters `json:"parameters,omitempty"` } -type RepositoryRuleSetFileExtensionRestrictionRule struct { +type RepositoryRulesetFileExtensionRestrictionRule struct { //Value for Type: "file_extension_restriction" Type string `json:"type"` Parameters *RuleFileExtensionRestrictionParameters `json:"parameters,omitempty"` } -type RepositoryRuleSetMaxFileSizeRule struct { +type RepositoryRulesetMaxFileSizeRule struct { //Value for Type: "max_file_size" Type string `json:"type"` Parameters *RuleMaxFileSizeParameters `json:"parameters,omitempty"` } -type RepositoryRuleSetWorkflowsRule struct { +type RepositoryRulesetWorkflowsRule struct { //Value for Type: "workflows" Type string `json:"type"` Parameters *RequiredWorkflowsRuleParameters `json:"parameters,omitempty"` } -type RepositoryRuleSetCodeScanningRule struct { +type RepositoryRulesetCodeScanningRule struct { //Value for Type:"code_scanning" Type string `json:"type"` Parameters *RuleCodeScanningParameters `json:"parameters,omitempty"` From de53c18908bf06aa2571b92573a2c8203d939cb2 Mon Sep 17 00:00:00 2001 From: Udit Date: Mon, 14 Oct 2024 14:47:08 +0530 Subject: [PATCH 05/42] added comment for all the structs created --- github/event_types.go | 2 +- github/repos_rules.go | 30 ++++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/github/event_types.go b/github/event_types.go index be8008dacab..fe5bd8dc10e 100644 --- a/github/event_types.go +++ b/github/event_types.go @@ -1505,7 +1505,7 @@ type RepositoryImportEvent struct { Sender *User `json:"sender,omitempty"` } -// RepositoryRulesetEvent triggers whenever there is a change to the repository's ruleset configuration. +// RepositoryRulesetEvent triggers whenever there is a change to the repository's ruleset configuration. // This can include updates to protection rules, required status checks, code owners, or other related configurations. // GitHub API docs: https://docs.github.com/en/webhooks/webhook-events-and-payloads#repository_ruleset type RepositoryRulesetEvent struct { diff --git a/github/repos_rules.go b/github/repos_rules.go index 780644a900a..8a262e876fe 100644 --- a/github/repos_rules.go +++ b/github/repos_rules.go @@ -168,6 +168,7 @@ type RepositoryRule struct { RulesetID int64 `json:"ruleset_id"` } +// RepositoryRulesetEditedChanges represents the changes made to a repository ruleset type RepositoryRulesetEditedChanges struct { Name *RepositoryRulesetEditedSource `json:"name,omitempty"` Enforcement *RepositoryRulesetEditedSource `json:"enforcement,omitempty"` @@ -175,35 +176,42 @@ type RepositoryRulesetEditedChanges struct { Rules *RepositoryRulesetEditedRules `json:"rules,omitempty"` } +// RepositoryRulesetEditedSource represents a source change for the ruleset. type RepositoryRulesetEditedSource struct { From *string `json:"from,omitempty"` } +// RepositoryRulesetEditedSources represents multiple source changes for the ruleset. type RepositoryRulesetEditedSources struct { From []*string `json:"from,omitempty"` } +// RepositoryRulesetEditedConditions holds changes to conditions in a ruleset. type RepositoryRulesetEditedConditions struct { Added []*RepositoryRulesetRefCondition `json:"added,omitempty"` Deleted []*RepositoryRulesetRefCondition `json:"deleted,omitempty"` Updated []*RepositoryRulesetEditedUpdatedConditions `json:"updated,omitempty"` } +// RepositoryRulesetEditedRules holds changes to rules in a ruleset. type RepositoryRulesetEditedRules struct { Added []*RepositoryRulesetRule `json:"added,omitempty"` Deleted []*RepositoryRulesetRule `json:"deleted,omitempty"` Updated []*RepositoryRulesetUpdatedRules `json:"updated,omitempty"` } +// RepositoryRulesetRefCondition represents a reference condition for the ruleset. type RepositoryRulesetRefCondition struct { RefName *RulesetRefConditionParameters `json:"ref_name,omitempty"` } +// RepositoryRulesetEditedUpdatedConditions holds updates to conditions in a ruleset. type RepositoryRulesetEditedUpdatedConditions struct { Condition *RepositoryRulesetRefCondition `json:"condition,omitempty"` Changes *RepositoryRulesetUpdatedConditionsEdited `json:"changes,omitempty"` } +// RepositoryRulesetUpdatedConditionsEdited holds the edited updates to conditions in a ruleset. type RepositoryRulesetUpdatedConditionsEdited struct { ConditionType *RepositoryRulesetEditedSource `json:"condition_type,omitempty"` Target *RepositoryRulesetEditedSource `json:"target,omitempty"` @@ -211,16 +219,20 @@ type RepositoryRulesetUpdatedConditionsEdited struct { Exclude *RepositoryRulesetEditedSources `json:"exclude,omitempty"` } +// RepositoryRulesetUpdatedRules holds updates to rules in a ruleset. type RepositoryRulesetUpdatedRules struct { Rule *RepositoryRulesetRule `json:"rule,omitempty"` Changes *RepositoryRulesetEditedRuleChanges `json:"changes,omitempty"` } +// RepositoryRulesetEditedRuleChanges holds changes made to a rule in a ruleset. type RepositoryRulesetEditedRuleChanges struct { Configuration *RepositoryRulesetEditedSources `json:"configuration,omitempty"` RuleType *RepositoryRulesetEditedSources `json:"rule_type,omitempty"` Pattern *RepositoryRulesetEditedSources `json:"pattern,omitempty"` } + +// RepositoryRuleset represents the structure of a ruleset associated with a GitHub repository. type RepositoryRuleset struct { ID int64 `json:"id"` Name string `json:"name"` @@ -242,6 +254,7 @@ type RepositoryRuleset struct { UpdatedAt *Timestamp `json:"updated_at,omitempty"` } +// RepositoryRulesetRule represents indivisual rules which are present in a repository's ruleset type RepositoryRulesetRule struct { Creation *RepositoryRulesetRuleType `json:"creation,omitempty"` Update *RepositoryRulesetUpdateRule `json:"update,omitempty"` @@ -265,33 +278,40 @@ type RepositoryRulesetRule struct { Workflows *RepositoryRulesetWorkflowsRule `json:"workflows,omitempty"` CodeScanning *RepositoryRulesetCodeScanningRule `json:"code_scanning,omitempty"` } + +// RepositoryRulesetLink represents Links assosiated with a repository's rulesets. These links are used to provide more information about the ruleset type RepositoryRulesetLink struct { Self *RulesetLink `json:"self,omitempty"` HTML *RulesetLink `json:"html,omitempty"` } +// RepositoryRulesetRuleType represents the type of a ruleset rule. type RepositoryRulesetRuleType struct { Type string `json:"type"` } +// RepositoryRulesetUpdateRule defines an update rule for the repository. type RepositoryRulesetUpdateRule struct { //Value for Type: "update" Type string `json:"type"` Parameters *UpdateAllowsFetchAndMergeRuleParameters `json:"parameters,omitempty"` } +// RepositoryRulesetMergeQueueRule defines a merge queue rule for the repository. type RepositoryRulesetMergeQueueRule struct { //Value for Type: "merge_queue" Type string `json:"type"` Parameters *MergeQueueRuleParameters `json:"parameters,omitempty"` } +// RepositoryRulesetRequireDeploymentsRule defines a rule for required deployments. type RepositoryRulesetRequireDeploymentsRule struct { //Value for Type: "required_deployments" Type string `json:"type"` Parameters *RequiredDeploymentEnvironmentsRuleParameters `json:"parameters,omitempty"` } +// RepositoryRulesetPullRequestRule defines a rule for pull requests. type RepositoryRulesetPullRequestRule struct { //Value for Type: "pull_request" @@ -299,6 +319,7 @@ type RepositoryRulesetPullRequestRule struct { Parameters *PullRequestRuleParameters `json:"parameters,omitempty"` } +// RepositoryRulesetRequiredStatusChecksRule defines a rule for required status checks. type RepositoryRulesetRequiredStatusChecksRule struct { //Value for Type: "required_status_checks" @@ -306,17 +327,20 @@ type RepositoryRulesetRequiredStatusChecksRule struct { Parameters *RequiredStatusChecksRuleParameters `json:"parameters,omitempty"` } +// RepositoryRulesetPatternRule defines a pattern rule for the repository. type RepositoryRulesetPatternRule struct { Type string `json:"type"` Parameters *RulePatternParameters `json:"parameters,omitempty"` } +// RepositoryRulesetFilePathRestrictionRule defines a file path restriction rule for the repository. type RepositoryRulesetFilePathRestrictionRule struct { //Value for Type: "file_path_restriction" Type string `json:"type"` Parameters *RuleFileParameters `json:"parameters,omitempty"` } +// RepositoryRulesetMaxFilePathLengthRule defines a maximum file path length rule for the repository. type RepositoryRulesetMaxFilePathLengthRule struct { //Value for Type: "max_file_path_length" @@ -324,34 +348,40 @@ type RepositoryRulesetMaxFilePathLengthRule struct { Parameters *RuleMaxFilePathLengthParameters `json:"parameters,omitempty"` } +// RepositoryRulesetFileExtensionRestrictionRule defines a file extension restriction rule for the repository. type RepositoryRulesetFileExtensionRestrictionRule struct { //Value for Type: "file_extension_restriction" Type string `json:"type"` Parameters *RuleFileExtensionRestrictionParameters `json:"parameters,omitempty"` } +// RepositoryRulesetMaxFileSizeRule defines a maximum file size rule for the repository. type RepositoryRulesetMaxFileSizeRule struct { //Value for Type: "max_file_size" Type string `json:"type"` Parameters *RuleMaxFileSizeParameters `json:"parameters,omitempty"` } +// RepositoryRulesetWorkflowsRule defines a workflow rule for the repository. type RepositoryRulesetWorkflowsRule struct { //Value for Type: "workflows" Type string `json:"type"` Parameters *RequiredWorkflowsRuleParameters `json:"parameters,omitempty"` } +// RepositoryRulesetCodeScanningRule defines a code scanning rule for the repository. type RepositoryRulesetCodeScanningRule struct { //Value for Type:"code_scanning" Type string `json:"type"` Parameters *RuleCodeScanningParameters `json:"parameters,omitempty"` } +// RuleCodeScanningParameters defines parameters for code scanning rules. type RuleCodeScanningParameters struct { CodeScanningTools []CodeScanningTool `json:"code_scanning_tools"` } +// CodeScanningTool defines a specific tool used for code scanning. type CodeScanningTool struct { AlertsThreshold string `json:"alerts_threshold"` SecurityAlertsThreshold string `json:"security_alerts_threshold"` From ab4bf59e17d429926b1ca5464fbc63dde31fb046 Mon Sep 17 00:00:00 2001 From: Udit Date: Mon, 14 Oct 2024 20:11:51 +0530 Subject: [PATCH 06/42] fixed minor bugs and linting errors --- github/event_types_test.go | 12 ++++++------ github/github-accessors.go | 8 -------- github/github-accessors_test.go | 10 ---------- github/repos_rules.go | 8 ++++---- 4 files changed, 10 insertions(+), 28 deletions(-) diff --git a/github/event_types_test.go b/github/event_types_test.go index 7e0dd4743d5..5c5f1096c4f 100644 --- a/github/event_types_test.go +++ b/github/event_types_test.go @@ -9614,7 +9614,7 @@ func TestRepositoryRulesetEvent_Marshal(t *testing.T) { HRef: String("href"), }, }, - Conditions: (*json.RawMessage)(&jsonMsg), + Conditions: json.RawMessage(jsonMsg), Rules: []*RepositoryRulesetRule{ { Creation: &RepositoryRulesetRuleType{ @@ -9811,10 +9811,10 @@ func TestRepositoryRulesetEvent_Marshal(t *testing.T) { From: String("t"), }, Include: &RepositoryRulesetEditedSources{ - From: []*string{String("from")}, + From: []string{"from"}, }, Exclude: &RepositoryRulesetEditedSources{ - From: []*string{String("to")}, + From: []string{"to"}, }, }, }, @@ -10284,13 +10284,13 @@ func TestRepositoryRulesetEvent_Marshal(t *testing.T) { }, Changes: &RepositoryRulesetEditedRuleChanges{ Configuration: &RepositoryRulesetEditedSources{ - From: []*string{String("from")}, + From: []string{"from"}, }, RuleType: &RepositoryRulesetEditedSources{ - From: []*string{String("from")}, + From: []string{"from"}, }, Pattern: &RepositoryRulesetEditedSources{ - From: []*string{String("from")}, + From: []string{"from"}, }, }, }, diff --git a/github/github-accessors.go b/github/github-accessors.go index 1131f45dd47..c7629bf0ea7 100644 --- a/github/github-accessors.go +++ b/github/github-accessors.go @@ -20606,14 +20606,6 @@ func (r *RepositoryRule) GetParameters() json.RawMessage { return *r.Parameters } -// GetConditions returns the Conditions field if it's non-nil, zero value otherwise. -func (r *RepositoryRuleset) GetConditions() json.RawMessage { - if r == nil || r.Conditions == nil { - return json.RawMessage{} - } - return *r.Conditions -} - // GetCreatedAt returns the CreatedAt field if it's non-nil, zero value otherwise. func (r *RepositoryRuleset) GetCreatedAt() Timestamp { if r == nil || r.CreatedAt == nil { diff --git a/github/github-accessors_test.go b/github/github-accessors_test.go index 198ed5db249..d42956b02cd 100644 --- a/github/github-accessors_test.go +++ b/github/github-accessors_test.go @@ -23913,16 +23913,6 @@ func TestRepositoryRule_GetParameters(tt *testing.T) { r.GetParameters() } -func TestRepositoryRuleset_GetConditions(tt *testing.T) { - var zeroValue json.RawMessage - r := &RepositoryRuleset{Conditions: &zeroValue} - r.GetConditions() - r = &RepositoryRuleset{} - r.GetConditions() - r = nil - r.GetConditions() -} - func TestRepositoryRuleset_GetCreatedAt(tt *testing.T) { var zeroValue Timestamp r := &RepositoryRuleset{CreatedAt: &zeroValue} diff --git a/github/repos_rules.go b/github/repos_rules.go index 8a262e876fe..e727d2dcc8d 100644 --- a/github/repos_rules.go +++ b/github/repos_rules.go @@ -183,7 +183,7 @@ type RepositoryRulesetEditedSource struct { // RepositoryRulesetEditedSources represents multiple source changes for the ruleset. type RepositoryRulesetEditedSources struct { - From []*string `json:"from,omitempty"` + From []string `json:"from,omitempty"` } // RepositoryRulesetEditedConditions holds changes to conditions in a ruleset. @@ -248,7 +248,7 @@ type RepositoryRuleset struct { CurrentUserCanBypass *string `json:"current_user_can_bypass,omitempty"` NodeID *string `json:"node_id,omitempty"` Links *RepositoryRulesetLink `json:"_links,omitempty"` - Conditions *json.RawMessage `json:"conditions,omitempty"` + Conditions json.RawMessage `json:"conditions,omitempty"` Rules []*RepositoryRulesetRule `json:"rules,omitempty"` CreatedAt *Timestamp `json:"created_at,omitempty"` UpdatedAt *Timestamp `json:"updated_at,omitempty"` @@ -279,7 +279,7 @@ type RepositoryRulesetRule struct { CodeScanning *RepositoryRulesetCodeScanningRule `json:"code_scanning,omitempty"` } -// RepositoryRulesetLink represents Links assosiated with a repository's rulesets. These links are used to provide more information about the ruleset +// RepositoryRulesetLink represents Links associated with a repository's rulesets. These links are used to provide more information about the ruleset type RepositoryRulesetLink struct { Self *RulesetLink `json:"self,omitempty"` HTML *RulesetLink `json:"html,omitempty"` @@ -378,7 +378,7 @@ type RepositoryRulesetCodeScanningRule struct { // RuleCodeScanningParameters defines parameters for code scanning rules. type RuleCodeScanningParameters struct { - CodeScanningTools []CodeScanningTool `json:"code_scanning_tools"` + CodeScanningTools []CodeScanningTool `json:"code_scanning_tools,omitempty"` } // CodeScanningTool defines a specific tool used for code scanning. From 7f9928fc88f320e036fad9beb7b3398302b1fef3 Mon Sep 17 00:00:00 2001 From: Udit Date: Mon, 14 Oct 2024 20:49:48 +0530 Subject: [PATCH 07/42] update CodeScanningTools to slice of pointers --- github/event_types_test.go | 8 ++++---- github/repos_rules.go | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/github/event_types_test.go b/github/event_types_test.go index 5c5f1096c4f..89da52916f1 100644 --- a/github/event_types_test.go +++ b/github/event_types_test.go @@ -9759,7 +9759,7 @@ func TestRepositoryRulesetEvent_Marshal(t *testing.T) { CodeScanning: &RepositoryRulesetCodeScanningRule{ Type: "code_scanning", Parameters: &RuleCodeScanningParameters{ - CodeScanningTools: []CodeScanningTool{{ + CodeScanningTools: []*CodeScanningTool{{ AlertsThreshold: "alert", SecurityAlertsThreshold: "security", Tool: "tool", @@ -9966,7 +9966,7 @@ func TestRepositoryRulesetEvent_Marshal(t *testing.T) { CodeScanning: &RepositoryRulesetCodeScanningRule{ Type: "code_scanning", Parameters: &RuleCodeScanningParameters{ - CodeScanningTools: []CodeScanningTool{{ + CodeScanningTools: []*CodeScanningTool{{ AlertsThreshold: "alert", SecurityAlertsThreshold: "security", Tool: "tool", @@ -10120,7 +10120,7 @@ func TestRepositoryRulesetEvent_Marshal(t *testing.T) { CodeScanning: &RepositoryRulesetCodeScanningRule{ Type: "code_scanning", Parameters: &RuleCodeScanningParameters{ - CodeScanningTools: []CodeScanningTool{{ + CodeScanningTools: []*CodeScanningTool{{ AlertsThreshold: "alert", SecurityAlertsThreshold: "security", Tool: "tool", @@ -10274,7 +10274,7 @@ func TestRepositoryRulesetEvent_Marshal(t *testing.T) { CodeScanning: &RepositoryRulesetCodeScanningRule{ Type: "code_scanning", Parameters: &RuleCodeScanningParameters{ - CodeScanningTools: []CodeScanningTool{{ + CodeScanningTools: []*CodeScanningTool{{ AlertsThreshold: "alert", SecurityAlertsThreshold: "security", Tool: "tool", diff --git a/github/repos_rules.go b/github/repos_rules.go index e727d2dcc8d..7cc5b98859a 100644 --- a/github/repos_rules.go +++ b/github/repos_rules.go @@ -378,7 +378,7 @@ type RepositoryRulesetCodeScanningRule struct { // RuleCodeScanningParameters defines parameters for code scanning rules. type RuleCodeScanningParameters struct { - CodeScanningTools []CodeScanningTool `json:"code_scanning_tools,omitempty"` + CodeScanningTools []*CodeScanningTool `json:"code_scanning_tools,omitempty"` } // CodeScanningTool defines a specific tool used for code scanning. From 1246f00ce6c424b03003187333d76344c1828199 Mon Sep 17 00:00:00 2001 From: Udit Date: Tue, 15 Oct 2024 09:46:03 +0530 Subject: [PATCH 08/42] added period at the end of comments --- github/repos_rules.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/github/repos_rules.go b/github/repos_rules.go index 7cc5b98859a..58f788a3178 100644 --- a/github/repos_rules.go +++ b/github/repos_rules.go @@ -168,7 +168,7 @@ type RepositoryRule struct { RulesetID int64 `json:"ruleset_id"` } -// RepositoryRulesetEditedChanges represents the changes made to a repository ruleset +// RepositoryRulesetEditedChanges represents the changes made to a repository ruleset. type RepositoryRulesetEditedChanges struct { Name *RepositoryRulesetEditedSource `json:"name,omitempty"` Enforcement *RepositoryRulesetEditedSource `json:"enforcement,omitempty"` @@ -254,7 +254,7 @@ type RepositoryRuleset struct { UpdatedAt *Timestamp `json:"updated_at,omitempty"` } -// RepositoryRulesetRule represents indivisual rules which are present in a repository's ruleset +// RepositoryRulesetRule represents indivisual rules which are present in a repository's ruleset. type RepositoryRulesetRule struct { Creation *RepositoryRulesetRuleType `json:"creation,omitempty"` Update *RepositoryRulesetUpdateRule `json:"update,omitempty"` @@ -279,7 +279,7 @@ type RepositoryRulesetRule struct { CodeScanning *RepositoryRulesetCodeScanningRule `json:"code_scanning,omitempty"` } -// RepositoryRulesetLink represents Links associated with a repository's rulesets. These links are used to provide more information about the ruleset +// RepositoryRulesetLink represents Links associated with a repository's rulesets. These links are used to provide more information about the ruleset. type RepositoryRulesetLink struct { Self *RulesetLink `json:"self,omitempty"` HTML *RulesetLink `json:"html,omitempty"` From bde7ac73fe01a9816f8561ad1d29cb17dec3d956 Mon Sep 17 00:00:00 2001 From: Glenn Lewis <6598971+gmlewis@users.noreply.github.com> Date: Tue, 15 Oct 2024 08:56:33 -0400 Subject: [PATCH 09/42] Update github/event_types_test.go --- github/event_types_test.go | 1 + 1 file changed, 1 insertion(+) diff --git a/github/event_types_test.go b/github/event_types_test.go index 69dfa4e4d6e..655f97f2ddd 100644 --- a/github/event_types_test.go +++ b/github/event_types_test.go @@ -9507,6 +9507,7 @@ func TestReleaseEvent_Marshal(t *testing.T) { } func TestRepositoryRulesetEvent_Marshal(t *testing.T) { + t.Parallel() testJSONMarshal(t, &RepositoryRulesetEvent{}, "{}") l := make(map[string]interface{}) From 33d8d61eafda0c4294d6813ad7a12c828c7fc5e5 Mon Sep 17 00:00:00 2001 From: Udit Date: Tue, 15 Oct 2024 19:07:14 +0530 Subject: [PATCH 10/42] Fixed comments;Ran latest go generate --- github/event_types.go | 2 + github/github-accessors_test.go | 68 +++++++++++++++++++++++++++++++++ github/repos_rules.go | 22 +++++------ 3 files changed, 81 insertions(+), 11 deletions(-) diff --git a/github/event_types.go b/github/event_types.go index fe5bd8dc10e..64726d77395 100644 --- a/github/event_types.go +++ b/github/event_types.go @@ -1506,7 +1506,9 @@ type RepositoryImportEvent struct { } // RepositoryRulesetEvent triggers whenever there is a change to the repository's ruleset configuration. +// // This can include updates to protection rules, required status checks, code owners, or other related configurations. +// // GitHub API docs: https://docs.github.com/en/webhooks/webhook-events-and-payloads#repository_ruleset type RepositoryRulesetEvent struct { Action *string `json:"action,omitempty"` diff --git a/github/github-accessors_test.go b/github/github-accessors_test.go index dac5f12295b..68048df92b1 100644 --- a/github/github-accessors_test.go +++ b/github/github-accessors_test.go @@ -26809,6 +26809,7 @@ func TestRepositoryRule_GetParameters(tt *testing.T) { } func TestRepositoryRuleset_GetCreatedAt(tt *testing.T) { + tt.Parallel() var zeroValue Timestamp r := &RepositoryRuleset{CreatedAt: &zeroValue} r.GetCreatedAt() @@ -26819,6 +26820,7 @@ func TestRepositoryRuleset_GetCreatedAt(tt *testing.T) { } func TestRepositoryRuleset_GetCurrentUserCanBypass(tt *testing.T) { + tt.Parallel() var zeroValue string r := &RepositoryRuleset{CurrentUserCanBypass: &zeroValue} r.GetCurrentUserCanBypass() @@ -26829,6 +26831,7 @@ func TestRepositoryRuleset_GetCurrentUserCanBypass(tt *testing.T) { } func TestRepositoryRuleset_GetLinks(tt *testing.T) { + tt.Parallel() r := &RepositoryRuleset{} r.GetLinks() r = nil @@ -26836,6 +26839,7 @@ func TestRepositoryRuleset_GetLinks(tt *testing.T) { } func TestRepositoryRuleset_GetNodeID(tt *testing.T) { + tt.Parallel() var zeroValue string r := &RepositoryRuleset{NodeID: &zeroValue} r.GetNodeID() @@ -26846,6 +26850,7 @@ func TestRepositoryRuleset_GetNodeID(tt *testing.T) { } func TestRepositoryRuleset_GetSourceType(tt *testing.T) { + tt.Parallel() var zeroValue string r := &RepositoryRuleset{SourceType: &zeroValue} r.GetSourceType() @@ -26856,6 +26861,7 @@ func TestRepositoryRuleset_GetSourceType(tt *testing.T) { } func TestRepositoryRuleset_GetTarget(tt *testing.T) { + tt.Parallel() var zeroValue string r := &RepositoryRuleset{Target: &zeroValue} r.GetTarget() @@ -26866,6 +26872,7 @@ func TestRepositoryRuleset_GetTarget(tt *testing.T) { } func TestRepositoryRuleset_GetUpdatedAt(tt *testing.T) { + tt.Parallel() var zeroValue Timestamp r := &RepositoryRuleset{UpdatedAt: &zeroValue} r.GetUpdatedAt() @@ -26876,6 +26883,7 @@ func TestRepositoryRuleset_GetUpdatedAt(tt *testing.T) { } func TestRepositoryRulesetCodeScanningRule_GetParameters(tt *testing.T) { + tt.Parallel() r := &RepositoryRulesetCodeScanningRule{} r.GetParameters() r = nil @@ -26883,6 +26891,7 @@ func TestRepositoryRulesetCodeScanningRule_GetParameters(tt *testing.T) { } func TestRepositoryRulesetEditedChanges_GetConditions(tt *testing.T) { + tt.Parallel() r := &RepositoryRulesetEditedChanges{} r.GetConditions() r = nil @@ -26890,6 +26899,7 @@ func TestRepositoryRulesetEditedChanges_GetConditions(tt *testing.T) { } func TestRepositoryRulesetEditedChanges_GetEnforcement(tt *testing.T) { + tt.Parallel() r := &RepositoryRulesetEditedChanges{} r.GetEnforcement() r = nil @@ -26897,6 +26907,7 @@ func TestRepositoryRulesetEditedChanges_GetEnforcement(tt *testing.T) { } func TestRepositoryRulesetEditedChanges_GetName(tt *testing.T) { + tt.Parallel() r := &RepositoryRulesetEditedChanges{} r.GetName() r = nil @@ -26904,6 +26915,7 @@ func TestRepositoryRulesetEditedChanges_GetName(tt *testing.T) { } func TestRepositoryRulesetEditedChanges_GetRules(tt *testing.T) { + tt.Parallel() r := &RepositoryRulesetEditedChanges{} r.GetRules() r = nil @@ -26911,6 +26923,7 @@ func TestRepositoryRulesetEditedChanges_GetRules(tt *testing.T) { } func TestRepositoryRulesetEditedRuleChanges_GetConfiguration(tt *testing.T) { + tt.Parallel() r := &RepositoryRulesetEditedRuleChanges{} r.GetConfiguration() r = nil @@ -26918,6 +26931,7 @@ func TestRepositoryRulesetEditedRuleChanges_GetConfiguration(tt *testing.T) { } func TestRepositoryRulesetEditedRuleChanges_GetPattern(tt *testing.T) { + tt.Parallel() r := &RepositoryRulesetEditedRuleChanges{} r.GetPattern() r = nil @@ -26925,6 +26939,7 @@ func TestRepositoryRulesetEditedRuleChanges_GetPattern(tt *testing.T) { } func TestRepositoryRulesetEditedRuleChanges_GetRuleType(tt *testing.T) { + tt.Parallel() r := &RepositoryRulesetEditedRuleChanges{} r.GetRuleType() r = nil @@ -26932,6 +26947,7 @@ func TestRepositoryRulesetEditedRuleChanges_GetRuleType(tt *testing.T) { } func TestRepositoryRulesetEditedSource_GetFrom(tt *testing.T) { + tt.Parallel() var zeroValue string r := &RepositoryRulesetEditedSource{From: &zeroValue} r.GetFrom() @@ -26942,6 +26958,7 @@ func TestRepositoryRulesetEditedSource_GetFrom(tt *testing.T) { } func TestRepositoryRulesetEditedUpdatedConditions_GetChanges(tt *testing.T) { + tt.Parallel() r := &RepositoryRulesetEditedUpdatedConditions{} r.GetChanges() r = nil @@ -26949,6 +26966,7 @@ func TestRepositoryRulesetEditedUpdatedConditions_GetChanges(tt *testing.T) { } func TestRepositoryRulesetEditedUpdatedConditions_GetCondition(tt *testing.T) { + tt.Parallel() r := &RepositoryRulesetEditedUpdatedConditions{} r.GetCondition() r = nil @@ -26956,6 +26974,7 @@ func TestRepositoryRulesetEditedUpdatedConditions_GetCondition(tt *testing.T) { } func TestRepositoryRulesetEvent_GetAction(tt *testing.T) { + tt.Parallel() var zeroValue string r := &RepositoryRulesetEvent{Action: &zeroValue} r.GetAction() @@ -26966,6 +26985,7 @@ func TestRepositoryRulesetEvent_GetAction(tt *testing.T) { } func TestRepositoryRulesetEvent_GetChanges(tt *testing.T) { + tt.Parallel() r := &RepositoryRulesetEvent{} r.GetChanges() r = nil @@ -26973,6 +26993,7 @@ func TestRepositoryRulesetEvent_GetChanges(tt *testing.T) { } func TestRepositoryRulesetEvent_GetEnterprise(tt *testing.T) { + tt.Parallel() r := &RepositoryRulesetEvent{} r.GetEnterprise() r = nil @@ -26980,6 +27001,7 @@ func TestRepositoryRulesetEvent_GetEnterprise(tt *testing.T) { } func TestRepositoryRulesetEvent_GetInstallation(tt *testing.T) { + tt.Parallel() r := &RepositoryRulesetEvent{} r.GetInstallation() r = nil @@ -26987,6 +27009,7 @@ func TestRepositoryRulesetEvent_GetInstallation(tt *testing.T) { } func TestRepositoryRulesetEvent_GetOrganization(tt *testing.T) { + tt.Parallel() r := &RepositoryRulesetEvent{} r.GetOrganization() r = nil @@ -26994,6 +27017,7 @@ func TestRepositoryRulesetEvent_GetOrganization(tt *testing.T) { } func TestRepositoryRulesetEvent_GetRepository(tt *testing.T) { + tt.Parallel() r := &RepositoryRulesetEvent{} r.GetRepository() r = nil @@ -27001,6 +27025,7 @@ func TestRepositoryRulesetEvent_GetRepository(tt *testing.T) { } func TestRepositoryRulesetEvent_GetRepositoryRuleset(tt *testing.T) { + tt.Parallel() r := &RepositoryRulesetEvent{} r.GetRepositoryRuleset() r = nil @@ -27008,6 +27033,7 @@ func TestRepositoryRulesetEvent_GetRepositoryRuleset(tt *testing.T) { } func TestRepositoryRulesetEvent_GetSender(tt *testing.T) { + tt.Parallel() r := &RepositoryRulesetEvent{} r.GetSender() r = nil @@ -27015,6 +27041,7 @@ func TestRepositoryRulesetEvent_GetSender(tt *testing.T) { } func TestRepositoryRulesetFileExtensionRestrictionRule_GetParameters(tt *testing.T) { + tt.Parallel() r := &RepositoryRulesetFileExtensionRestrictionRule{} r.GetParameters() r = nil @@ -27022,6 +27049,7 @@ func TestRepositoryRulesetFileExtensionRestrictionRule_GetParameters(tt *testing } func TestRepositoryRulesetFilePathRestrictionRule_GetParameters(tt *testing.T) { + tt.Parallel() r := &RepositoryRulesetFilePathRestrictionRule{} r.GetParameters() r = nil @@ -27029,6 +27057,7 @@ func TestRepositoryRulesetFilePathRestrictionRule_GetParameters(tt *testing.T) { } func TestRepositoryRulesetLink_GetHTML(tt *testing.T) { + tt.Parallel() r := &RepositoryRulesetLink{} r.GetHTML() r = nil @@ -27036,6 +27065,7 @@ func TestRepositoryRulesetLink_GetHTML(tt *testing.T) { } func TestRepositoryRulesetLink_GetSelf(tt *testing.T) { + tt.Parallel() r := &RepositoryRulesetLink{} r.GetSelf() r = nil @@ -27043,6 +27073,7 @@ func TestRepositoryRulesetLink_GetSelf(tt *testing.T) { } func TestRepositoryRulesetMaxFilePathLengthRule_GetParameters(tt *testing.T) { + tt.Parallel() r := &RepositoryRulesetMaxFilePathLengthRule{} r.GetParameters() r = nil @@ -27050,6 +27081,7 @@ func TestRepositoryRulesetMaxFilePathLengthRule_GetParameters(tt *testing.T) { } func TestRepositoryRulesetMaxFileSizeRule_GetParameters(tt *testing.T) { + tt.Parallel() r := &RepositoryRulesetMaxFileSizeRule{} r.GetParameters() r = nil @@ -27057,6 +27089,7 @@ func TestRepositoryRulesetMaxFileSizeRule_GetParameters(tt *testing.T) { } func TestRepositoryRulesetMergeQueueRule_GetParameters(tt *testing.T) { + tt.Parallel() r := &RepositoryRulesetMergeQueueRule{} r.GetParameters() r = nil @@ -27064,6 +27097,7 @@ func TestRepositoryRulesetMergeQueueRule_GetParameters(tt *testing.T) { } func TestRepositoryRulesetPatternRule_GetParameters(tt *testing.T) { + tt.Parallel() r := &RepositoryRulesetPatternRule{} r.GetParameters() r = nil @@ -27071,6 +27105,7 @@ func TestRepositoryRulesetPatternRule_GetParameters(tt *testing.T) { } func TestRepositoryRulesetPullRequestRule_GetParameters(tt *testing.T) { + tt.Parallel() r := &RepositoryRulesetPullRequestRule{} r.GetParameters() r = nil @@ -27078,6 +27113,7 @@ func TestRepositoryRulesetPullRequestRule_GetParameters(tt *testing.T) { } func TestRepositoryRulesetRefCondition_GetRefName(tt *testing.T) { + tt.Parallel() r := &RepositoryRulesetRefCondition{} r.GetRefName() r = nil @@ -27085,6 +27121,7 @@ func TestRepositoryRulesetRefCondition_GetRefName(tt *testing.T) { } func TestRepositoryRulesetRequireDeploymentsRule_GetParameters(tt *testing.T) { + tt.Parallel() r := &RepositoryRulesetRequireDeploymentsRule{} r.GetParameters() r = nil @@ -27092,6 +27129,7 @@ func TestRepositoryRulesetRequireDeploymentsRule_GetParameters(tt *testing.T) { } func TestRepositoryRulesetRequiredStatusChecksRule_GetParameters(tt *testing.T) { + tt.Parallel() r := &RepositoryRulesetRequiredStatusChecksRule{} r.GetParameters() r = nil @@ -27099,6 +27137,7 @@ func TestRepositoryRulesetRequiredStatusChecksRule_GetParameters(tt *testing.T) } func TestRepositoryRulesetRule_GetBranchNamePattern(tt *testing.T) { + tt.Parallel() r := &RepositoryRulesetRule{} r.GetBranchNamePattern() r = nil @@ -27106,6 +27145,7 @@ func TestRepositoryRulesetRule_GetBranchNamePattern(tt *testing.T) { } func TestRepositoryRulesetRule_GetCodeScanning(tt *testing.T) { + tt.Parallel() r := &RepositoryRulesetRule{} r.GetCodeScanning() r = nil @@ -27113,6 +27153,7 @@ func TestRepositoryRulesetRule_GetCodeScanning(tt *testing.T) { } func TestRepositoryRulesetRule_GetCommitAuthorEmailPattern(tt *testing.T) { + tt.Parallel() r := &RepositoryRulesetRule{} r.GetCommitAuthorEmailPattern() r = nil @@ -27120,6 +27161,7 @@ func TestRepositoryRulesetRule_GetCommitAuthorEmailPattern(tt *testing.T) { } func TestRepositoryRulesetRule_GetCommitMessagePattern(tt *testing.T) { + tt.Parallel() r := &RepositoryRulesetRule{} r.GetCommitMessagePattern() r = nil @@ -27127,6 +27169,7 @@ func TestRepositoryRulesetRule_GetCommitMessagePattern(tt *testing.T) { } func TestRepositoryRulesetRule_GetCommitterEmailPattern(tt *testing.T) { + tt.Parallel() r := &RepositoryRulesetRule{} r.GetCommitterEmailPattern() r = nil @@ -27134,6 +27177,7 @@ func TestRepositoryRulesetRule_GetCommitterEmailPattern(tt *testing.T) { } func TestRepositoryRulesetRule_GetCreation(tt *testing.T) { + tt.Parallel() r := &RepositoryRulesetRule{} r.GetCreation() r = nil @@ -27141,6 +27185,7 @@ func TestRepositoryRulesetRule_GetCreation(tt *testing.T) { } func TestRepositoryRulesetRule_GetDeletion(tt *testing.T) { + tt.Parallel() r := &RepositoryRulesetRule{} r.GetDeletion() r = nil @@ -27148,6 +27193,7 @@ func TestRepositoryRulesetRule_GetDeletion(tt *testing.T) { } func TestRepositoryRulesetRule_GetFileExtensionRestriction(tt *testing.T) { + tt.Parallel() r := &RepositoryRulesetRule{} r.GetFileExtensionRestriction() r = nil @@ -27155,6 +27201,7 @@ func TestRepositoryRulesetRule_GetFileExtensionRestriction(tt *testing.T) { } func TestRepositoryRulesetRule_GetFilePathRestriction(tt *testing.T) { + tt.Parallel() r := &RepositoryRulesetRule{} r.GetFilePathRestriction() r = nil @@ -27162,6 +27209,7 @@ func TestRepositoryRulesetRule_GetFilePathRestriction(tt *testing.T) { } func TestRepositoryRulesetRule_GetMaxFilePathLength(tt *testing.T) { + tt.Parallel() r := &RepositoryRulesetRule{} r.GetMaxFilePathLength() r = nil @@ -27169,6 +27217,7 @@ func TestRepositoryRulesetRule_GetMaxFilePathLength(tt *testing.T) { } func TestRepositoryRulesetRule_GetMaxFileSize(tt *testing.T) { + tt.Parallel() r := &RepositoryRulesetRule{} r.GetMaxFileSize() r = nil @@ -27176,6 +27225,7 @@ func TestRepositoryRulesetRule_GetMaxFileSize(tt *testing.T) { } func TestRepositoryRulesetRule_GetMergeQueue(tt *testing.T) { + tt.Parallel() r := &RepositoryRulesetRule{} r.GetMergeQueue() r = nil @@ -27183,6 +27233,7 @@ func TestRepositoryRulesetRule_GetMergeQueue(tt *testing.T) { } func TestRepositoryRulesetRule_GetNonFastForward(tt *testing.T) { + tt.Parallel() r := &RepositoryRulesetRule{} r.GetNonFastForward() r = nil @@ -27190,6 +27241,7 @@ func TestRepositoryRulesetRule_GetNonFastForward(tt *testing.T) { } func TestRepositoryRulesetRule_GetPullRequest(tt *testing.T) { + tt.Parallel() r := &RepositoryRulesetRule{} r.GetPullRequest() r = nil @@ -27197,6 +27249,7 @@ func TestRepositoryRulesetRule_GetPullRequest(tt *testing.T) { } func TestRepositoryRulesetRule_GetRequireDeployments(tt *testing.T) { + tt.Parallel() r := &RepositoryRulesetRule{} r.GetRequireDeployments() r = nil @@ -27204,6 +27257,7 @@ func TestRepositoryRulesetRule_GetRequireDeployments(tt *testing.T) { } func TestRepositoryRulesetRule_GetRequiredSignatures(tt *testing.T) { + tt.Parallel() r := &RepositoryRulesetRule{} r.GetRequiredSignatures() r = nil @@ -27211,6 +27265,7 @@ func TestRepositoryRulesetRule_GetRequiredSignatures(tt *testing.T) { } func TestRepositoryRulesetRule_GetRequiredStatusChecks(tt *testing.T) { + tt.Parallel() r := &RepositoryRulesetRule{} r.GetRequiredStatusChecks() r = nil @@ -27218,6 +27273,7 @@ func TestRepositoryRulesetRule_GetRequiredStatusChecks(tt *testing.T) { } func TestRepositoryRulesetRule_GetRequireLinearHistory(tt *testing.T) { + tt.Parallel() r := &RepositoryRulesetRule{} r.GetRequireLinearHistory() r = nil @@ -27225,6 +27281,7 @@ func TestRepositoryRulesetRule_GetRequireLinearHistory(tt *testing.T) { } func TestRepositoryRulesetRule_GetTagNamePattern(tt *testing.T) { + tt.Parallel() r := &RepositoryRulesetRule{} r.GetTagNamePattern() r = nil @@ -27232,6 +27289,7 @@ func TestRepositoryRulesetRule_GetTagNamePattern(tt *testing.T) { } func TestRepositoryRulesetRule_GetUpdate(tt *testing.T) { + tt.Parallel() r := &RepositoryRulesetRule{} r.GetUpdate() r = nil @@ -27239,6 +27297,7 @@ func TestRepositoryRulesetRule_GetUpdate(tt *testing.T) { } func TestRepositoryRulesetRule_GetWorkflows(tt *testing.T) { + tt.Parallel() r := &RepositoryRulesetRule{} r.GetWorkflows() r = nil @@ -27246,6 +27305,7 @@ func TestRepositoryRulesetRule_GetWorkflows(tt *testing.T) { } func TestRepositoryRulesetUpdatedConditionsEdited_GetConditionType(tt *testing.T) { + tt.Parallel() r := &RepositoryRulesetUpdatedConditionsEdited{} r.GetConditionType() r = nil @@ -27253,6 +27313,7 @@ func TestRepositoryRulesetUpdatedConditionsEdited_GetConditionType(tt *testing.T } func TestRepositoryRulesetUpdatedConditionsEdited_GetExclude(tt *testing.T) { + tt.Parallel() r := &RepositoryRulesetUpdatedConditionsEdited{} r.GetExclude() r = nil @@ -27260,6 +27321,7 @@ func TestRepositoryRulesetUpdatedConditionsEdited_GetExclude(tt *testing.T) { } func TestRepositoryRulesetUpdatedConditionsEdited_GetInclude(tt *testing.T) { + tt.Parallel() r := &RepositoryRulesetUpdatedConditionsEdited{} r.GetInclude() r = nil @@ -27267,6 +27329,7 @@ func TestRepositoryRulesetUpdatedConditionsEdited_GetInclude(tt *testing.T) { } func TestRepositoryRulesetUpdatedConditionsEdited_GetTarget(tt *testing.T) { + tt.Parallel() r := &RepositoryRulesetUpdatedConditionsEdited{} r.GetTarget() r = nil @@ -27274,6 +27337,7 @@ func TestRepositoryRulesetUpdatedConditionsEdited_GetTarget(tt *testing.T) { } func TestRepositoryRulesetUpdatedRules_GetChanges(tt *testing.T) { + tt.Parallel() r := &RepositoryRulesetUpdatedRules{} r.GetChanges() r = nil @@ -27281,6 +27345,7 @@ func TestRepositoryRulesetUpdatedRules_GetChanges(tt *testing.T) { } func TestRepositoryRulesetUpdatedRules_GetRule(tt *testing.T) { + tt.Parallel() r := &RepositoryRulesetUpdatedRules{} r.GetRule() r = nil @@ -27288,6 +27353,7 @@ func TestRepositoryRulesetUpdatedRules_GetRule(tt *testing.T) { } func TestRepositoryRulesetUpdateRule_GetParameters(tt *testing.T) { + tt.Parallel() r := &RepositoryRulesetUpdateRule{} r.GetParameters() r = nil @@ -27295,6 +27361,7 @@ func TestRepositoryRulesetUpdateRule_GetParameters(tt *testing.T) { } func TestRepositoryRulesetWorkflowsRule_GetParameters(tt *testing.T) { + tt.Parallel() r := &RepositoryRulesetWorkflowsRule{} r.GetParameters() r = nil @@ -27828,6 +27895,7 @@ func TestRequiredStatusChecksRequest_GetStrict(tt *testing.T) { } func TestRequiredStatusChecksRuleParameters_GetDoNotEnforceOnCreate(tt *testing.T) { + tt.Parallel() var zeroValue bool r := &RequiredStatusChecksRuleParameters{DoNotEnforceOnCreate: &zeroValue} r.GetDoNotEnforceOnCreate() diff --git a/github/repos_rules.go b/github/repos_rules.go index af4fc35affc..1dd8b0b7994 100644 --- a/github/repos_rules.go +++ b/github/repos_rules.go @@ -292,28 +292,28 @@ type RepositoryRulesetRuleType struct { // RepositoryRulesetUpdateRule defines an update rule for the repository. type RepositoryRulesetUpdateRule struct { - //Value for Type: "update" + //Type can be one of: "update". Type string `json:"type"` Parameters *UpdateAllowsFetchAndMergeRuleParameters `json:"parameters,omitempty"` } // RepositoryRulesetMergeQueueRule defines a merge queue rule for the repository. type RepositoryRulesetMergeQueueRule struct { - //Value for Type: "merge_queue" + //Type can be one of: "merge_queue". Type string `json:"type"` Parameters *MergeQueueRuleParameters `json:"parameters,omitempty"` } // RepositoryRulesetRequireDeploymentsRule defines a rule for required deployments. type RepositoryRulesetRequireDeploymentsRule struct { - //Value for Type: "required_deployments" + //Type can be one of: "required_deployments". Type string `json:"type"` Parameters *RequiredDeploymentEnvironmentsRuleParameters `json:"parameters,omitempty"` } // RepositoryRulesetPullRequestRule defines a rule for pull requests. type RepositoryRulesetPullRequestRule struct { - //Value for Type: "pull_request" + //Type can be one of: "pull_request". Type string `json:"type"` Parameters *PullRequestRuleParameters `json:"parameters,omitempty"` @@ -321,7 +321,7 @@ type RepositoryRulesetPullRequestRule struct { // RepositoryRulesetRequiredStatusChecksRule defines a rule for required status checks. type RepositoryRulesetRequiredStatusChecksRule struct { - //Value for Type: "required_status_checks" + //Type can be one of: "required_status_checks". Type string `json:"type"` Parameters *RequiredStatusChecksRuleParameters `json:"parameters,omitempty"` @@ -335,14 +335,14 @@ type RepositoryRulesetPatternRule struct { // RepositoryRulesetFilePathRestrictionRule defines a file path restriction rule for the repository. type RepositoryRulesetFilePathRestrictionRule struct { - //Value for Type: "file_path_restriction" + //Type can be one of: "file_path_restriction". Type string `json:"type"` Parameters *RuleFileParameters `json:"parameters,omitempty"` } // RepositoryRulesetMaxFilePathLengthRule defines a maximum file path length rule for the repository. type RepositoryRulesetMaxFilePathLengthRule struct { - //Value for Type: "max_file_path_length" + //Type can be one of: "max_file_path_length". Type string `json:"type"` Parameters *RuleMaxFilePathLengthParameters `json:"parameters,omitempty"` @@ -350,28 +350,28 @@ type RepositoryRulesetMaxFilePathLengthRule struct { // RepositoryRulesetFileExtensionRestrictionRule defines a file extension restriction rule for the repository. type RepositoryRulesetFileExtensionRestrictionRule struct { - //Value for Type: "file_extension_restriction" + //Type can be one of: "file_extension_restriction". Type string `json:"type"` Parameters *RuleFileExtensionRestrictionParameters `json:"parameters,omitempty"` } // RepositoryRulesetMaxFileSizeRule defines a maximum file size rule for the repository. type RepositoryRulesetMaxFileSizeRule struct { - //Value for Type: "max_file_size" + //Type can be one of: "max_file_size". Type string `json:"type"` Parameters *RuleMaxFileSizeParameters `json:"parameters,omitempty"` } // RepositoryRulesetWorkflowsRule defines a workflow rule for the repository. type RepositoryRulesetWorkflowsRule struct { - //Value for Type: "workflows" + //Type can be one of: "workflows". Type string `json:"type"` Parameters *RequiredWorkflowsRuleParameters `json:"parameters,omitempty"` } // RepositoryRulesetCodeScanningRule defines a code scanning rule for the repository. type RepositoryRulesetCodeScanningRule struct { - //Value for Type:"code_scanning" + //Type can be one of:"code_scanning". Type string `json:"type"` Parameters *RuleCodeScanningParameters `json:"parameters,omitempty"` } From 306c190118469c60dbf6b14af14fa6f6a92ca8a5 Mon Sep 17 00:00:00 2001 From: Glenn Lewis <6598971+gmlewis@users.noreply.github.com> Date: Tue, 15 Oct 2024 10:53:39 -0400 Subject: [PATCH 11/42] Update github/repos_rules.go --- github/repos_rules.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/github/repos_rules.go b/github/repos_rules.go index 1dd8b0b7994..74e6b5359f6 100644 --- a/github/repos_rules.go +++ b/github/repos_rules.go @@ -292,7 +292,7 @@ type RepositoryRulesetRuleType struct { // RepositoryRulesetUpdateRule defines an update rule for the repository. type RepositoryRulesetUpdateRule struct { - //Type can be one of: "update". + // Type can be one of: "update". Type string `json:"type"` Parameters *UpdateAllowsFetchAndMergeRuleParameters `json:"parameters,omitempty"` } From e31e94de2ffec458d86b4a68450ad52908207ef8 Mon Sep 17 00:00:00 2001 From: Glenn Lewis <6598971+gmlewis@users.noreply.github.com> Date: Tue, 15 Oct 2024 10:53:49 -0400 Subject: [PATCH 12/42] Update github/repos_rules.go --- github/repos_rules.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/github/repos_rules.go b/github/repos_rules.go index 74e6b5359f6..6f196cf606f 100644 --- a/github/repos_rules.go +++ b/github/repos_rules.go @@ -299,7 +299,7 @@ type RepositoryRulesetUpdateRule struct { // RepositoryRulesetMergeQueueRule defines a merge queue rule for the repository. type RepositoryRulesetMergeQueueRule struct { - //Type can be one of: "merge_queue". + // Type can be one of: "merge_queue". Type string `json:"type"` Parameters *MergeQueueRuleParameters `json:"parameters,omitempty"` } From 0ca73c99c6066d5cb870e0a3f7759e39e470eb78 Mon Sep 17 00:00:00 2001 From: Glenn Lewis <6598971+gmlewis@users.noreply.github.com> Date: Tue, 15 Oct 2024 10:53:56 -0400 Subject: [PATCH 13/42] Update github/repos_rules.go --- github/repos_rules.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/github/repos_rules.go b/github/repos_rules.go index 6f196cf606f..5416c69a6eb 100644 --- a/github/repos_rules.go +++ b/github/repos_rules.go @@ -306,7 +306,7 @@ type RepositoryRulesetMergeQueueRule struct { // RepositoryRulesetRequireDeploymentsRule defines a rule for required deployments. type RepositoryRulesetRequireDeploymentsRule struct { - //Type can be one of: "required_deployments". + // Type can be one of: "required_deployments". Type string `json:"type"` Parameters *RequiredDeploymentEnvironmentsRuleParameters `json:"parameters,omitempty"` } From b0cd803c21f7371f3ea6b4a624d52a7b247e0ea5 Mon Sep 17 00:00:00 2001 From: Glenn Lewis <6598971+gmlewis@users.noreply.github.com> Date: Tue, 15 Oct 2024 10:54:03 -0400 Subject: [PATCH 14/42] Update github/repos_rules.go --- github/repos_rules.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/github/repos_rules.go b/github/repos_rules.go index 5416c69a6eb..e606d650b6a 100644 --- a/github/repos_rules.go +++ b/github/repos_rules.go @@ -313,7 +313,7 @@ type RepositoryRulesetRequireDeploymentsRule struct { // RepositoryRulesetPullRequestRule defines a rule for pull requests. type RepositoryRulesetPullRequestRule struct { - //Type can be one of: "pull_request". + // Type can be one of: "pull_request". Type string `json:"type"` Parameters *PullRequestRuleParameters `json:"parameters,omitempty"` From aa85db22f933d4f1c40deee9101b88d0743f1a87 Mon Sep 17 00:00:00 2001 From: Glenn Lewis <6598971+gmlewis@users.noreply.github.com> Date: Tue, 15 Oct 2024 10:54:10 -0400 Subject: [PATCH 15/42] Update github/repos_rules.go --- github/repos_rules.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/github/repos_rules.go b/github/repos_rules.go index e606d650b6a..55d68efd519 100644 --- a/github/repos_rules.go +++ b/github/repos_rules.go @@ -321,7 +321,7 @@ type RepositoryRulesetPullRequestRule struct { // RepositoryRulesetRequiredStatusChecksRule defines a rule for required status checks. type RepositoryRulesetRequiredStatusChecksRule struct { - //Type can be one of: "required_status_checks". + // Type can be one of: "required_status_checks". Type string `json:"type"` Parameters *RequiredStatusChecksRuleParameters `json:"parameters,omitempty"` From 1bba0990d8df45993a2900632c5301177d6e94e0 Mon Sep 17 00:00:00 2001 From: Glenn Lewis <6598971+gmlewis@users.noreply.github.com> Date: Tue, 15 Oct 2024 10:54:19 -0400 Subject: [PATCH 16/42] Update github/repos_rules.go --- github/repos_rules.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/github/repos_rules.go b/github/repos_rules.go index 55d68efd519..df60b578fad 100644 --- a/github/repos_rules.go +++ b/github/repos_rules.go @@ -335,7 +335,7 @@ type RepositoryRulesetPatternRule struct { // RepositoryRulesetFilePathRestrictionRule defines a file path restriction rule for the repository. type RepositoryRulesetFilePathRestrictionRule struct { - //Type can be one of: "file_path_restriction". + // Type can be one of: "file_path_restriction". Type string `json:"type"` Parameters *RuleFileParameters `json:"parameters,omitempty"` } From aaaa4b4c6f5f99f0e35361d77167d95d46755d5b Mon Sep 17 00:00:00 2001 From: Glenn Lewis <6598971+gmlewis@users.noreply.github.com> Date: Tue, 15 Oct 2024 10:54:28 -0400 Subject: [PATCH 17/42] Update github/repos_rules.go --- github/repos_rules.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/github/repos_rules.go b/github/repos_rules.go index df60b578fad..c0d7f0f4ff2 100644 --- a/github/repos_rules.go +++ b/github/repos_rules.go @@ -342,7 +342,7 @@ type RepositoryRulesetFilePathRestrictionRule struct { // RepositoryRulesetMaxFilePathLengthRule defines a maximum file path length rule for the repository. type RepositoryRulesetMaxFilePathLengthRule struct { - //Type can be one of: "max_file_path_length". + // Type can be one of: "max_file_path_length". Type string `json:"type"` Parameters *RuleMaxFilePathLengthParameters `json:"parameters,omitempty"` From ee8e3ddabef89f93ef7d6172617fd7a56168a774 Mon Sep 17 00:00:00 2001 From: Glenn Lewis <6598971+gmlewis@users.noreply.github.com> Date: Tue, 15 Oct 2024 10:54:37 -0400 Subject: [PATCH 18/42] Update github/repos_rules.go --- github/repos_rules.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/github/repos_rules.go b/github/repos_rules.go index c0d7f0f4ff2..fd1498e63f8 100644 --- a/github/repos_rules.go +++ b/github/repos_rules.go @@ -350,7 +350,7 @@ type RepositoryRulesetMaxFilePathLengthRule struct { // RepositoryRulesetFileExtensionRestrictionRule defines a file extension restriction rule for the repository. type RepositoryRulesetFileExtensionRestrictionRule struct { - //Type can be one of: "file_extension_restriction". + // Type can be one of: "file_extension_restriction". Type string `json:"type"` Parameters *RuleFileExtensionRestrictionParameters `json:"parameters,omitempty"` } From 0d014ddf67c494a0840a31f0cebdc20a15542b42 Mon Sep 17 00:00:00 2001 From: Glenn Lewis <6598971+gmlewis@users.noreply.github.com> Date: Tue, 15 Oct 2024 10:54:46 -0400 Subject: [PATCH 19/42] Update github/repos_rules.go --- github/repos_rules.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/github/repos_rules.go b/github/repos_rules.go index fd1498e63f8..7c50a28a388 100644 --- a/github/repos_rules.go +++ b/github/repos_rules.go @@ -357,7 +357,7 @@ type RepositoryRulesetFileExtensionRestrictionRule struct { // RepositoryRulesetMaxFileSizeRule defines a maximum file size rule for the repository. type RepositoryRulesetMaxFileSizeRule struct { - //Type can be one of: "max_file_size". + // Type can be one of: "max_file_size". Type string `json:"type"` Parameters *RuleMaxFileSizeParameters `json:"parameters,omitempty"` } From 9bc399bf130acbf5b764d6f2f05c89ae869ed0ca Mon Sep 17 00:00:00 2001 From: Glenn Lewis <6598971+gmlewis@users.noreply.github.com> Date: Tue, 15 Oct 2024 10:54:55 -0400 Subject: [PATCH 20/42] Update github/repos_rules.go --- github/repos_rules.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/github/repos_rules.go b/github/repos_rules.go index 7c50a28a388..9ecd31aa8d1 100644 --- a/github/repos_rules.go +++ b/github/repos_rules.go @@ -364,7 +364,7 @@ type RepositoryRulesetMaxFileSizeRule struct { // RepositoryRulesetWorkflowsRule defines a workflow rule for the repository. type RepositoryRulesetWorkflowsRule struct { - //Type can be one of: "workflows". + // Type can be one of: "workflows". Type string `json:"type"` Parameters *RequiredWorkflowsRuleParameters `json:"parameters,omitempty"` } From 1c316ac803c989debc3ecee932098637251c9fb1 Mon Sep 17 00:00:00 2001 From: Glenn Lewis <6598971+gmlewis@users.noreply.github.com> Date: Tue, 15 Oct 2024 10:55:03 -0400 Subject: [PATCH 21/42] Update github/repos_rules.go --- github/repos_rules.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/github/repos_rules.go b/github/repos_rules.go index 9ecd31aa8d1..e0a3fe3e4bd 100644 --- a/github/repos_rules.go +++ b/github/repos_rules.go @@ -371,7 +371,7 @@ type RepositoryRulesetWorkflowsRule struct { // RepositoryRulesetCodeScanningRule defines a code scanning rule for the repository. type RepositoryRulesetCodeScanningRule struct { - //Type can be one of:"code_scanning". + // Type can be one of:"code_scanning". Type string `json:"type"` Parameters *RuleCodeScanningParameters `json:"parameters,omitempty"` } From 8a711403724baea26f3ff60916e2a236cfc40129 Mon Sep 17 00:00:00 2001 From: Glenn Lewis <6598971+gmlewis@users.noreply.github.com> Date: Tue, 15 Oct 2024 16:04:32 -0400 Subject: [PATCH 22/42] Update github/repos_rules.go Co-authored-by: Oleksandr Redko --- github/repos_rules.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/github/repos_rules.go b/github/repos_rules.go index e0a3fe3e4bd..7ffc4b12ac7 100644 --- a/github/repos_rules.go +++ b/github/repos_rules.go @@ -236,7 +236,7 @@ type RepositoryRulesetEditedRuleChanges struct { type RepositoryRuleset struct { ID int64 `json:"id"` Name string `json:"name"` - //Possible values for target: "branch", "tag", "push" + // Possible values for target: "branch", "tag", "push" Target *string `json:"target,omitempty"` //Possible values for source type: "Repository", "Organization" SourceType *string `json:"source_type,omitempty"` From a446433f7091ff3425a67b744f3460d5324e49b8 Mon Sep 17 00:00:00 2001 From: Glenn Lewis <6598971+gmlewis@users.noreply.github.com> Date: Tue, 15 Oct 2024 16:04:40 -0400 Subject: [PATCH 23/42] Update github/repos_rules.go Co-authored-by: Oleksandr Redko --- github/repos_rules.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/github/repos_rules.go b/github/repos_rules.go index 7ffc4b12ac7..7e146ef4038 100644 --- a/github/repos_rules.go +++ b/github/repos_rules.go @@ -238,7 +238,7 @@ type RepositoryRuleset struct { Name string `json:"name"` // Possible values for target: "branch", "tag", "push" Target *string `json:"target,omitempty"` - //Possible values for source type: "Repository", "Organization" + // Possible values for source type: "Repository", "Organization" SourceType *string `json:"source_type,omitempty"` Source string `json:"source"` // Possible values for enforcement: "disabled", "active", "evaluate" From 16e9f62bdcffa4fe2b547ba6843a0740201eef17 Mon Sep 17 00:00:00 2001 From: Glenn Lewis <6598971+gmlewis@users.noreply.github.com> Date: Tue, 15 Oct 2024 16:04:48 -0400 Subject: [PATCH 24/42] Update github/repos_rules.go Co-authored-by: Oleksandr Redko --- github/repos_rules.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/github/repos_rules.go b/github/repos_rules.go index 7e146ef4038..b4d695d508b 100644 --- a/github/repos_rules.go +++ b/github/repos_rules.go @@ -254,7 +254,7 @@ type RepositoryRuleset struct { UpdatedAt *Timestamp `json:"updated_at,omitempty"` } -// RepositoryRulesetRule represents indivisual rules which are present in a repository's ruleset. +// RepositoryRulesetRule represents individual rules which are present in a repository's ruleset. type RepositoryRulesetRule struct { Creation *RepositoryRulesetRuleType `json:"creation,omitempty"` Update *RepositoryRulesetUpdateRule `json:"update,omitempty"` From 74a9f47c2ccc661b7903e713d83b5a4f6b2ba935 Mon Sep 17 00:00:00 2001 From: Glenn Lewis <6598971+gmlewis@users.noreply.github.com> Date: Tue, 15 Oct 2024 16:05:17 -0400 Subject: [PATCH 25/42] Update github/repos_rules.go Co-authored-by: Oleksandr Redko --- github/repos_rules.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/github/repos_rules.go b/github/repos_rules.go index b4d695d508b..ae5c74fb516 100644 --- a/github/repos_rules.go +++ b/github/repos_rules.go @@ -371,7 +371,7 @@ type RepositoryRulesetWorkflowsRule struct { // RepositoryRulesetCodeScanningRule defines a code scanning rule for the repository. type RepositoryRulesetCodeScanningRule struct { - // Type can be one of:"code_scanning". + // Type can be one of: "code_scanning". Type string `json:"type"` Parameters *RuleCodeScanningParameters `json:"parameters,omitempty"` } From 880258c74a820f3190344ee69af347a0fe250eb5 Mon Sep 17 00:00:00 2001 From: Glenn Lewis <6598971+gmlewis@users.noreply.github.com> Date: Tue, 15 Oct 2024 16:12:24 -0400 Subject: [PATCH 26/42] Update github/repos_rules.go Co-authored-by: Oleksandr Redko --- github/repos_rules.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/github/repos_rules.go b/github/repos_rules.go index ae5c74fb516..f748178153b 100644 --- a/github/repos_rules.go +++ b/github/repos_rules.go @@ -259,7 +259,7 @@ type RepositoryRulesetRule struct { Creation *RepositoryRulesetRuleType `json:"creation,omitempty"` Update *RepositoryRulesetUpdateRule `json:"update,omitempty"` Deletion *RepositoryRulesetRuleType `json:"deletion,omitempty"` - RequireLinearHistory *RepositoryRulesetRuleType `json:"required_linear_history,omitempty"` + RequiredLinearHistory *RepositoryRulesetRuleType `json:"required_linear_history,omitempty"` MergeQueue *RepositoryRulesetMergeQueueRule `json:"merge_queue,omitempty"` RequireDeployments *RepositoryRulesetRequireDeploymentsRule `json:"required_deployments,omitempty"` RequiredSignatures *RepositoryRulesetRuleType `json:"required_signatures,omitempty"` From 1804218e1567c344c8df732cc75f4aa28ebabeaa Mon Sep 17 00:00:00 2001 From: Glenn Lewis <6598971+gmlewis@users.noreply.github.com> Date: Tue, 15 Oct 2024 16:12:56 -0400 Subject: [PATCH 27/42] Update github/event_types_test.go --- github/event_types_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/github/event_types_test.go b/github/event_types_test.go index 655f97f2ddd..6cb6fa74a52 100644 --- a/github/event_types_test.go +++ b/github/event_types_test.go @@ -9688,8 +9688,8 @@ func TestRepositoryRulesetEvent_Marshal(t *testing.T) { Deletion: &RepositoryRulesetRuleType{ Type: "deletion", }, - RequireLinearHistory: &RepositoryRulesetRuleType{ - Type: "require_linear_history", + RequiredLinearHistory: &RepositoryRulesetRuleType{ + Type: "required_linear_history", }, MergeQueue: &RepositoryRulesetMergeQueueRule{ Type: "merge_queue", From a01f3c94a13f5a56d56089683a015eb7e525a466 Mon Sep 17 00:00:00 2001 From: Glenn Lewis <6598971+gmlewis@users.noreply.github.com> Date: Tue, 15 Oct 2024 16:13:06 -0400 Subject: [PATCH 28/42] Update github/event_types_test.go --- github/event_types_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/github/event_types_test.go b/github/event_types_test.go index 6cb6fa74a52..02591c8f46b 100644 --- a/github/event_types_test.go +++ b/github/event_types_test.go @@ -9895,8 +9895,8 @@ func TestRepositoryRulesetEvent_Marshal(t *testing.T) { Deletion: &RepositoryRulesetRuleType{ Type: "deletion", }, - RequireLinearHistory: &RepositoryRulesetRuleType{ - Type: "require_linear_history", + RequiredLinearHistory: &RepositoryRulesetRuleType{ + Type: "required_linear_history", }, MergeQueue: &RepositoryRulesetMergeQueueRule{ Type: "merge_queue", From a4f6e1e8537d5cb7c7129b5118bbe6958e2efea2 Mon Sep 17 00:00:00 2001 From: Glenn Lewis <6598971+gmlewis@users.noreply.github.com> Date: Tue, 15 Oct 2024 16:13:31 -0400 Subject: [PATCH 29/42] Update github/event_types_test.go --- github/event_types_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/github/event_types_test.go b/github/event_types_test.go index 02591c8f46b..eeb4e0cb3c4 100644 --- a/github/event_types_test.go +++ b/github/event_types_test.go @@ -10049,8 +10049,8 @@ func TestRepositoryRulesetEvent_Marshal(t *testing.T) { Deletion: &RepositoryRulesetRuleType{ Type: "deletion", }, - RequireLinearHistory: &RepositoryRulesetRuleType{ - Type: "require_linear_history", + RequiredLinearHistory: &RepositoryRulesetRuleType{ + Type: "required_linear_history", }, MergeQueue: &RepositoryRulesetMergeQueueRule{ Type: "merge_queue", From b0dec1bdcd7c67dead68d211fe6939cff923336e Mon Sep 17 00:00:00 2001 From: Glenn Lewis <6598971+gmlewis@users.noreply.github.com> Date: Tue, 15 Oct 2024 16:13:48 -0400 Subject: [PATCH 30/42] Update github/event_types_test.go --- github/event_types_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/github/event_types_test.go b/github/event_types_test.go index eeb4e0cb3c4..c1092507a07 100644 --- a/github/event_types_test.go +++ b/github/event_types_test.go @@ -9703,7 +9703,7 @@ func TestRepositoryRulesetEvent_Marshal(t *testing.T) { MinEntriesToMergeWaitMinutes: 13, }, }, - RequireDeployments: &RepositoryRulesetRequireDeploymentsRule{ + RequiredDeployments: &RepositoryRulesetRequiredDeploymentsRule{ Type: "required_deployments", Parameters: &RequiredDeploymentEnvironmentsRuleParameters{ RequiredDeploymentEnvironments: []string{"test"}, From 0cf42c244df64b4ec0badce299f7377e05046383 Mon Sep 17 00:00:00 2001 From: Glenn Lewis <6598971+gmlewis@users.noreply.github.com> Date: Tue, 15 Oct 2024 16:13:56 -0400 Subject: [PATCH 31/42] Update github/event_types_test.go --- github/event_types_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/github/event_types_test.go b/github/event_types_test.go index c1092507a07..68f2abaf3bd 100644 --- a/github/event_types_test.go +++ b/github/event_types_test.go @@ -9910,7 +9910,7 @@ func TestRepositoryRulesetEvent_Marshal(t *testing.T) { MinEntriesToMergeWaitMinutes: 13, }, }, - RequireDeployments: &RepositoryRulesetRequireDeploymentsRule{ + RequiredDeployments: &RepositoryRulesetRequiredDeploymentsRule{ Type: "required_deployments", Parameters: &RequiredDeploymentEnvironmentsRuleParameters{ RequiredDeploymentEnvironments: []string{"test"}, From 65358d51d998a5372f7a18b78387b4df921f9b1a Mon Sep 17 00:00:00 2001 From: Glenn Lewis <6598971+gmlewis@users.noreply.github.com> Date: Tue, 15 Oct 2024 16:14:02 -0400 Subject: [PATCH 32/42] Update github/event_types_test.go --- github/event_types_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/github/event_types_test.go b/github/event_types_test.go index 68f2abaf3bd..096ed2d9a24 100644 --- a/github/event_types_test.go +++ b/github/event_types_test.go @@ -10064,7 +10064,7 @@ func TestRepositoryRulesetEvent_Marshal(t *testing.T) { MinEntriesToMergeWaitMinutes: 13, }, }, - RequireDeployments: &RepositoryRulesetRequireDeploymentsRule{ + RequiredDeployments: &RepositoryRulesetRequiredDeploymentsRule{ Type: "required_deployments", Parameters: &RequiredDeploymentEnvironmentsRuleParameters{ RequiredDeploymentEnvironments: []string{"test"}, From 41552111b8005fd97b67fcfde5841c5e77606c49 Mon Sep 17 00:00:00 2001 From: Glenn Lewis <6598971+gmlewis@users.noreply.github.com> Date: Tue, 15 Oct 2024 16:14:10 -0400 Subject: [PATCH 33/42] Update github/event_types_test.go --- github/event_types_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/github/event_types_test.go b/github/event_types_test.go index 096ed2d9a24..65716c810cd 100644 --- a/github/event_types_test.go +++ b/github/event_types_test.go @@ -10218,7 +10218,7 @@ func TestRepositoryRulesetEvent_Marshal(t *testing.T) { MinEntriesToMergeWaitMinutes: 13, }, }, - RequireDeployments: &RepositoryRulesetRequireDeploymentsRule{ + RequiredDeployments: &RepositoryRulesetRequiredDeploymentsRule{ Type: "required_deployments", Parameters: &RequiredDeploymentEnvironmentsRuleParameters{ RequiredDeploymentEnvironments: []string{"test"}, From eee97b3c44e3033e07e701e01ab5117ced6cc112 Mon Sep 17 00:00:00 2001 From: Glenn Lewis <6598971+gmlewis@users.noreply.github.com> Date: Tue, 15 Oct 2024 16:14:22 -0400 Subject: [PATCH 34/42] Update github/repos_rules.go --- github/repos_rules.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/github/repos_rules.go b/github/repos_rules.go index f748178153b..c3681bc349e 100644 --- a/github/repos_rules.go +++ b/github/repos_rules.go @@ -261,7 +261,7 @@ type RepositoryRulesetRule struct { Deletion *RepositoryRulesetRuleType `json:"deletion,omitempty"` RequiredLinearHistory *RepositoryRulesetRuleType `json:"required_linear_history,omitempty"` MergeQueue *RepositoryRulesetMergeQueueRule `json:"merge_queue,omitempty"` - RequireDeployments *RepositoryRulesetRequireDeploymentsRule `json:"required_deployments,omitempty"` + RequiredDeployments *RepositoryRulesetRequiredDeploymentsRule `json:"required_deployments,omitempty"` RequiredSignatures *RepositoryRulesetRuleType `json:"required_signatures,omitempty"` PullRequest *RepositoryRulesetPullRequestRule `json:"pull_request,omitempty"` RequiredStatusChecks *RepositoryRulesetRequiredStatusChecksRule `json:"required_status_checks,omitempty"` From ee1dbb65b59a7db96156a2a9b0a8e44d42d6e912 Mon Sep 17 00:00:00 2001 From: Glenn Lewis <6598971+gmlewis@users.noreply.github.com> Date: Tue, 15 Oct 2024 16:14:32 -0400 Subject: [PATCH 35/42] Update github/repos_rules.go --- github/repos_rules.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/github/repos_rules.go b/github/repos_rules.go index c3681bc349e..4ce25e38dbd 100644 --- a/github/repos_rules.go +++ b/github/repos_rules.go @@ -304,8 +304,8 @@ type RepositoryRulesetMergeQueueRule struct { Parameters *MergeQueueRuleParameters `json:"parameters,omitempty"` } -// RepositoryRulesetRequireDeploymentsRule defines a rule for required deployments. -type RepositoryRulesetRequireDeploymentsRule struct { +// RepositoryRulesetRequiredDeploymentsRule defines a rule for required deployments. +type RepositoryRulesetRequiredDeploymentsRule struct { // Type can be one of: "required_deployments". Type string `json:"type"` Parameters *RequiredDeploymentEnvironmentsRuleParameters `json:"parameters,omitempty"` From dfd4dfed357efe0c2543793a454280fcb265881a Mon Sep 17 00:00:00 2001 From: Glenn Lewis <6598971+gmlewis@users.noreply.github.com> Date: Tue, 15 Oct 2024 16:17:42 -0400 Subject: [PATCH 36/42] Update github/repos_rules.go --- github/repos_rules.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/github/repos_rules.go b/github/repos_rules.go index 4ce25e38dbd..72d0d11e358 100644 --- a/github/repos_rules.go +++ b/github/repos_rules.go @@ -261,7 +261,7 @@ type RepositoryRulesetRule struct { Deletion *RepositoryRulesetRuleType `json:"deletion,omitempty"` RequiredLinearHistory *RepositoryRulesetRuleType `json:"required_linear_history,omitempty"` MergeQueue *RepositoryRulesetMergeQueueRule `json:"merge_queue,omitempty"` - RequiredDeployments *RepositoryRulesetRequiredDeploymentsRule `json:"required_deployments,omitempty"` + RequiredDeployments *RepositoryRulesetRequiredDeploymentsRule `json:"required_deployments,omitempty"` RequiredSignatures *RepositoryRulesetRuleType `json:"required_signatures,omitempty"` PullRequest *RepositoryRulesetPullRequestRule `json:"pull_request,omitempty"` RequiredStatusChecks *RepositoryRulesetRequiredStatusChecksRule `json:"required_status_checks,omitempty"` From eb208037ab4bcce980617d6711c121f3594a5e0f Mon Sep 17 00:00:00 2001 From: Glenn Lewis <6598971+gmlewis@users.noreply.github.com> Date: Tue, 15 Oct 2024 16:20:09 -0400 Subject: [PATCH 37/42] Update github/repos_rules.go --- github/repos_rules.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/github/repos_rules.go b/github/repos_rules.go index 72d0d11e358..b812bd0b984 100644 --- a/github/repos_rules.go +++ b/github/repos_rules.go @@ -261,7 +261,7 @@ type RepositoryRulesetRule struct { Deletion *RepositoryRulesetRuleType `json:"deletion,omitempty"` RequiredLinearHistory *RepositoryRulesetRuleType `json:"required_linear_history,omitempty"` MergeQueue *RepositoryRulesetMergeQueueRule `json:"merge_queue,omitempty"` - RequiredDeployments *RepositoryRulesetRequiredDeploymentsRule `json:"required_deployments,omitempty"` + RequiredDeployments *RepositoryRulesetRequiredDeploymentsRule `json:"required_deployments,omitempty"` RequiredSignatures *RepositoryRulesetRuleType `json:"required_signatures,omitempty"` PullRequest *RepositoryRulesetPullRequestRule `json:"pull_request,omitempty"` RequiredStatusChecks *RepositoryRulesetRequiredStatusChecksRule `json:"required_status_checks,omitempty"` From 08855c39d69ae155f4b6903fa93caf52d85ab8c4 Mon Sep 17 00:00:00 2001 From: Udit Date: Wed, 16 Oct 2024 14:50:49 +0530 Subject: [PATCH 38/42] Run latest go generate --- github/event_types_test.go | 4 ++-- github/github-accessors.go | 24 ++++++++++++------------ github/github-accessors_test.go | 26 +++++++++++++------------- 3 files changed, 27 insertions(+), 27 deletions(-) diff --git a/github/event_types_test.go b/github/event_types_test.go index 65716c810cd..48ced4a0d4b 100644 --- a/github/event_types_test.go +++ b/github/event_types_test.go @@ -10203,8 +10203,8 @@ func TestRepositoryRulesetEvent_Marshal(t *testing.T) { Deletion: &RepositoryRulesetRuleType{ Type: "deletion", }, - RequireLinearHistory: &RepositoryRulesetRuleType{ - Type: "require_linear_history", + RequiredLinearHistory: &RepositoryRulesetRuleType{ + Type: "required_linear_history", }, MergeQueue: &RepositoryRulesetMergeQueueRule{ Type: "merge_queue", diff --git a/github/github-accessors.go b/github/github-accessors.go index 4099da3fd42..019ba354400 100644 --- a/github/github-accessors.go +++ b/github/github-accessors.go @@ -21135,7 +21135,7 @@ func (r *RepositoryRulesetRefCondition) GetRefName() *RulesetRefConditionParamet } // GetParameters returns the Parameters field. -func (r *RepositoryRulesetRequireDeploymentsRule) GetParameters() *RequiredDeploymentEnvironmentsRuleParameters { +func (r *RepositoryRulesetRequiredDeploymentsRule) GetParameters() *RequiredDeploymentEnvironmentsRuleParameters { if r == nil { return nil } @@ -21262,12 +21262,20 @@ func (r *RepositoryRulesetRule) GetPullRequest() *RepositoryRulesetPullRequestRu return r.PullRequest } -// GetRequireDeployments returns the RequireDeployments field. -func (r *RepositoryRulesetRule) GetRequireDeployments() *RepositoryRulesetRequireDeploymentsRule { +// GetRequiredDeployments returns the RequiredDeployments field. +func (r *RepositoryRulesetRule) GetRequiredDeployments() *RepositoryRulesetRequiredDeploymentsRule { if r == nil { return nil } - return r.RequireDeployments + return r.RequiredDeployments +} + +// GetRequiredLinearHistory returns the RequiredLinearHistory field. +func (r *RepositoryRulesetRule) GetRequiredLinearHistory() *RepositoryRulesetRuleType { + if r == nil { + return nil + } + return r.RequiredLinearHistory } // GetRequiredSignatures returns the RequiredSignatures field. @@ -21286,14 +21294,6 @@ func (r *RepositoryRulesetRule) GetRequiredStatusChecks() *RepositoryRulesetRequ return r.RequiredStatusChecks } -// GetRequireLinearHistory returns the RequireLinearHistory field. -func (r *RepositoryRulesetRule) GetRequireLinearHistory() *RepositoryRulesetRuleType { - if r == nil { - return nil - } - return r.RequireLinearHistory -} - // GetTagNamePattern returns the TagNamePattern field. func (r *RepositoryRulesetRule) GetTagNamePattern() *RepositoryRulesetPatternRule { if r == nil { diff --git a/github/github-accessors_test.go b/github/github-accessors_test.go index 68048df92b1..8f1407eeeaf 100644 --- a/github/github-accessors_test.go +++ b/github/github-accessors_test.go @@ -27120,9 +27120,9 @@ func TestRepositoryRulesetRefCondition_GetRefName(tt *testing.T) { r.GetRefName() } -func TestRepositoryRulesetRequireDeploymentsRule_GetParameters(tt *testing.T) { +func TestRepositoryRulesetRequiredDeploymentsRule_GetParameters(tt *testing.T) { tt.Parallel() - r := &RepositoryRulesetRequireDeploymentsRule{} + r := &RepositoryRulesetRequiredDeploymentsRule{} r.GetParameters() r = nil r.GetParameters() @@ -27248,12 +27248,20 @@ func TestRepositoryRulesetRule_GetPullRequest(tt *testing.T) { r.GetPullRequest() } -func TestRepositoryRulesetRule_GetRequireDeployments(tt *testing.T) { +func TestRepositoryRulesetRule_GetRequiredDeployments(tt *testing.T) { tt.Parallel() r := &RepositoryRulesetRule{} - r.GetRequireDeployments() + r.GetRequiredDeployments() r = nil - r.GetRequireDeployments() + r.GetRequiredDeployments() +} + +func TestRepositoryRulesetRule_GetRequiredLinearHistory(tt *testing.T) { + tt.Parallel() + r := &RepositoryRulesetRule{} + r.GetRequiredLinearHistory() + r = nil + r.GetRequiredLinearHistory() } func TestRepositoryRulesetRule_GetRequiredSignatures(tt *testing.T) { @@ -27272,14 +27280,6 @@ func TestRepositoryRulesetRule_GetRequiredStatusChecks(tt *testing.T) { r.GetRequiredStatusChecks() } -func TestRepositoryRulesetRule_GetRequireLinearHistory(tt *testing.T) { - tt.Parallel() - r := &RepositoryRulesetRule{} - r.GetRequireLinearHistory() - r = nil - r.GetRequireLinearHistory() -} - func TestRepositoryRulesetRule_GetTagNamePattern(tt *testing.T) { tt.Parallel() r := &RepositoryRulesetRule{} From f062b5a1fbf9b76602dd25794a300bdbe53da216 Mon Sep 17 00:00:00 2001 From: Glenn Lewis <6598971+gmlewis@users.noreply.github.com> Date: Wed, 16 Oct 2024 07:00:30 -0400 Subject: [PATCH 39/42] Update github/event_types_test.go --- github/event_types_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/github/event_types_test.go b/github/event_types_test.go index 48ced4a0d4b..2b57adec147 100644 --- a/github/event_types_test.go +++ b/github/event_types_test.go @@ -10547,7 +10547,7 @@ func TestRepositoryRulesetEvent_Marshal(t *testing.T) { "type": "deletion" }, "required_linear_history": { - "type": "require_linear_history" + "type": "required_linear_history" }, "merge_queue": { "type": "merge_queue", From 85130e235503c975307f11f81d32337130363b79 Mon Sep 17 00:00:00 2001 From: Glenn Lewis <6598971+gmlewis@users.noreply.github.com> Date: Wed, 16 Oct 2024 07:00:37 -0400 Subject: [PATCH 40/42] Update github/event_types_test.go --- github/event_types_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/github/event_types_test.go b/github/event_types_test.go index 2b57adec147..1d9c8d823c6 100644 --- a/github/event_types_test.go +++ b/github/event_types_test.go @@ -10780,7 +10780,7 @@ func TestRepositoryRulesetEvent_Marshal(t *testing.T) { "type": "deletion" }, "required_linear_history": { - "type": "require_linear_history" + "type": "required_linear_history" }, "merge_queue": { "type": "merge_queue", From dac8ce614a3401c60268e064d39e121aa5e12b90 Mon Sep 17 00:00:00 2001 From: Glenn Lewis <6598971+gmlewis@users.noreply.github.com> Date: Wed, 16 Oct 2024 07:00:44 -0400 Subject: [PATCH 41/42] Update github/event_types_test.go --- github/event_types_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/github/event_types_test.go b/github/event_types_test.go index 1d9c8d823c6..b06a9739658 100644 --- a/github/event_types_test.go +++ b/github/event_types_test.go @@ -10941,7 +10941,7 @@ func TestRepositoryRulesetEvent_Marshal(t *testing.T) { "type": "deletion" }, "required_linear_history": { - "type": "require_linear_history" + "type": "required_linear_history" }, "merge_queue": { "type": "merge_queue", From e1258898492a2b4e341abc989d5f13bc1d49e4cf Mon Sep 17 00:00:00 2001 From: Glenn Lewis <6598971+gmlewis@users.noreply.github.com> Date: Wed, 16 Oct 2024 07:00:51 -0400 Subject: [PATCH 42/42] Update github/event_types_test.go --- github/event_types_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/github/event_types_test.go b/github/event_types_test.go index b06a9739658..71c8ac3df2e 100644 --- a/github/event_types_test.go +++ b/github/event_types_test.go @@ -11103,7 +11103,7 @@ func TestRepositoryRulesetEvent_Marshal(t *testing.T) { "type": "deletion" }, "required_linear_history": { - "type": "require_linear_history" + "type": "required_linear_history" }, "merge_queue": { "type": "merge_queue",