From b9d6ae5ecbf43c23b9c3d9fd68b0450189912ed1 Mon Sep 17 00:00:00 2001 From: Jiri Tyr Date: Thu, 6 Jan 2022 12:15:33 +0000 Subject: [PATCH] Adding BypassPullRequestActorIDs to branch protection --- github/resource_github_branch_protection.go | 7 + .../resource_github_branch_protection_test.go | 115 +++++++++ github/util_v4.go | 8 + github/util_v4_branch_protection.go | 38 +++ github/util_v4_consts.go | 1 + go.mod | 2 +- go.sum | 4 +- vendor/github.com/shurcooL/githubv4/enum.go | 83 ++++++- vendor/github.com/shurcooL/githubv4/input.go | 234 +++++++++++++++++- vendor/github.com/shurcooL/githubv4/scalar.go | 6 + vendor/modules.txt | 2 +- .../docs/r/branch_protection.html.markdown | 1 + 12 files changed, 489 insertions(+), 12 deletions(-) diff --git a/github/resource_github_branch_protection.go b/github/resource_github_branch_protection.go index 852b3ff34e..2e845fc953 100644 --- a/github/resource_github_branch_protection.go +++ b/github/resource_github_branch_protection.go @@ -86,6 +86,11 @@ func resourceGithubBranchProtection() *schema.Resource { Optional: true, Elem: &schema.Schema{Type: schema.TypeString}, }, + PROTECTION_PULL_REQUESTS_BYPASSERS: { + Type: schema.TypeSet, + Optional: true, + Elem: &schema.Schema{Type: schema.TypeString}, + }, }, }, }, @@ -147,6 +152,7 @@ func resourceGithubBranchProtectionCreate(d *schema.ResourceData, meta interface input := githubv4.CreateBranchProtectionRuleInput{ AllowsDeletions: githubv4.NewBoolean(githubv4.Boolean(data.AllowsDeletions)), AllowsForcePushes: githubv4.NewBoolean(githubv4.Boolean(data.AllowsForcePushes)), + BypassPullRequestActorIDs: githubv4NewIDSlice(githubv4IDSliceEmpty(data.BypassPullRequestActorIDs)), DismissesStaleReviews: githubv4.NewBoolean(githubv4.Boolean(data.DismissesStaleReviews)), IsAdminEnforced: githubv4.NewBoolean(githubv4.Boolean(data.IsAdminEnforced)), Pattern: githubv4.String(data.Pattern), @@ -275,6 +281,7 @@ func resourceGithubBranchProtectionUpdate(d *schema.ResourceData, meta interface BranchProtectionRuleID: d.Id(), AllowsDeletions: githubv4.NewBoolean(githubv4.Boolean(data.AllowsDeletions)), AllowsForcePushes: githubv4.NewBoolean(githubv4.Boolean(data.AllowsForcePushes)), + BypassPullRequestActorIDs: githubv4NewIDSlice(githubv4IDSliceEmpty(data.BypassPullRequestActorIDs)), DismissesStaleReviews: githubv4.NewBoolean(githubv4.Boolean(data.DismissesStaleReviews)), IsAdminEnforced: githubv4.NewBoolean(githubv4.Boolean(data.IsAdminEnforced)), Pattern: githubv4.NewString(githubv4.String(data.Pattern)), diff --git a/github/resource_github_branch_protection_test.go b/github/resource_github_branch_protection_test.go index cb7576d7ac..65cadd0957 100644 --- a/github/resource_github_branch_protection_test.go +++ b/github/resource_github_branch_protection_test.go @@ -438,6 +438,121 @@ func TestAccGithubBranchProtection(t *testing.T) { }) + t.Run("configures non-empty list of pull request bypassers", func(t *testing.T) { + + config := fmt.Sprintf(` + + resource "github_repository" "test" { + name = "tf-acc-test-%s" + auto_init = true + } + + resource "github_branch_protection" "test" { + + repository_id = github_repository.test.node_id + pattern = "main" + + required_pull_request_reviews { + pull_request_bypassers = [ + "1234", + ] + } + + } + + `, randomID) + + check := resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr( + "github_branch_protection.test", "required_pull_request_reviews.0.dismiss_stale_reviews.#", "1", + ), + resource.TestCheckResourceAttr( + "github_branch_protection.test", "required_pull_request_reviews.0.dismiss_stale_reviews.0", "1234", + ), + ) + + testCase := func(t *testing.T, mode string) { + resource.Test(t, resource.TestCase{ + PreCheck: func() { skipUnlessMode(t, mode) }, + Providers: testAccProviders, + Steps: []resource.TestStep{ + { + Config: config, + Check: check, + }, + }, + }) + } + + t.Run("with an anonymous account", func(t *testing.T) { + t.Skip("anonymous account not supported for this operation") + }) + + t.Run("with an individual account", func(t *testing.T) { + testCase(t, individual) + }) + + t.Run("with an organization account", func(t *testing.T) { + testCase(t, organization) + }) + + }) + + t.Run("configures empty list of pull request bypassers", func(t *testing.T) { + + config := fmt.Sprintf(` + + resource "github_repository" "test" { + name = "tf-acc-test-%s" + auto_init = true + } + + resource "github_branch_protection" "test" { + + repository_id = github_repository.test.node_id + pattern = "main" + + required_pull_request_reviews { + pull_request_bypassers = [] + } + + } + + `, randomID) + + check := resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr( + "github_branch_protection.test", "required_pull_request_reviews.0.dismiss_stale_reviews.#", "0", + ), + ) + + testCase := func(t *testing.T, mode string) { + resource.Test(t, resource.TestCase{ + PreCheck: func() { skipUnlessMode(t, mode) }, + Providers: testAccProviders, + Steps: []resource.TestStep{ + { + Config: config, + Check: check, + }, + }, + }) + } + + t.Run("with an anonymous account", func(t *testing.T) { + t.Skip("anonymous account not supported for this operation") + }) + + t.Run("with an individual account", func(t *testing.T) { + testCase(t, individual) + }) + + t.Run("with an organization account", func(t *testing.T) { + testCase(t, organization) + }) + + }) + } func importBranchProtectionByRepoName(repo, pattern string) resource.ImportStateIdFunc { diff --git a/github/util_v4.go b/github/util_v4.go index 4d9260a14c..035a94dbbe 100644 --- a/github/util_v4.go +++ b/github/util_v4.go @@ -37,6 +37,14 @@ func githubv4IDSlice(ss []string) []githubv4.ID { return vGh4 } +func githubv4IDSliceEmpty(ss []string) []githubv4.ID { + vGh4 := make([]githubv4.ID, 0) + for _, s := range ss { + vGh4 = append(vGh4, githubv4.ID(s)) + } + return vGh4 +} + func githubv4NewStringSlice(v []githubv4.String) *[]githubv4.String { return &v } func githubv4NewIDSlice(v []githubv4.ID) *[]githubv4.ID { return &v } diff --git a/github/util_v4_branch_protection.go b/github/util_v4_branch_protection.go index 4a771be829..ef6be1ff76 100644 --- a/github/util_v4_branch_protection.go +++ b/github/util_v4_branch_protection.go @@ -20,6 +20,13 @@ type DismissalActorTypes struct { } } +type BypassPullRequestActorTypes struct { + Actor struct { + Team Actor `graphql:"... on Team"` + User Actor `graphql:"... on User"` + } +} + type PushActorTypes struct { Actor struct { App Actor `graphql:"... on App"` @@ -39,6 +46,9 @@ type BranchProtectionRule struct { ReviewDismissalAllowances struct { Nodes []DismissalActorTypes } `graphql:"reviewDismissalAllowances(first: 100)"` + BypassPullRequestAllowances struct { + Nodes []BypassPullRequestActorTypes + } `graphql:"bypassPullRequestAllowances(first: 100)"` AllowsDeletions githubv4.Boolean AllowsForcePushes githubv4.Boolean DismissesStaleReviews githubv4.Boolean @@ -62,6 +72,7 @@ type BranchProtectionResourceData struct { AllowsDeletions bool AllowsForcePushes bool BranchProtectionRuleID string + BypassPullRequestActorIDs []string DismissesStaleReviews bool IsAdminEnforced bool Pattern string @@ -157,6 +168,16 @@ func branchProtectionResourceData(d *schema.ResourceData, meta interface{}) (Bra data.RestrictsReviewDismissals = true } } + if v, ok := m[PROTECTION_PULL_REQUESTS_BYPASSERS]; ok { + bypassPullRequestActorIDs := make([]string, 0) + vL := v.(*schema.Set).List() + for _, v := range vL { + bypassPullRequestActorIDs = append(bypassPullRequestActorIDs, v.(string)) + } + if len(bypassPullRequestActorIDs) > 0 { + data.BypassPullRequestActorIDs = bypassPullRequestActorIDs + } + } } } @@ -210,6 +231,20 @@ func setDismissalActorIDs(actors []DismissalActorTypes) []string { return pushActors } +func setBypassPullRequestActorIDs(actors []BypassPullRequestActorTypes) []string { + bypassActors := make([]string, 0, len(actors)) + for _, a := range actors { + if a.Actor.Team != (Actor{}) { + bypassActors = append(bypassActors, a.Actor.Team.ID.(string)) + } + if a.Actor.User != (Actor{}) { + bypassActors = append(bypassActors, a.Actor.User.ID.(string)) + } + } + + return bypassActors +} + func setPushActorIDs(actors []PushActorTypes) []string { pushActors := make([]string, 0, len(actors)) for _, a := range actors { @@ -234,6 +269,8 @@ func setApprovingReviews(protection BranchProtectionRule) interface{} { dismissalAllowances := protection.ReviewDismissalAllowances.Nodes dismissalActors := setDismissalActorIDs(dismissalAllowances) + bypassPullRequestAllowances := protection.BypassPullRequestAllowances.Nodes + bypassPullRequestActors := setBypassPullRequestActorIDs(bypassPullRequestAllowances) approvalReviews := []interface{}{ map[string]interface{}{ PROTECTION_REQUIRED_APPROVING_REVIEW_COUNT: protection.RequiredApprovingReviewCount, @@ -241,6 +278,7 @@ func setApprovingReviews(protection BranchProtectionRule) interface{} { PROTECTION_DISMISSES_STALE_REVIEWS: protection.DismissesStaleReviews, PROTECTION_RESTRICTS_REVIEW_DISMISSALS: protection.RestrictsReviewDismissals, PROTECTION_RESTRICTS_REVIEW_DISMISSERS: dismissalActors, + PROTECTION_PULL_REQUESTS_BYPASSERS: bypassPullRequestActors, }, } diff --git a/github/util_v4_consts.go b/github/util_v4_consts.go index f405a6d60d..804fb49575 100644 --- a/github/util_v4_consts.go +++ b/github/util_v4_consts.go @@ -18,6 +18,7 @@ const ( PROTECTION_RESTRICTS_PUSHES = "push_restrictions" PROTECTION_RESTRICTS_REVIEW_DISMISSALS = "restrict_dismissals" PROTECTION_RESTRICTS_REVIEW_DISMISSERS = "dismissal_restrictions" + PROTECTION_PULL_REQUESTS_BYPASSERS = "pull_request_bypassers" REPOSITORY_ID = "repository_id" ) diff --git a/go.mod b/go.mod index 090cbc01f2..3a9f8f4001 100644 --- a/go.mod +++ b/go.mod @@ -10,7 +10,7 @@ require ( github.com/hashicorp/hcl/v2 v2.3.0 // indirect github.com/hashicorp/terraform-config-inspect v0.0.0-20191212124732-c6ae6269b9d7 // indirect github.com/hashicorp/terraform-plugin-sdk v1.7.0 - github.com/shurcooL/githubv4 v0.0.0-20210725200734-83ba7b4c9228 + github.com/shurcooL/githubv4 v0.0.0-20220106005112-0707a5a90543 github.com/shurcooL/graphql v0.0.0-20181231061246-d48a9a75455f // indirect github.com/ulikunitz/xz v0.5.10 // indirect golang.org/x/crypto v0.0.0-20210817164053-32db794688a5 diff --git a/go.sum b/go.sum index 4e84512254..06c432f125 100644 --- a/go.sum +++ b/go.sum @@ -363,8 +363,8 @@ github.com/sergi/go-diff v1.0.0 h1:Kpca3qRNrduNnOQeazBd0ysaKrUJiIuISHxogkT9RPQ= github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= github.com/shirou/gopsutil v0.0.0-20190901111213-e4ec7b275ada/go.mod h1:WWnYX4lzhCH5h/3YBfyVA3VbLYjlMZZAQcW9ojMexNc= github.com/shirou/w32 v0.0.0-20160930032740-bb4de0191aa4/go.mod h1:qsXQc7+bwAM3Q1u/4XEfrquwF8Lw7D7y5cD8CuHnfIc= -github.com/shurcooL/githubv4 v0.0.0-20210725200734-83ba7b4c9228 h1:N5B+JgvM/DVYIxreItPJMM3yWrNO/GB2q4nESrtBisM= -github.com/shurcooL/githubv4 v0.0.0-20210725200734-83ba7b4c9228/go.mod h1:hAF0iLZy4td2EX+/8Tw+4nodhlMrwN3HupfaXj3zkGo= +github.com/shurcooL/githubv4 v0.0.0-20220106005112-0707a5a90543 h1:TLml5yQBxKTGrjQQUt+fMcJNNIUyNH0wDeCVGyaLF+s= +github.com/shurcooL/githubv4 v0.0.0-20220106005112-0707a5a90543/go.mod h1:hAF0iLZy4td2EX+/8Tw+4nodhlMrwN3HupfaXj3zkGo= github.com/shurcooL/go v0.0.0-20180423040247-9e1955d9fb6e h1:MZM7FHLqUHYI0Y/mQAt3d2aYa0SiNms/hFqC9qJYolM= github.com/shurcooL/go v0.0.0-20180423040247-9e1955d9fb6e/go.mod h1:TDJrrUr11Vxrven61rcy3hJMUqaf/CLWYhHNPmT14Lk= github.com/shurcooL/go-goon v0.0.0-20170922171312-37c2f522c041 h1:llrF3Fs4018ePo4+G/HV/uQUqEI1HMDjCeOf2V6puPc= diff --git a/vendor/github.com/shurcooL/githubv4/enum.go b/vendor/github.com/shurcooL/githubv4/enum.go index 485aacfcdf..61fc573b83 100644 --- a/vendor/github.com/shurcooL/githubv4/enum.go +++ b/vendor/github.com/shurcooL/githubv4/enum.go @@ -118,10 +118,10 @@ const ( ContributionLevelFourthQuartile ContributionLevel = "FOURTH_QUARTILE" // Highest 25% of days of contributions. More contributions than the third quartile. ) -// DefaultRepositoryPermissionField represents the possible default permissions for repositories. +// DefaultRepositoryPermissionField represents the possible base permissions for repositories. type DefaultRepositoryPermissionField string -// The possible default permissions for repositories. +// The possible base permissions for repositories. const ( DefaultRepositoryPermissionFieldNone DefaultRepositoryPermissionField = "NONE" // No access. DefaultRepositoryPermissionFieldRead DefaultRepositoryPermissionField = "READ" // Can read repos by default. @@ -205,6 +205,18 @@ const ( DiscussionOrderFieldUpdatedAt DiscussionOrderField = "UPDATED_AT" // Order discussions by most recent modification time. ) +// DismissReason represents the possible reasons that a Dependabot alert was dismissed. +type DismissReason string + +// The possible reasons that a Dependabot alert was dismissed. +const ( + DismissReasonFixStarted DismissReason = "FIX_STARTED" // A fix has already been started. + DismissReasonNoBandwidth DismissReason = "NO_BANDWIDTH" // No bandwidth to fix this. + DismissReasonTolerableRisk DismissReason = "TOLERABLE_RISK" // Risk is tolerable to this project. + DismissReasonInaccurate DismissReason = "INACCURATE" // This alert is inaccurate or incorrect. + DismissReasonNotUsed DismissReason = "NOT_USED" // Vulnerable code is not actually used. +) + // EnterpriseAdministratorInvitationOrderField represents properties by which enterprise administrator invitation connections can be ordered. type EnterpriseAdministratorInvitationOrderField string @@ -222,12 +234,12 @@ const ( EnterpriseAdministratorRoleBillingManager EnterpriseAdministratorRole = "BILLING_MANAGER" // Represents a billing manager of the enterprise account. ) -// EnterpriseDefaultRepositoryPermissionSettingValue represents the possible values for the enterprise default repository permission setting. +// EnterpriseDefaultRepositoryPermissionSettingValue represents the possible values for the enterprise base repository permission setting. type EnterpriseDefaultRepositoryPermissionSettingValue string -// The possible values for the enterprise default repository permission setting. +// The possible values for the enterprise base repository permission setting. const ( - EnterpriseDefaultRepositoryPermissionSettingValueNoPolicy EnterpriseDefaultRepositoryPermissionSettingValue = "NO_POLICY" // Organizations in the enterprise choose default repository permissions for their members. + EnterpriseDefaultRepositoryPermissionSettingValueNoPolicy EnterpriseDefaultRepositoryPermissionSettingValue = "NO_POLICY" // Organizations in the enterprise choose base repository permissions for their members. EnterpriseDefaultRepositoryPermissionSettingValueAdmin EnterpriseDefaultRepositoryPermissionSettingValue = "ADMIN" // Organization members will be able to clone, pull, push, and add new collaborators to all organization repositories. EnterpriseDefaultRepositoryPermissionSettingValueWrite EnterpriseDefaultRepositoryPermissionSettingValue = "WRITE" // Organization members will be able to clone, pull, and push all organization repositories. EnterpriseDefaultRepositoryPermissionSettingValueRead EnterpriseDefaultRepositoryPermissionSettingValue = "READ" // Organization members will be able to clone and pull all organization repositories. @@ -494,6 +506,7 @@ const ( IssueTimelineItemsItemTypeCommentDeletedEvent IssueTimelineItemsItemType = "COMMENT_DELETED_EVENT" // Represents a 'comment_deleted' event on a given issue or pull request. IssueTimelineItemsItemTypeConnectedEvent IssueTimelineItemsItemType = "CONNECTED_EVENT" // Represents a 'connected' event on a given issue or pull request. IssueTimelineItemsItemTypeConvertedNoteToIssueEvent IssueTimelineItemsItemType = "CONVERTED_NOTE_TO_ISSUE_EVENT" // Represents a 'converted_note_to_issue' event on a given issue or pull request. + IssueTimelineItemsItemTypeConvertedToDiscussionEvent IssueTimelineItemsItemType = "CONVERTED_TO_DISCUSSION_EVENT" // Represents a 'converted_to_discussion' event on a given issue. IssueTimelineItemsItemTypeDemilestonedEvent IssueTimelineItemsItemType = "DEMILESTONED_EVENT" // Represents a 'demilestoned' event on a given issue or pull request. IssueTimelineItemsItemTypeDisconnectedEvent IssueTimelineItemsItemType = "DISCONNECTED_EVENT" // Represents a 'disconnected' event on a given issue or pull request. IssueTimelineItemsItemTypeLabeledEvent IssueTimelineItemsItemType = "LABELED_EVENT" // Represents a 'labeled' event on a given issue or pull request. @@ -585,6 +598,14 @@ const ( NotificationRestrictionSettingValueDisabled NotificationRestrictionSettingValue = "DISABLED" // The setting is disabled for the owner. ) +// OIDCProviderType represents the OIDC identity provider type. +type OIDCProviderType string + +// The OIDC identity provider type. +const ( + OIDCProviderTypeAad OIDCProviderType = "AAD" // Azure Active Directory. +) + // OauthApplicationCreateAuditEntryState represents the state of an OAuth Application when it was created. type OauthApplicationCreateAuditEntryState string @@ -639,6 +660,14 @@ const ( OrgCreateAuditEntryBillingPlanTieredPerSeat OrgCreateAuditEntryBillingPlan = "TIERED_PER_SEAT" // Tiered Per Seat Plan. ) +// OrgEnterpriseOwnerOrderField represents properties by which enterprise owners can be ordered. +type OrgEnterpriseOwnerOrderField string + +// Properties by which enterprise owners can be ordered. +const ( + OrgEnterpriseOwnerOrderFieldLogin OrgEnterpriseOwnerOrderField = "LOGIN" // Order enterprise owners by login. +) + // OrgRemoveBillingManagerAuditEntryReason represents the reason a billing manager was removed from an Organization. type OrgRemoveBillingManagerAuditEntryReason string @@ -763,6 +792,7 @@ type OrganizationMembersCanCreateRepositoriesSettingValue string const ( OrganizationMembersCanCreateRepositoriesSettingValueAll OrganizationMembersCanCreateRepositoriesSettingValue = "ALL" // Members will be able to create public and private repositories. OrganizationMembersCanCreateRepositoriesSettingValuePrivate OrganizationMembersCanCreateRepositoriesSettingValue = "PRIVATE" // Members will be able to create only private repositories. + OrganizationMembersCanCreateRepositoriesSettingValueInternal OrganizationMembersCanCreateRepositoriesSettingValue = "INTERNAL" // Members will be able to create only internal repositories. OrganizationMembersCanCreateRepositoriesSettingValueDisabled OrganizationMembersCanCreateRepositoriesSettingValue = "DISABLED" // Members will not be able to create public or private repositories. ) @@ -882,6 +912,17 @@ const ( ProjectColumnPurposeDone ProjectColumnPurpose = "DONE" // The column contains cards which are complete. ) +// ProjectNextOrderField represents properties by which the return project can be ordered. +type ProjectNextOrderField string + +// Properties by which the return project can be ordered. +const ( + ProjectNextOrderFieldTitle ProjectNextOrderField = "TITLE" // The project's title. + ProjectNextOrderFieldNumber ProjectNextOrderField = "NUMBER" // The project's number. + ProjectNextOrderFieldUpdatedAt ProjectNextOrderField = "UPDATED_AT" // The project's date and time of update. + ProjectNextOrderFieldCreatedAt ProjectNextOrderField = "CREATED_AT" // The project's date and time of creation. +) + // ProjectOrderField represents properties by which project connections can be ordered. type ProjectOrderField string @@ -1021,6 +1062,7 @@ const ( PullRequestTimelineItemsItemTypeCommentDeletedEvent PullRequestTimelineItemsItemType = "COMMENT_DELETED_EVENT" // Represents a 'comment_deleted' event on a given issue or pull request. PullRequestTimelineItemsItemTypeConnectedEvent PullRequestTimelineItemsItemType = "CONNECTED_EVENT" // Represents a 'connected' event on a given issue or pull request. PullRequestTimelineItemsItemTypeConvertedNoteToIssueEvent PullRequestTimelineItemsItemType = "CONVERTED_NOTE_TO_ISSUE_EVENT" // Represents a 'converted_note_to_issue' event on a given issue or pull request. + PullRequestTimelineItemsItemTypeConvertedToDiscussionEvent PullRequestTimelineItemsItemType = "CONVERTED_TO_DISCUSSION_EVENT" // Represents a 'converted_to_discussion' event on a given issue. PullRequestTimelineItemsItemTypeDemilestonedEvent PullRequestTimelineItemsItemType = "DEMILESTONED_EVENT" // Represents a 'demilestoned' event on a given issue or pull request. PullRequestTimelineItemsItemTypeDisconnectedEvent PullRequestTimelineItemsItemType = "DISCONNECTED_EVENT" // Represents a 'disconnected' event on a given issue or pull request. PullRequestTimelineItemsItemTypeLabeledEvent PullRequestTimelineItemsItemType = "LABELED_EVENT" // Represents a 'labeled' event on a given issue or pull request. @@ -1308,6 +1350,16 @@ const ( RequestableCheckStatusStatePending RequestableCheckStatusState = "PENDING" // The check suite or run is in pending state. ) +// RoleInOrganization represents possible roles a user may have in relation to an organization. +type RoleInOrganization string + +// Possible roles a user may have in relation to an organization. +const ( + RoleInOrganizationOwner RoleInOrganization = "OWNER" // A user with full administrative access to the organization. + RoleInOrganizationDirectMember RoleInOrganization = "DIRECT_MEMBER" // A user who is a direct member of the organization. + RoleInOrganizationUnaffiliated RoleInOrganization = "UNAFFILIATED" // A user who is unaffiliated with the organization. +) + // SamlDigestAlgorithm represents the possible digest algorithms used to sign SAML requests for an identity provider. type SamlDigestAlgorithm string @@ -1361,7 +1413,7 @@ const ( SecurityAdvisoryEcosystemNuget SecurityAdvisoryEcosystem = "NUGET" // .NET packages hosted at the NuGet Gallery. SecurityAdvisoryEcosystemPip SecurityAdvisoryEcosystem = "PIP" // Python packages hosted at PyPI.org. SecurityAdvisoryEcosystemRubygems SecurityAdvisoryEcosystem = "RUBYGEMS" // Ruby gems hosted at RubyGems.org. - SecurityAdvisoryEcosystemOther SecurityAdvisoryEcosystem = "OTHER" // Applications, runtimes, operating systems and other kinds of software. + SecurityAdvisoryEcosystemRust SecurityAdvisoryEcosystem = "RUST" // Rust crates. ) // SecurityAdvisoryIdentifierType represents identifier formats available for advisories. @@ -1401,6 +1453,15 @@ const ( SecurityVulnerabilityOrderFieldUpdatedAt SecurityVulnerabilityOrderField = "UPDATED_AT" // Order vulnerability by update time. ) +// SponsorOrderField represents properties by which sponsor connections can be ordered. +type SponsorOrderField string + +// Properties by which sponsor connections can be ordered. +const ( + SponsorOrderFieldLogin SponsorOrderField = "LOGIN" // Order sponsorable entities by login (username). + SponsorOrderFieldRelevance SponsorOrderField = "RELEVANCE" // Order sponsors by their relevance to the viewer. +) + // SponsorableOrderField represents properties by which sponsorable connections can be ordered. type SponsorableOrderField string @@ -1447,7 +1508,7 @@ type SponsorsGoalKind string // The different kinds of goals a GitHub Sponsors member can have. const ( SponsorsGoalKindTotalSponsorsCount SponsorsGoalKind = "TOTAL_SPONSORS_COUNT" // The goal is about reaching a certain number of sponsors. - SponsorsGoalKindMonthlySponsorshipAmount SponsorsGoalKind = "MONTHLY_SPONSORSHIP_AMOUNT" // The goal is about getting a certain dollar amount from sponsorships each month. + SponsorsGoalKindMonthlySponsorshipAmount SponsorsGoalKind = "MONTHLY_SPONSORSHIP_AMOUNT" // The goal is about getting a certain amount in USD from sponsorships each month. ) // SponsorsTierOrderField represents properties by which Sponsors tiers connections can be ordered. @@ -1459,6 +1520,14 @@ const ( SponsorsTierOrderFieldMonthlyPriceInCents SponsorsTierOrderField = "MONTHLY_PRICE_IN_CENTS" // Order tiers by their monthly price in cents. ) +// SponsorshipNewsletterOrderField represents properties by which sponsorship update connections can be ordered. +type SponsorshipNewsletterOrderField string + +// Properties by which sponsorship update connections can be ordered. +const ( + SponsorshipNewsletterOrderFieldCreatedAt SponsorshipNewsletterOrderField = "CREATED_AT" // Order sponsorship newsletters by when they were created. +) + // SponsorshipOrderField represents properties by which sponsorship connections can be ordered. type SponsorshipOrderField string diff --git a/vendor/github.com/shurcooL/githubv4/input.go b/vendor/github.com/shurcooL/githubv4/input.go index 266eeca09e..37ee58231a 100644 --- a/vendor/github.com/shurcooL/githubv4/input.go +++ b/vendor/github.com/shurcooL/githubv4/input.go @@ -4,7 +4,7 @@ package githubv4 // Input represents one of the Input structs: // -// AcceptEnterpriseAdministratorInvitationInput, AcceptTopicSuggestionInput, AddAssigneesToAssignableInput, AddCommentInput, AddDiscussionCommentInput, AddEnterpriseSupportEntitlementInput, AddLabelsToLabelableInput, AddProjectCardInput, AddProjectColumnInput, AddPullRequestReviewCommentInput, AddPullRequestReviewInput, AddPullRequestReviewThreadInput, AddReactionInput, AddStarInput, AddUpvoteInput, AddVerifiableDomainInput, ApproveDeploymentsInput, ApproveVerifiableDomainInput, ArchiveRepositoryInput, AuditLogOrder, CancelEnterpriseAdminInvitationInput, ChangeUserStatusInput, CheckAnnotationData, CheckAnnotationRange, CheckRunAction, CheckRunFilter, CheckRunOutput, CheckRunOutputImage, CheckSuiteAutoTriggerPreference, CheckSuiteFilter, ClearLabelsFromLabelableInput, CloneProjectInput, CloneTemplateRepositoryInput, CloseIssueInput, ClosePullRequestInput, CommitAuthor, CommitContributionOrder, ContributionOrder, ConvertProjectCardNoteToIssueInput, ConvertPullRequestToDraftInput, CreateBranchProtectionRuleInput, CreateCheckRunInput, CreateCheckSuiteInput, CreateDiscussionInput, CreateEnterpriseOrganizationInput, CreateEnvironmentInput, CreateIpAllowListEntryInput, CreateIssueInput, CreateProjectInput, CreatePullRequestInput, CreateRefInput, CreateRepositoryInput, CreateTeamDiscussionCommentInput, CreateTeamDiscussionInput, DeclineTopicSuggestionInput, DeleteBranchProtectionRuleInput, DeleteDeploymentInput, DeleteDiscussionCommentInput, DeleteDiscussionInput, DeleteEnvironmentInput, DeleteIpAllowListEntryInput, DeleteIssueCommentInput, DeleteIssueInput, DeleteProjectCardInput, DeleteProjectColumnInput, DeleteProjectInput, DeletePullRequestReviewCommentInput, DeletePullRequestReviewInput, DeleteRefInput, DeleteTeamDiscussionCommentInput, DeleteTeamDiscussionInput, DeleteVerifiableDomainInput, DeploymentOrder, DisablePullRequestAutoMergeInput, DiscussionOrder, DismissPullRequestReviewInput, DraftPullRequestReviewComment, DraftPullRequestReviewThread, EnablePullRequestAutoMergeInput, EnterpriseAdministratorInvitationOrder, EnterpriseMemberOrder, EnterpriseServerInstallationOrder, EnterpriseServerUserAccountEmailOrder, EnterpriseServerUserAccountOrder, EnterpriseServerUserAccountsUploadOrder, FollowUserInput, GistOrder, InviteEnterpriseAdminInput, IpAllowListEntryOrder, IssueCommentOrder, IssueFilters, IssueOrder, LabelOrder, LanguageOrder, LinkRepositoryToProjectInput, LockLockableInput, MarkDiscussionCommentAsAnswerInput, MarkFileAsViewedInput, MarkPullRequestReadyForReviewInput, MergeBranchInput, MergePullRequestInput, MilestoneOrder, MinimizeCommentInput, MoveProjectCardInput, MoveProjectColumnInput, OrganizationOrder, PackageFileOrder, PackageOrder, PackageVersionOrder, PinIssueInput, ProjectOrder, PullRequestOrder, ReactionOrder, RefOrder, RegenerateEnterpriseIdentityProviderRecoveryCodesInput, RegenerateVerifiableDomainTokenInput, RejectDeploymentsInput, ReleaseOrder, RemoveAssigneesFromAssignableInput, RemoveEnterpriseAdminInput, RemoveEnterpriseIdentityProviderInput, RemoveEnterpriseOrganizationInput, RemoveEnterpriseSupportEntitlementInput, RemoveLabelsFromLabelableInput, RemoveOutsideCollaboratorInput, RemoveReactionInput, RemoveStarInput, RemoveUpvoteInput, ReopenIssueInput, ReopenPullRequestInput, RepositoryInvitationOrder, RepositoryOrder, RequestReviewsInput, RerequestCheckSuiteInput, ResolveReviewThreadInput, SavedReplyOrder, SecurityAdvisoryIdentifierFilter, SecurityAdvisoryOrder, SecurityVulnerabilityOrder, SetEnterpriseIdentityProviderInput, SetOrganizationInteractionLimitInput, SetRepositoryInteractionLimitInput, SetUserInteractionLimitInput, SponsorableOrder, SponsorsActivityOrder, SponsorsTierOrder, SponsorshipOrder, StarOrder, SubmitPullRequestReviewInput, TeamDiscussionCommentOrder, TeamDiscussionOrder, TeamMemberOrder, TeamOrder, TeamRepositoryOrder, TransferIssueInput, UnarchiveRepositoryInput, UnfollowUserInput, UnlinkRepositoryFromProjectInput, UnlockLockableInput, UnmarkDiscussionCommentAsAnswerInput, UnmarkFileAsViewedInput, UnmarkIssueAsDuplicateInput, UnminimizeCommentInput, UnpinIssueInput, UnresolveReviewThreadInput, UpdateBranchProtectionRuleInput, UpdateCheckRunInput, UpdateCheckSuitePreferencesInput, UpdateDiscussionCommentInput, UpdateDiscussionInput, UpdateEnterpriseAdministratorRoleInput, UpdateEnterpriseAllowPrivateRepositoryForkingSettingInput, UpdateEnterpriseDefaultRepositoryPermissionSettingInput, UpdateEnterpriseMembersCanChangeRepositoryVisibilitySettingInput, UpdateEnterpriseMembersCanCreateRepositoriesSettingInput, UpdateEnterpriseMembersCanDeleteIssuesSettingInput, UpdateEnterpriseMembersCanDeleteRepositoriesSettingInput, UpdateEnterpriseMembersCanInviteCollaboratorsSettingInput, UpdateEnterpriseMembersCanMakePurchasesSettingInput, UpdateEnterpriseMembersCanUpdateProtectedBranchesSettingInput, UpdateEnterpriseMembersCanViewDependencyInsightsSettingInput, UpdateEnterpriseOrganizationProjectsSettingInput, UpdateEnterpriseProfileInput, UpdateEnterpriseRepositoryProjectsSettingInput, UpdateEnterpriseTeamDiscussionsSettingInput, UpdateEnterpriseTwoFactorAuthenticationRequiredSettingInput, UpdateEnvironmentInput, UpdateIpAllowListEnabledSettingInput, UpdateIpAllowListEntryInput, UpdateIpAllowListForInstalledAppsEnabledSettingInput, UpdateIssueCommentInput, UpdateIssueInput, UpdateNotificationRestrictionSettingInput, UpdateProjectCardInput, UpdateProjectColumnInput, UpdateProjectInput, UpdatePullRequestInput, UpdatePullRequestReviewCommentInput, UpdatePullRequestReviewInput, UpdateRefInput, UpdateRepositoryInput, UpdateSubscriptionInput, UpdateTeamDiscussionCommentInput, UpdateTeamDiscussionInput, UpdateTopicsInput, UserStatusOrder, VerifiableDomainOrder, VerifyVerifiableDomainInput. +// AcceptEnterpriseAdministratorInvitationInput, AcceptTopicSuggestionInput, AddAssigneesToAssignableInput, AddCommentInput, AddDiscussionCommentInput, AddEnterpriseSupportEntitlementInput, AddLabelsToLabelableInput, AddProjectCardInput, AddProjectColumnInput, AddProjectNextItemInput, AddPullRequestReviewCommentInput, AddPullRequestReviewInput, AddPullRequestReviewThreadInput, AddReactionInput, AddStarInput, AddUpvoteInput, AddVerifiableDomainInput, ApproveDeploymentsInput, ApproveVerifiableDomainInput, ArchiveRepositoryInput, AuditLogOrder, CancelEnterpriseAdminInvitationInput, CancelSponsorshipInput, ChangeUserStatusInput, CheckAnnotationData, CheckAnnotationRange, CheckRunAction, CheckRunFilter, CheckRunOutput, CheckRunOutputImage, CheckSuiteAutoTriggerPreference, CheckSuiteFilter, ClearLabelsFromLabelableInput, CloneProjectInput, CloneTemplateRepositoryInput, CloseIssueInput, ClosePullRequestInput, CommitAuthor, CommitContributionOrder, CommitMessage, CommittableBranch, ContributionOrder, ConvertProjectCardNoteToIssueInput, ConvertPullRequestToDraftInput, CreateBranchProtectionRuleInput, CreateCheckRunInput, CreateCheckSuiteInput, CreateCommitOnBranchInput, CreateDiscussionInput, CreateEnterpriseOrganizationInput, CreateEnvironmentInput, CreateIpAllowListEntryInput, CreateIssueInput, CreateProjectInput, CreatePullRequestInput, CreateRefInput, CreateRepositoryInput, CreateSponsorshipInput, CreateTeamDiscussionCommentInput, CreateTeamDiscussionInput, DeclineTopicSuggestionInput, DeleteBranchProtectionRuleInput, DeleteDeploymentInput, DeleteDiscussionCommentInput, DeleteDiscussionInput, DeleteEnvironmentInput, DeleteIpAllowListEntryInput, DeleteIssueCommentInput, DeleteIssueInput, DeleteProjectCardInput, DeleteProjectColumnInput, DeleteProjectInput, DeleteProjectNextItemInput, DeletePullRequestReviewCommentInput, DeletePullRequestReviewInput, DeleteRefInput, DeleteTeamDiscussionCommentInput, DeleteTeamDiscussionInput, DeleteVerifiableDomainInput, DeploymentOrder, DisablePullRequestAutoMergeInput, DiscussionOrder, DismissPullRequestReviewInput, DismissRepositoryVulnerabilityAlertInput, DraftPullRequestReviewComment, DraftPullRequestReviewThread, EnablePullRequestAutoMergeInput, EnterpriseAdministratorInvitationOrder, EnterpriseMemberOrder, EnterpriseServerInstallationOrder, EnterpriseServerUserAccountEmailOrder, EnterpriseServerUserAccountOrder, EnterpriseServerUserAccountsUploadOrder, FileAddition, FileChanges, FileDeletion, FollowUserInput, GistOrder, InviteEnterpriseAdminInput, IpAllowListEntryOrder, IssueCommentOrder, IssueFilters, IssueOrder, LabelOrder, LanguageOrder, LinkRepositoryToProjectInput, LockLockableInput, MarkDiscussionCommentAsAnswerInput, MarkFileAsViewedInput, MarkPullRequestReadyForReviewInput, MergeBranchInput, MergePullRequestInput, MilestoneOrder, MinimizeCommentInput, MoveProjectCardInput, MoveProjectColumnInput, OrgEnterpriseOwnerOrder, OrganizationOrder, PackageFileOrder, PackageOrder, PackageVersionOrder, PinIssueInput, ProjectOrder, PullRequestOrder, ReactionOrder, RefOrder, RegenerateEnterpriseIdentityProviderRecoveryCodesInput, RegenerateVerifiableDomainTokenInput, RejectDeploymentsInput, ReleaseOrder, RemoveAssigneesFromAssignableInput, RemoveEnterpriseAdminInput, RemoveEnterpriseIdentityProviderInput, RemoveEnterpriseOrganizationInput, RemoveEnterpriseSupportEntitlementInput, RemoveLabelsFromLabelableInput, RemoveOutsideCollaboratorInput, RemoveReactionInput, RemoveStarInput, RemoveUpvoteInput, ReopenIssueInput, ReopenPullRequestInput, RepositoryInvitationOrder, RepositoryOrder, RequestReviewsInput, RequiredStatusCheckInput, RerequestCheckSuiteInput, ResolveReviewThreadInput, SavedReplyOrder, SecurityAdvisoryIdentifierFilter, SecurityAdvisoryOrder, SecurityVulnerabilityOrder, SetEnterpriseIdentityProviderInput, SetOrganizationInteractionLimitInput, SetRepositoryInteractionLimitInput, SetUserInteractionLimitInput, SponsorOrder, SponsorableOrder, SponsorsActivityOrder, SponsorsTierOrder, SponsorshipNewsletterOrder, SponsorshipOrder, StarOrder, SubmitPullRequestReviewInput, TeamDiscussionCommentOrder, TeamDiscussionOrder, TeamMemberOrder, TeamOrder, TeamRepositoryOrder, TransferIssueInput, UnarchiveRepositoryInput, UnfollowUserInput, UnlinkRepositoryFromProjectInput, UnlockLockableInput, UnmarkDiscussionCommentAsAnswerInput, UnmarkFileAsViewedInput, UnmarkIssueAsDuplicateInput, UnminimizeCommentInput, UnpinIssueInput, UnresolveReviewThreadInput, UpdateBranchProtectionRuleInput, UpdateCheckRunInput, UpdateCheckSuitePreferencesInput, UpdateDiscussionCommentInput, UpdateDiscussionInput, UpdateEnterpriseAdministratorRoleInput, UpdateEnterpriseAllowPrivateRepositoryForkingSettingInput, UpdateEnterpriseDefaultRepositoryPermissionSettingInput, UpdateEnterpriseMembersCanChangeRepositoryVisibilitySettingInput, UpdateEnterpriseMembersCanCreateRepositoriesSettingInput, UpdateEnterpriseMembersCanDeleteIssuesSettingInput, UpdateEnterpriseMembersCanDeleteRepositoriesSettingInput, UpdateEnterpriseMembersCanInviteCollaboratorsSettingInput, UpdateEnterpriseMembersCanMakePurchasesSettingInput, UpdateEnterpriseMembersCanUpdateProtectedBranchesSettingInput, UpdateEnterpriseMembersCanViewDependencyInsightsSettingInput, UpdateEnterpriseOrganizationProjectsSettingInput, UpdateEnterpriseProfileInput, UpdateEnterpriseRepositoryProjectsSettingInput, UpdateEnterpriseTeamDiscussionsSettingInput, UpdateEnterpriseTwoFactorAuthenticationRequiredSettingInput, UpdateEnvironmentInput, UpdateIpAllowListEnabledSettingInput, UpdateIpAllowListEntryInput, UpdateIpAllowListForInstalledAppsEnabledSettingInput, UpdateIssueCommentInput, UpdateIssueInput, UpdateNotificationRestrictionSettingInput, UpdateOrganizationAllowPrivateRepositoryForkingSettingInput, UpdateProjectCardInput, UpdateProjectColumnInput, UpdateProjectInput, UpdateProjectNextItemFieldInput, UpdatePullRequestBranchInput, UpdatePullRequestInput, UpdatePullRequestReviewCommentInput, UpdatePullRequestReviewInput, UpdateRefInput, UpdateRepositoryInput, UpdateSponsorshipPreferencesInput, UpdateSubscriptionInput, UpdateTeamDiscussionCommentInput, UpdateTeamDiscussionInput, UpdateTopicsInput, UserStatusOrder, VerifiableDomainOrder, VerifyVerifiableDomainInput. type Input interface{} // AcceptEnterpriseAdministratorInvitationInput is an autogenerated input type of AcceptEnterpriseAdministratorInvitation. @@ -108,6 +108,17 @@ type AddProjectColumnInput struct { ClientMutationID *String `json:"clientMutationId,omitempty"` } +// AddProjectNextItemInput is an autogenerated input type of AddProjectNextItem. +type AddProjectNextItemInput struct { + // The ID of the Project to add the item to. (Required.) + ProjectID ID `json:"projectId"` + // The content id of the item (Issue or PullRequest). (Required.) + ContentID ID `json:"contentId"` + + // A unique identifier for the client performing the mutation. (Optional.) + ClientMutationID *String `json:"clientMutationId,omitempty"` +} + // AddPullRequestReviewCommentInput is an autogenerated input type of AddPullRequestReviewComment. type AddPullRequestReviewCommentInput struct { // The text of the comment. (Required.) @@ -260,6 +271,21 @@ type CancelEnterpriseAdminInvitationInput struct { ClientMutationID *String `json:"clientMutationId,omitempty"` } +// CancelSponsorshipInput is an autogenerated input type of CancelSponsorship. +type CancelSponsorshipInput struct { + + // The ID of the user or organization who is acting as the sponsor, paying for the sponsorship. Required if sponsorLogin is not given. (Optional.) + SponsorID *ID `json:"sponsorId,omitempty"` + // The username of the user or organization who is acting as the sponsor, paying for the sponsorship. Required if sponsorId is not given. (Optional.) + SponsorLogin *String `json:"sponsorLogin,omitempty"` + // The ID of the user or organization who is receiving the sponsorship. Required if sponsorableLogin is not given. (Optional.) + SponsorableID *ID `json:"sponsorableId,omitempty"` + // The username of the user or organization who is receiving the sponsorship. Required if sponsorableId is not given. (Optional.) + SponsorableLogin *String `json:"sponsorableLogin,omitempty"` + // A unique identifier for the client performing the mutation. (Optional.) + ClientMutationID *String `json:"clientMutationId,omitempty"` +} + // ChangeUserStatusInput is an autogenerated input type of ChangeUserStatus. type ChangeUserStatusInput struct { @@ -455,6 +481,26 @@ type CommitContributionOrder struct { Direction OrderDirection `json:"direction"` } +// CommitMessage represents a message to include with a new commit. +type CommitMessage struct { + // The headline of the message. (Required.) + Headline String `json:"headline"` + + // The body of the message. (Optional.) + Body *String `json:"body,omitempty"` +} + +// CommittableBranch represents a git ref for a commit to be appended to. The ref must be a branch, i.e. its fully qualified name must start with `refs/heads/` (although the input is not required to be fully qualified). The Ref may be specified by its global node ID or by the repository nameWithOwner and branch name. ### Examples Specify a branch using a global node ID: { "id": "MDM6UmVmMTpyZWZzL2hlYWRzL21haW4=" } Specify a branch using nameWithOwner and branch name: { "nameWithOwner": "github/graphql-client", "branchName": "main" }. +type CommittableBranch struct { + + // The Node ID of the Ref to be updated. (Optional.) + ID *ID `json:"id,omitempty"` + // The nameWithOwner of the repository to commit to. (Optional.) + RepositoryNameWithOwner *String `json:"repositoryNameWithOwner,omitempty"` + // The unqualified name of the branch to append the commit to. (Optional.) + BranchName *String `json:"branchName,omitempty"` +} + // ContributionOrder represents ordering options for contribution connections. type ContributionOrder struct { // The ordering direction. (Required.) @@ -518,12 +564,18 @@ type CreateBranchProtectionRuleInput struct { RestrictsReviewDismissals *Boolean `json:"restrictsReviewDismissals,omitempty"` // A list of User or Team IDs allowed to dismiss reviews on pull requests targeting matching branches. (Optional.) ReviewDismissalActorIDs *[]ID `json:"reviewDismissalActorIds,omitempty"` + // A list of User or Team IDs allowed to bypass pull requests targeting matching branches. (Optional.) + BypassPullRequestActorIDs *[]ID `json:"bypassPullRequestActorIds,omitempty"` + // A list of User or Team IDs allowed to bypass force push targeting matching branches. (Optional.) + BypassForcePushActorIDs *[]ID `json:"bypassForcePushActorIds,omitempty"` // Is pushing to matching branches restricted. (Optional.) RestrictsPushes *Boolean `json:"restrictsPushes,omitempty"` // A list of User, Team or App IDs allowed to push to matching branches. (Optional.) PushActorIDs *[]ID `json:"pushActorIds,omitempty"` // List of required status check contexts that must pass for commits to be accepted to matching branches. (Optional.) RequiredStatusCheckContexts *[]String `json:"requiredStatusCheckContexts,omitempty"` + // The list of required status checks. (Optional.) + RequiredStatusChecks *[]RequiredStatusCheckInput `json:"requiredStatusChecks,omitempty"` // Are conversations required to be resolved before merging. (Optional.) RequiresConversationResolution *Boolean `json:"requiresConversationResolution,omitempty"` // A unique identifier for the client performing the mutation. (Optional.) @@ -570,6 +622,21 @@ type CreateCheckSuiteInput struct { ClientMutationID *String `json:"clientMutationId,omitempty"` } +// CreateCommitOnBranchInput is an autogenerated input type of CreateCommitOnBranch. +type CreateCommitOnBranchInput struct { + // The Ref to be updated. Must be a branch. (Required.) + Branch CommittableBranch `json:"branch"` + // The commit message the be included with the commit. (Required.) + Message CommitMessage `json:"message"` + // The git commit oid expected at the head of the branch prior to the commit. (Required.) + ExpectedHeadOid GitObjectID `json:"expectedHeadOid"` + + // A description of changes to files in this commit. (Optional.) + FileChanges *FileChanges `json:"fileChanges,omitempty"` + // A unique identifier for the client performing the mutation. (Optional.) + ClientMutationID *String `json:"clientMutationId,omitempty"` +} + // CreateDiscussionInput is an autogenerated input type of CreateDiscussion. type CreateDiscussionInput struct { // The id of the repository on which to create the discussion. (Required.) @@ -727,6 +794,31 @@ type CreateRepositoryInput struct { ClientMutationID *String `json:"clientMutationId,omitempty"` } +// CreateSponsorshipInput is an autogenerated input type of CreateSponsorship. +type CreateSponsorshipInput struct { + + // The ID of the user or organization who is acting as the sponsor, paying for the sponsorship. Required if sponsorLogin is not given. (Optional.) + SponsorID *ID `json:"sponsorId,omitempty"` + // The username of the user or organization who is acting as the sponsor, paying for the sponsorship. Required if sponsorId is not given. (Optional.) + SponsorLogin *String `json:"sponsorLogin,omitempty"` + // The ID of the user or organization who is receiving the sponsorship. Required if sponsorableLogin is not given. (Optional.) + SponsorableID *ID `json:"sponsorableId,omitempty"` + // The username of the user or organization who is receiving the sponsorship. Required if sponsorableId is not given. (Optional.) + SponsorableLogin *String `json:"sponsorableLogin,omitempty"` + // The ID of one of sponsorable's existing tiers to sponsor at. Required if amount is not specified. (Optional.) + TierID *ID `json:"tierId,omitempty"` + // The amount to pay to the sponsorable in US dollars. Required if a tierId is not specified. Valid values: 1-12000. (Optional.) + Amount *Int `json:"amount,omitempty"` + // Whether the sponsorship should happen monthly/yearly or just this one time. Required if a tierId is not specified. (Optional.) + IsRecurring *Boolean `json:"isRecurring,omitempty"` + // Whether the sponsor should receive email updates from the sponsorable. (Optional.) + ReceiveEmails *Boolean `json:"receiveEmails,omitempty"` + // Specify whether others should be able to see that the sponsor is sponsoring the sponsorable. Public visibility still does not reveal which tier is used. (Optional.) + PrivacyLevel *SponsorshipPrivacy `json:"privacyLevel,omitempty"` + // A unique identifier for the client performing the mutation. (Optional.) + ClientMutationID *String `json:"clientMutationId,omitempty"` +} + // CreateTeamDiscussionCommentInput is an autogenerated input type of CreateTeamDiscussionComment. type CreateTeamDiscussionCommentInput struct { // The ID of the discussion to which the comment belongs. (Required.) @@ -865,6 +957,17 @@ type DeleteProjectInput struct { ClientMutationID *String `json:"clientMutationId,omitempty"` } +// DeleteProjectNextItemInput is an autogenerated input type of DeleteProjectNextItem. +type DeleteProjectNextItemInput struct { + // The ID of the Project from which the item should be removed. (Required.) + ProjectID ID `json:"projectId"` + // The ID of the item to be removed. (Required.) + ItemID ID `json:"itemId"` + + // A unique identifier for the client performing the mutation. (Optional.) + ClientMutationID *String `json:"clientMutationId,omitempty"` +} + // DeletePullRequestReviewCommentInput is an autogenerated input type of DeletePullRequestReviewComment. type DeletePullRequestReviewCommentInput struct { // The ID of the comment to delete. (Required.) @@ -955,6 +1058,17 @@ type DismissPullRequestReviewInput struct { ClientMutationID *String `json:"clientMutationId,omitempty"` } +// DismissRepositoryVulnerabilityAlertInput is an autogenerated input type of DismissRepositoryVulnerabilityAlert. +type DismissRepositoryVulnerabilityAlertInput struct { + // The Dependabot alert ID to dismiss. (Required.) + RepositoryVulnerabilityAlertID ID `json:"repositoryVulnerabilityAlertId"` + // The reason the Dependabot alert is being dismissed. (Required.) + DismissReason DismissReason `json:"dismissReason"` + + // A unique identifier for the client performing the mutation. (Optional.) + ClientMutationID *String `json:"clientMutationId,omitempty"` +} + // DraftPullRequestReviewComment specifies a review comment to be left with a Pull Request Review. type DraftPullRequestReviewComment struct { // Path to the file being commented on. (Required.) @@ -1047,6 +1161,29 @@ type EnterpriseServerUserAccountsUploadOrder struct { Direction OrderDirection `json:"direction"` } +// FileAddition represents a command to add a file at the given path with the given contents as part of a commit. Any existing file at that that path will be replaced. +type FileAddition struct { + // The path in the repository where the file will be located. (Required.) + Path String `json:"path"` + // The base64 encoded contents of the file. (Required.) + Contents Base64String `json:"contents"` +} + +// FileChanges represents a description of a set of changes to a file tree to be made as part of a git commit, modeled as zero or more file `additions` and zero or more file `deletions`. Both fields are optional; omitting both will produce a commit with no file changes. `deletions` and `additions` describe changes to files identified by their path in the git tree using unix-style path separators, i.e. `/`. The root of a git tree is an empty string, so paths are not slash-prefixed. `path` values must be unique across all `additions` and `deletions` provided. Any duplication will result in a validation error. ### Encoding File contents must be provided in full for each `FileAddition`. The `contents` of a `FileAddition` must be encoded using RFC 4648 compliant base64, i.e. correct padding is required and no characters outside the standard alphabet may be used. Invalid base64 encoding will be rejected with a validation error. The encoded contents may be binary. For text files, no assumptions are made about the character encoding of the file contents (after base64 decoding). No charset transcoding or line-ending normalization will be performed; it is the client's responsibility to manage the character encoding of files they provide. However, for maximum compatibility we recommend using UTF-8 encoding and ensuring that all files in a repository use a consistent line-ending convention (`\n` or `\r\n`), and that all files end with a newline. ### Modeling file changes Each of the the five types of conceptual changes that can be made in a git commit can be described using the `FileChanges` type as follows: 1. New file addition: create file `hello world\n` at path `docs/README.txt`: { "additions" [ { "path": "docs/README.txt", "contents": base64encode("hello world\n") } ] } 2. Existing file modification: change existing `docs/README.txt` to have new content `new content here\n`: { "additions" [ { "path": "docs/README.txt", "contents": base64encode("new content here\n") } ] } 3. Existing file deletion: remove existing file `docs/README.txt`. Note that the path is required to exist -- specifying a path that does not exist on the given branch will abort the commit and return an error. { "deletions" [ { "path": "docs/README.txt" } ] } 4. File rename with no changes: rename `docs/README.txt` with previous content `hello world\n` to the same content at `newdocs/README.txt`: { "deletions" [ { "path": "docs/README.txt", } ], "additions" [ { "path": "newdocs/README.txt", "contents": base64encode("hello world\n") } ] } 5. File rename with changes: rename `docs/README.txt` with previous content `hello world\n` to a file at path `newdocs/README.txt` with content `new contents\n`: { "deletions" [ { "path": "docs/README.txt", } ], "additions" [ { "path": "newdocs/README.txt", "contents": base64encode("new contents\n") } ] }. +type FileChanges struct { + + // Files to delete. (Optional.) + Deletions *[]FileDeletion `json:"deletions,omitempty"` + // File to add or change. (Optional.) + Additions *[]FileAddition `json:"additions,omitempty"` +} + +// FileDeletion represents a command to delete the file at the given path as part of a commit. +type FileDeletion struct { + // The path to delete. (Required.) + Path String `json:"path"` +} + // FollowUserInput is an autogenerated input type of FollowUser. type FollowUserInput struct { // ID of the user to follow. (Required.) @@ -1270,6 +1407,14 @@ type MoveProjectColumnInput struct { ClientMutationID *String `json:"clientMutationId,omitempty"` } +// OrgEnterpriseOwnerOrder represents ordering options for an organization's enterprise owner connections. +type OrgEnterpriseOwnerOrder struct { + // The field to order enterprise owners by. (Required.) + Field OrgEnterpriseOwnerOrderField `json:"field"` + // The ordering direction. (Required.) + Direction OrderDirection `json:"direction"` +} + // OrganizationOrder represents ordering options for organization connections. type OrganizationOrder struct { // The field to order organizations by. (Required.) @@ -1538,6 +1683,15 @@ type RequestReviewsInput struct { ClientMutationID *String `json:"clientMutationId,omitempty"` } +// RequiredStatusCheckInput specifies the attributes for a new or updated required status check. +type RequiredStatusCheckInput struct { + // Status check context that must pass for commits to be accepted to the matching branch. (Required.) + Context String `json:"context"` + + // The ID of the App that must set the status in order for it to be accepted. Omit this value to use whichever app has recently been setting this status, or use "any" to allow any app to set the status. (Optional.) + AppID *ID `json:"appId,omitempty"` +} + // RerequestCheckSuiteInput is an autogenerated input type of RerequestCheckSuite. type RerequestCheckSuiteInput struct { // The Node ID of the repository. (Required.) @@ -1648,6 +1802,14 @@ type SetUserInteractionLimitInput struct { ClientMutationID *String `json:"clientMutationId,omitempty"` } +// SponsorOrder represents ordering options for connections to get sponsor entities for GitHub Sponsors. +type SponsorOrder struct { + // The field to order sponsor entities by. (Required.) + Field SponsorOrderField `json:"field"` + // The ordering direction. (Required.) + Direction OrderDirection `json:"direction"` +} + // SponsorableOrder represents ordering options for connections to get sponsorable entities for GitHub Sponsors. type SponsorableOrder struct { // The field to order sponsorable entities by. (Required.) @@ -1672,6 +1834,14 @@ type SponsorsTierOrder struct { Direction OrderDirection `json:"direction"` } +// SponsorshipNewsletterOrder represents ordering options for sponsorship newsletter connections. +type SponsorshipNewsletterOrder struct { + // The field to order sponsorship newsletters by. (Required.) + Field SponsorshipNewsletterOrderField `json:"field"` + // The ordering direction. (Required.) + Direction OrderDirection `json:"direction"` +} + // SponsorshipOrder represents ordering options for sponsorship connections. type SponsorshipOrder struct { // The field to order sponsorship by. (Required.) @@ -1883,12 +2053,18 @@ type UpdateBranchProtectionRuleInput struct { RestrictsReviewDismissals *Boolean `json:"restrictsReviewDismissals,omitempty"` // A list of User or Team IDs allowed to dismiss reviews on pull requests targeting matching branches. (Optional.) ReviewDismissalActorIDs *[]ID `json:"reviewDismissalActorIds,omitempty"` + // A list of User or Team IDs allowed to bypass pull requests targeting matching branches. (Optional.) + BypassPullRequestActorIDs *[]ID `json:"bypassPullRequestActorIds,omitempty"` + // A list of User or Team IDs allowed to bypass force push targeting matching branches. (Optional.) + BypassForcePushActorIDs *[]ID `json:"bypassForcePushActorIds,omitempty"` // Is pushing to matching branches restricted. (Optional.) RestrictsPushes *Boolean `json:"restrictsPushes,omitempty"` // A list of User, Team or App IDs allowed to push to matching branches. (Optional.) PushActorIDs *[]ID `json:"pushActorIds,omitempty"` // List of required status check contexts that must pass for commits to be accepted to matching branches. (Optional.) RequiredStatusCheckContexts *[]String `json:"requiredStatusCheckContexts,omitempty"` + // The list of required status checks. (Optional.) + RequiredStatusChecks *[]RequiredStatusCheckInput `json:"requiredStatusChecks,omitempty"` // Are conversations required to be resolved before merging. (Optional.) RequiresConversationResolution *Boolean `json:"requiresConversationResolution,omitempty"` // A unique identifier for the client performing the mutation. (Optional.) @@ -2248,6 +2424,17 @@ type UpdateNotificationRestrictionSettingInput struct { ClientMutationID *String `json:"clientMutationId,omitempty"` } +// UpdateOrganizationAllowPrivateRepositoryForkingSettingInput is an autogenerated input type of UpdateOrganizationAllowPrivateRepositoryForkingSetting. +type UpdateOrganizationAllowPrivateRepositoryForkingSettingInput struct { + // The ID of the organization on which to set the allow private repository forking setting. (Required.) + OrganizationID ID `json:"organizationId"` + // Enable forking of private repositories in the organization?. (Required.) + ForkingEnabled Boolean `json:"forkingEnabled"` + + // A unique identifier for the client performing the mutation. (Optional.) + ClientMutationID *String `json:"clientMutationId,omitempty"` +} + // UpdateProjectCardInput is an autogenerated input type of UpdateProjectCard. type UpdateProjectCardInput struct { // The ProjectCard ID to update. (Required.) @@ -2289,6 +2476,32 @@ type UpdateProjectInput struct { ClientMutationID *String `json:"clientMutationId,omitempty"` } +// UpdateProjectNextItemFieldInput is an autogenerated input type of UpdateProjectNextItemField. +type UpdateProjectNextItemFieldInput struct { + // The ID of the Project. (Required.) + ProjectID ID `json:"projectId"` + // The id of the item to be updated. (Required.) + ItemID ID `json:"itemId"` + // The id of the field to be updated. Only supports custom fields and status for now. (Required.) + FieldID ID `json:"fieldId"` + // The value which will be set on the field. (Required.) + Value String `json:"value"` + + // A unique identifier for the client performing the mutation. (Optional.) + ClientMutationID *String `json:"clientMutationId,omitempty"` +} + +// UpdatePullRequestBranchInput is an autogenerated input type of UpdatePullRequestBranch. +type UpdatePullRequestBranchInput struct { + // The Node ID of the pull request. (Required.) + PullRequestID ID `json:"pullRequestId"` + + // The head ref oid for the upstream branch. (Optional.) + ExpectedHeadOid *GitObjectID `json:"expectedHeadOid,omitempty"` + // A unique identifier for the client performing the mutation. (Optional.) + ClientMutationID *String `json:"clientMutationId,omitempty"` +} + // UpdatePullRequestInput is an autogenerated input type of UpdatePullRequest. type UpdatePullRequestInput struct { // The Node ID of the pull request. (Required.) @@ -2374,6 +2587,25 @@ type UpdateRepositoryInput struct { ClientMutationID *String `json:"clientMutationId,omitempty"` } +// UpdateSponsorshipPreferencesInput is an autogenerated input type of UpdateSponsorshipPreferences. +type UpdateSponsorshipPreferencesInput struct { + + // The ID of the user or organization who is acting as the sponsor, paying for the sponsorship. Required if sponsorLogin is not given. (Optional.) + SponsorID *ID `json:"sponsorId,omitempty"` + // The username of the user or organization who is acting as the sponsor, paying for the sponsorship. Required if sponsorId is not given. (Optional.) + SponsorLogin *String `json:"sponsorLogin,omitempty"` + // The ID of the user or organization who is receiving the sponsorship. Required if sponsorableLogin is not given. (Optional.) + SponsorableID *ID `json:"sponsorableId,omitempty"` + // The username of the user or organization who is receiving the sponsorship. Required if sponsorableId is not given. (Optional.) + SponsorableLogin *String `json:"sponsorableLogin,omitempty"` + // Whether the sponsor should receive email updates from the sponsorable. (Optional.) + ReceiveEmails *Boolean `json:"receiveEmails,omitempty"` + // Specify whether others should be able to see that the sponsor is sponsoring the sponsorable. Public visibility still does not reveal which tier is used. (Optional.) + PrivacyLevel *SponsorshipPrivacy `json:"privacyLevel,omitempty"` + // A unique identifier for the client performing the mutation. (Optional.) + ClientMutationID *String `json:"clientMutationId,omitempty"` +} + // UpdateSubscriptionInput is an autogenerated input type of UpdateSubscription. type UpdateSubscriptionInput struct { // The Node ID of the subscribable object to modify. (Required.) diff --git a/vendor/github.com/shurcooL/githubv4/scalar.go b/vendor/github.com/shurcooL/githubv4/scalar.go index 56a395303f..c91574c93e 100644 --- a/vendor/github.com/shurcooL/githubv4/scalar.go +++ b/vendor/github.com/shurcooL/githubv4/scalar.go @@ -20,6 +20,9 @@ import ( // is resolved, native Go types can completely replace these. type ( + // Base64String is a (potentially binary) string encoded using base64. + Base64String string + // Boolean represents true or false values. Boolean graphql.Boolean @@ -102,6 +105,9 @@ func (x *X509Certificate) UnmarshalJSON(data []byte) error { return fmt.Errorf("X509Certificate.UnmarshalJSON: not implemented") } +// NewBase64String is a helper to make a new *Base64String. +func NewBase64String(v Base64String) *Base64String { return &v } + // NewBoolean is a helper to make a new *Boolean. func NewBoolean(v Boolean) *Boolean { return &v } diff --git a/vendor/modules.txt b/vendor/modules.txt index ddae63e0d4..2ff789bfa3 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -370,7 +370,7 @@ github.com/ryancurrah/gomodguard # github.com/securego/gosec v0.0.0-20200316084457-7da9f46445fd github.com/securego/gosec github.com/securego/gosec/rules -# github.com/shurcooL/githubv4 v0.0.0-20210725200734-83ba7b4c9228 +# github.com/shurcooL/githubv4 v0.0.0-20220106005112-0707a5a90543 ## explicit github.com/shurcooL/githubv4 # github.com/shurcooL/graphql v0.0.0-20181231061246-d48a9a75455f diff --git a/website/docs/r/branch_protection.html.markdown b/website/docs/r/branch_protection.html.markdown index e62cdfdf83..be5ee500d9 100644 --- a/website/docs/r/branch_protection.html.markdown +++ b/website/docs/r/branch_protection.html.markdown @@ -98,6 +98,7 @@ The following arguments are supported: * `dismiss_stale_reviews`: (Optional) Dismiss approved reviews automatically when a new commit is pushed. Defaults to `false`. * `restrict_dismissals`: (Optional) Restrict pull request review dismissals. * `dismissal_restrictions`: (Optional) The list of actor IDs with dismissal access. If not empty, `restrict_dismissals` is ignored. +* `pull_request_bypassers`: (Optional) The list of actor IDs that are allowed to bypass pull request requirements. * `require_code_owner_reviews`: (Optional) Require an approved review in pull requests including files with a designated code owner. Defaults to `false`. * `required_approving_review_count`: (Optional) Require x number of approvals to satisfy branch protection requirements. If this is specified it must be a number between 0-6. This requirement matches GitHub's API, see the upstream [documentation](https://developer.github.com/v3/repos/branches/#parameters-1) for more information.