Repository: google/go-github
Pull request #2358 (2022-05-04 17:41:07)

Add ReRequestCheckRun
Closes out https://github.com/google/go-github/issues/2357

Adds support for https://docs.github.com/en/rest/checks/runs#rerequest-a-check-run

google-cla[bot]: Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

For more information, open the [CLA check for this pull request](https://github.com/google/go-github/pull/2358/checks?check_run_id=6294519419).
codecov[bot]: # [Codecov](https://codecov.io/gh/google/go-github/pull/2358?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=google) Report
> Merging [#2358](https://codecov.io/gh/google/go-github/pull/2358?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=google) (e018f99) into [master](https://codecov.io/gh/google/go-github/commit/417479672f91fe869f8e15488b2d936f05b21be6?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=google) (4174796) will **increase** coverage by `0.00%`.
> The diff coverage is `100.00%`.

```diff
@@           Coverage Diff           @@
##           master    #2358   +/-   ##
=======================================
  Coverage   98.05%   98.05%           
=======================================
  Files         119      119           
  Lines       10487    10498   +11     
=======================================
+ Hits        10283    10294   +11     
  Misses        140      140           
  Partials       64       64           
```


| [Impacted Files](https://codecov.io/gh/google/go-github/pull/2358?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=google) | Coverage Δ | |
|---|---|---|
| [github/checks.go](https://codecov.io/gh/google/go-github/pull/2358/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=google#diff-Z2l0aHViL2NoZWNrcy5nbw==) | `100.00% <100.00%> (ø)` | |

------

[Continue to review full report at Codecov](https://codecov.io/gh/google/go-github/pull/2358?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=google).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=google)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/google/go-github/pull/2358?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=google). Last update [4174796...e018f99](https://codecov.io/gh/google/go-github/pull/2358?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=google). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=google).


Patch:
diff --git a/github/actions_runner_groups.go b/github/actions_runner_groups.go
index 2d6a1546..da3ca0c7 100644
--- a/github/actions_runner_groups.go
+++ b/github/actions_runner_groups.go
@@ -61,10 +61,18 @@ type SetRunnerGroupRunnersRequest struct {
 	Runners []int64 `json:"runners"`
 }
 
+// ListOrgRunnerGroupOptions extend ListOptions to have the optional parameters VisibleToRepository.
+type ListOrgRunnerGroupOptions struct {
+	ListOptions
+
+	// Only return runner groups that are allowed to be used by this repository.
+	VisibleToRepository string `url:"visible_to_repository,omitempty"`
+}
+
 // ListOrganizationRunnerGroups lists all self-hosted runner groups configured in an organization.
 //
 // GitHub API docs: https://docs.github.com/en/rest/reference/actions#list-self-hosted-runner-groups-for-an-organization
-func (s *ActionsService) ListOrganizationRunnerGroups(ctx context.Context, org string, opts *ListOptions) (*RunnerGroups, *Response, error) {
+func (s *ActionsService) ListOrganizationRunnerGroups(ctx context.Context, org string, opts *ListOrgRunnerGroupOptions) (*RunnerGroups, *Response, error) {
 	u := fmt.Sprintf("orgs/%v/actions/runner-groups", org)
 	u, err := addOptions(u, opts)
 	if err != nil {
diff --git a/github/actions_workflow_runs.go b/github/actions_workflow_runs.go
index 05d55c03..470f0f07 100644
--- a/github/actions_workflow_runs.go
+++ b/github/actions_workflow_runs.go
@@ -211,6 +211,34 @@ func (s *ActionsService) RerunWorkflowByID(ctx context.Context, owner, repo stri
 	return s.client.Do(ctx, req, nil)
 }
 
+// RerunFailedJobsByID re-runs all of the failed jobs and their dependent jobs in a workflow run by ID.
+//
+// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/actions/workflow-runs#re-run-failed-jobs-from-a-workflow-run
+func (s *ActionsService) RerunFailedJobsByID(ctx context.Context, owner, repo string, runID int64) (*Response, error) {
+	u := fmt.Sprintf("repos/%v/%v/actions/runs/%v/rerun-failed-jobs", owner, repo, runID)
+
+	req, err := s.client.NewRequest("POST", u, nil)
+	if err != nil {
+		return nil, err
+	}
+
+	return s.client.Do(ctx, req, nil)
+}
+
+// RerunJobByID re-runs a job and its dependent jobs in a workflow run by ID.
+//
+// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/actions/workflow-runs#re-run-a-job-from-a-workflow-run
+func (s *ActionsService) RerunJobByID(ctx context.Context, owner, repo string, jobID int64) (*Response, error) {
+	u := fmt.Sprintf("repos/%v/%v/actions/jobs/%v/rerun", owner, repo, jobID)
+
+	req, err := s.client.NewRequest("POST", u, nil)
+	if err != nil {
+		return nil, err
+	}
+
+	return s.client.Do(ctx, req, nil)
+}
+
 // CancelWorkflowRunByID cancels a workflow run by ID.
 //
 // GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/actions/#cancel-a-workflow-run
diff --git a/github/checks.go b/github/checks.go
index 8e388e86..b4819fc9 100644
--- a/github/checks.go
+++ b/github/checks.go
@@ -307,6 +307,22 @@ func (s *ChecksService) ListCheckRunsCheckSuite(ctx context.Context, owner, repo
 	return checkRunResults, resp, nil
 }
 
+// ReRequestCheckRun triggers GitHub to rerequest an existing check run.
+//
+// GitHub API docs: https://docs.github.com/en/rest/checks/runs#rerequest-a-check-run
+func (s *ChecksService) ReRequestCheckRun(ctx context.Context, owner, repo string, checkRunID int64) (*Response, error) {
+	u := fmt.Sprintf("repos/%v/%v/check-runs/%v/rerequest", owner, repo, checkRunID)
+
+	req, err := s.client.NewRequest("POST", u, nil)
+	if err != nil {
+		return nil, err
+	}
+
+	req.Header.Set("Accept", mediaTypeCheckRunsPreview)
+
+	return s.client.Do(ctx, req, nil)
+}
+
 // ListCheckSuiteOptions represents parameters to list check suites.
 type ListCheckSuiteOptions struct {
 	CheckName *string `url:"check_name,omitempty"` // Filters checks suites by the name of the check run.
diff --git a/github/event_types.go b/github/event_types.go
index 7cfba9ab..52fc1408 100644
--- a/github/event_types.go
+++ b/github/event_types.go
@@ -1058,14 +1058,17 @@ type RepositoryVulnerabilityAlertEvent struct {
 	// Action is the action that was performed. Possible values are: "create", "dismiss", "resolve".
 	Action *string `json:"action,omitempty"`
 
-	//The security alert of the vulnerable dependency.
+	// The security alert of the vulnerable dependency.
 	Alert *RepositoryVulnerabilityAlert `json:"alert,omitempty"`
 
-	//The repository of the vulnerable dependency.
+	// The repository of the vulnerable dependency.
 	Repository *Repository `json:"repository,omitempty"`
 
 	// The following fields are only populated by Webhook events.
 	Installation *Installation `json:"installation,omitempty"`
+
+	// The user that triggered the event.
+	Sender *User `json:"sender,omitempty"`
 }
 
 // RepositoryVulnerabilityAlert represents a repository security alert.
diff --git a/github/github-accessors.go b/github/github-accessors.go
index 01444663..d3e42617 100644
--- a/github/github-accessors.go
+++ b/github/github-accessors.go
@@ -13542,6 +13542,22 @@ func (p *PushEventRepository) GetWatchersCount() int {
 	return *p.WatchersCount
 }
 
+// GetActionsRunnerRegistration returns the ActionsRunnerRegistration field.
+func (r *RateLimits) GetActionsRunnerRegistration() *Rate {
+	if r == nil {
+		return nil
+	}
+	return r.ActionsRunnerRegistration
+}
+
+// GetCodeScanningUpload returns the CodeScanningUpload field.
+func (r *RateLimits) GetCodeScanningUpload() *Rate {
+	if r == nil {
+		return nil
+	}
+	return r.CodeScanningUpload
+}
+
 // GetCore returns the Core field.
 func (r *RateLimits) GetCore() *Rate {
 	if r == nil {
@@ -13550,6 +13566,30 @@ func (r *RateLimits) GetCore() *Rate {
 	return r.Core
 }
 
+// GetGraphQL returns the GraphQL field.
+func (r *RateLimits) GetGraphQL() *Rate {
+	if r == nil {
+		return nil
+	}
+	return r.GraphQL
+}
+
+// GetIntegrationManifest returns the IntegrationManifest field.
+func (r *RateLimits) GetIntegrationManifest() *Rate {
+	if r == nil {
+		return nil
+	}
+	return r.IntegrationManifest
+}
+
+// GetSCIM returns the SCIM field.
+func (r *RateLimits) GetSCIM() *Rate {
+	if r == nil {
+		return nil
+	}
+	return r.SCIM
+}
+
 // GetSearch returns the Search field.
 func (r *RateLimits) GetSearch() *Rate {
 	if r == nil {
@@ -13558,6 +13598,14 @@ func (r *RateLimits) GetSearch() *Rate {
 	return r.Search
 }
 
+// GetSourceImport returns the SourceImport field.
+func (r *RateLimits) GetSourceImport() *Rate {
+	if r == nil {
+		return nil
+	}
+	return r.SourceImport
+}
+
 // GetContent returns the Content field if it's non-nil, zero value otherwise.
 func (r *Reaction) GetContent() string {
 	if r == nil || r.Content == nil {
@@ -13910,6 +13958,38 @@ func (r *RenameOrgResponse) GetURL() string {
 	return *r.URL
 }
 
+// GetBranch returns the Branch field if it's non-nil, zero value otherwise.
+func (r *RepoMergeUpstreamRequest) GetBranch() string {
+	if r == nil || r.Branch == nil {
+		return ""
+	}
+	return *r.Branch
+}
+
+// GetBaseBranch returns the BaseBranch field if it's non-nil, zero value otherwise.
+func (r *RepoMergeUpstreamResult) GetBaseBranch() string {
+	if r == nil || r.BaseBranch == nil {
+		return ""
+	}
+	return *r.BaseBranch
+}
+
+// GetMergeType returns the MergeType field if it's non-nil, zero value otherwise.
+func (r *RepoMergeUpstreamResult) GetMergeType() string {
+	if r == nil || r.MergeType == nil {
+		return ""
+	}
+	return *r.MergeType
+}
+
+// GetMessage returns the Message field if it's non-nil, zero value otherwise.
+func (r *RepoMergeUpstreamResult) GetMessage() string {
+	if r == nil || r.Message == nil {
+		return ""
+	}
+	return *r.Message
+}
+
 // GetFrom returns the From field if it's non-nil, zero value otherwise.
 func (r *RepoName) GetFrom() string {
 	if r == nil || r.From == nil {
@@ -15622,6 +15702,14 @@ func (r *RepositoryVulnerabilityAlertEvent) GetRepository() *Repository {
 	return r.Repository
 }
 
+// GetSender returns the Sender field.
+func (r *RepositoryVulnerabilityAlertEvent) GetSender() *User {
+	if r == nil {
+		return nil
+	}
+	return r.Sender
+}
+
 // GetForkRepos returns the ForkRepos field if it's non-nil, zero value otherwise.
 func (r *RepoStats) GetForkRepos() int {
 	if r == nil || r.ForkRepos == nil {
diff --git a/github/github.go b/github/github.go
index 080a8794..f51f9d88 100644
--- a/github/github.go
+++ b/github/github.go
@@ -1082,15 +1082,26 @@ type RateLimits struct {
 	// requests are limited to 60 per hour. Authenticated requests are
 	// limited to 5,000 per hour.
 	//
-	// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/#rate-limiting
+	// GitHub API docs: https://docs.github.com/en/rest/overview/resources-in-the-rest-api#rate-limiting
 	Core *Rate `json:"core"`
 
 	// The rate limit for search API requests. Unauthenticated requests
 	// are limited to 10 requests per minutes. Authenticated requests are
 	// limited to 30 per minute.
 	//
-	// GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/search/#rate-limit
+	// GitHub API docs: https://docs.github.com/en/rest/search#rate-limit
 	Search *Rate `json:"search"`
+
+	// GitHub API docs: https://docs.github.com/en/graphql/overview/resource-limitations#rate-limit
+	GraphQL *Rate `json:"graphql"`
+
+	// GitHub API dos: https://docs.github.com/en/rest/rate-limit
+	IntegrationManifest *Rate `json:"integration_manifest"`
+
+	SourceImport              *Rate `json:"source_import"`
+	CodeScanningUpload        *Rate `json:"code_scanning_upload"`
+	ActionsRunnerRegistration *Rate `json:"actions_runner_registration"`
+	SCIM                      *Rate `json:"scim"`
 }
 
 func (r RateLimits) String() string {
@@ -1102,6 +1113,12 @@ type rateLimitCategory uint8
 const (
 	coreCategory rateLimitCategory = iota
 	searchCategory
+	graphqlCategory
+	integrationManifestCategory
+	sourceImportCategory
+	codeScanningUploadCategory
+	actionsRunnerRegistrationCategory
+	scimCategory
 
 	categories // An array of this length will be able to contain all rate limit categories.
 )
@@ -1142,6 +1159,24 @@ func (c *Client) RateLimits(ctx context.Context) (*RateLimits, *Response, error)
 		if response.Resources.Search != nil {
 			c.rateLimits[searchCategory] = *response.Resources.Search
 		}
+		if response.Resources.GraphQL != nil {
+			c.rateLimits[graphqlCategory] = *response.Resources.GraphQL
+		}
+		if response.Resources.IntegrationManifest != nil {
+			c.rateLimits[integrationManifestCategory] = *response.Resources.IntegrationManifest
+		}
+		if response.Resources.SourceImport != nil {
+			c.rateLimits[sourceImportCategory] = *response.Resources.SourceImport
+		}
+		if response.Resources.CodeScanningUpload != nil {
+			c.rateLimits[codeScanningUploadCategory] = *response.Resources.CodeScanningUpload
+		}
+		if response.Resources.ActionsRunnerRegistration != nil {
+			c.rateLimits[actionsRunnerRegistrationCategory] = *response.Resources.ActionsRunnerRegistration
+		}
+		if response.Resources.SCIM != nil {
+			c.rateLimits[scimCategory] = *response.Resources.SCIM
+		}
 		c.rateMu.Unlock()
 	}
 
diff --git a/github/repos_merging.go b/github/repos_merging.go
index 7edda3ef..a8d86074 100644
--- a/github/repos_merging.go
+++ b/github/repos_merging.go
@@ -18,6 +18,20 @@ type RepositoryMergeRequest struct {
 	CommitMessage *string `json:"commit_message,omitempty"`
 }
 
+// RepoMergeUpstreamRequest represents a request to sync a branch of
+// a forked repository to keep it up-to-date with the upstream repository.
+type RepoMergeUpstreamRequest struct {
+	Branch *string `json:"branch,omitempty"`
+}
+
+// RepoMergeUpstreamResult represents the result of syncing a branch of
+// a forked repository with the upstream repository.
+type RepoMergeUpstreamResult struct {
+	Message    *string `json:"message,omitempty"`
+	MergeType  *string `json:"merge_type,omitempty"`
+	BaseBranch *string `json:"base_branch,omitempty"`
+}
+
 // Merge a branch in the specified repository.
 //
 // GitHub API docs: https://docs.github.com/en/free-pro-team@latest/rest/reference/repos/#merge-a-branch
@@ -36,3 +50,23 @@ func (s *RepositoriesService) Merge(ctx context.Context, owner, repo string, req
 
 	return commit, resp, nil
 }
+
+// MergeUpstream syncs a branch of a forked repository to keep it up-to-date
+// with the upstream repository.
+//
+// GitHub API docs: https://docs.github.com/en/rest/reference/branches#sync-a-fork-branch-with-the-upstream-repository
+func (s *RepositoriesService) MergeUpstream(ctx context.Context, owner, repo string, request *RepoMergeUpstreamRequest) (*RepoMergeUpstreamResult, *Response, error) {
+	u := fmt.Sprintf("repos/%v/%v/merge-upstream", owner, repo)
+	req, err := s.client.NewRequest("POST", u, request)
+	if err != nil {
+		return nil, nil, err
+	}
+
+	result := new(RepoMergeUpstreamResult)
+	resp, err := s.client.Do(ctx, req, result)
+	if err != nil {
+		return nil, resp, err
+	}
+
+	return result, resp, nil
+}


Test patch:
diff --git a/github/actions_runner_groups_test.go b/github/actions_runner_groups_test.go
index 1ec958a1..fc8b2480 100644
--- a/github/actions_runner_groups_test.go
+++ b/github/actions_runner_groups_test.go
@@ -24,7 +24,51 @@ func TestActionsService_ListOrganizationRunnerGroups(t *testing.T) {
 		fmt.Fprint(w, `{"total_count":3,"runner_groups":[{"id":1,"name":"Default","visibility":"all","default":true,"runners_url":"https://api.github.com/orgs/octo-org/actions/runner_groups/1/runners","inherited":false,"allows_public_repositories":true},{"id":2,"name":"octo-runner-group","visibility":"selected","default":false,"selected_repositories_url":"https://api.github.com/orgs/octo-org/actions/runner_groups/2/repositories","runners_url":"https://api.github.com/orgs/octo-org/actions/runner_groups/2/runners","inherited":true,"allows_public_repositories":true},{"id":3,"name":"expensive-hardware","visibility":"private","default":false,"runners_url":"https://api.github.com/orgs/octo-org/actions/runner_groups/3/runners","inherited":false,"allows_public_repositories":true}]}`)
 	})
 
-	opts := &ListOptions{Page: 2, PerPage: 2}
+	opts := &ListOrgRunnerGroupOptions{ListOptions: ListOptions{Page: 2, PerPage: 2}}
+	ctx := context.Background()
+	groups, _, err := client.Actions.ListOrganizationRunnerGroups(ctx, "o", opts)
+	if err != nil {
+		t.Errorf("Actions.ListOrganizationRunnerGroups returned error: %v", err)
+	}
+
+	want := &RunnerGroups{
+		TotalCount: 3,
+		RunnerGroups: []*RunnerGroup{
+			{ID: Int64(1), Name: String("Default"), Visibility: String("all"), Default: Bool(true), RunnersURL: String("https://api.github.com/orgs/octo-org/actions/runner_groups/1/runners"), Inherited: Bool(false), AllowsPublicRepositories: Bool(true)},
+			{ID: Int64(2), Name: String("octo-runner-group"), Visibility: String("selected"), Default: Bool(false), SelectedRepositoriesURL: String("https://api.github.com/orgs/octo-org/actions/runner_groups/2/repositories"), RunnersURL: String("https://api.github.com/orgs/octo-org/actions/runner_groups/2/runners"), Inherited: Bool(true), AllowsPublicRepositories: Bool(true)},
+			{ID: Int64(3), Name: String("expensive-hardware"), Visibility: String("private"), Default: Bool(false), RunnersURL: String("https://api.github.com/orgs/octo-org/actions/runner_groups/3/runners"), Inherited: Bool(false), AllowsPublicRepositories: Bool(true)},
+		},
+	}
+	if !cmp.Equal(groups, want) {
+		t.Errorf("Actions.ListOrganizationRunnerGroups returned %+v, want %+v", groups, want)
+	}
+
+	const methodName = "ListOrganizationRunnerGroups"
+	testBadOptions(t, methodName, func() (err error) {
+		_, _, err = client.Actions.ListOrganizationRunnerGroups(ctx, "\n", opts)
+		return err
+	})
+
+	testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) {
+		got, resp, err := client.Actions.ListOrganizationRunnerGroups(ctx, "o", opts)
+		if got != nil {
+			t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got)
+		}
+		return resp, err
+	})
+}
+
+func TestActionsService_ListOrganizationRunnerGroupsVisibleToRepo(t *testing.T) {
+	client, mux, _, teardown := setup()
+	defer teardown()
+
+	mux.HandleFunc("/orgs/o/actions/runner-groups", func(w http.ResponseWriter, r *http.Request) {
+		testMethod(t, r, "GET")
+		testFormValues(t, r, values{"per_page": "2", "page": "2", "visible_to_repository": "github"})
+		fmt.Fprint(w, `{"total_count":3,"runner_groups":[{"id":1,"name":"Default","visibility":"all","default":true,"runners_url":"https://api.github.com/orgs/octo-org/actions/runner_groups/1/runners","inherited":false,"allows_public_repositories":true},{"id":2,"name":"octo-runner-group","visibility":"selected","default":false,"selected_repositories_url":"https://api.github.com/orgs/octo-org/actions/runner_groups/2/repositories","runners_url":"https://api.github.com/orgs/octo-org/actions/runner_groups/2/runners","inherited":true,"allows_public_repositories":true},{"id":3,"name":"expensive-hardware","visibility":"private","default":false,"runners_url":"https://api.github.com/orgs/octo-org/actions/runner_groups/3/runners","inherited":false,"allows_public_repositories":true}]}`)
+	})
+
+	opts := &ListOrgRunnerGroupOptions{ListOptions: ListOptions{Page: 2, PerPage: 2}, VisibleToRepository: "github"}
 	ctx := context.Background()
 	groups, _, err := client.Actions.ListOrganizationRunnerGroups(ctx, "o", opts)
 	if err != nil {
diff --git a/github/actions_workflow_runs_test.go b/github/actions_workflow_runs_test.go
index 0b38ae38..12f50805 100644
--- a/github/actions_workflow_runs_test.go
+++ b/github/actions_workflow_runs_test.go
@@ -216,6 +216,64 @@ func TestActionsService_RerunWorkflowRunByID(t *testing.T) {
 	})
 }
 
+func TestActionsService_RerunFailedJobsByID(t *testing.T) {
+	client, mux, _, teardown := setup()
+	defer teardown()
+
+	mux.HandleFunc("/repos/o/r/actions/runs/3434/rerun-failed-jobs", func(w http.ResponseWriter, r *http.Request) {
+		testMethod(t, r, "POST")
+		w.WriteHeader(http.StatusCreated)
+	})
+
+	ctx := context.Background()
+	resp, err := client.Actions.RerunFailedJobsByID(ctx, "o", "r", 3434)
+	if err != nil {
+		t.Errorf("Actions.RerunFailedJobsByID returned error: %v", err)
+	}
+	if resp.StatusCode != http.StatusCreated {
+		t.Errorf("Actions.RerunFailedJobsByID returned status: %d, want %d", resp.StatusCode, http.StatusCreated)
+	}
+
+	const methodName = "RerunFailedJobsByID"
+	testBadOptions(t, methodName, func() (err error) {
+		_, err = client.Actions.RerunFailedJobsByID(ctx, "\n", "\n", 3434)
+		return err
+	})
+
+	testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) {
+		return client.Actions.RerunFailedJobsByID(ctx, "o", "r", 3434)
+	})
+}
+
+func TestActionsService_RerunJobByID(t *testing.T) {
+	client, mux, _, teardown := setup()
+	defer teardown()
+
+	mux.HandleFunc("/repos/o/r/actions/jobs/3434/rerun", func(w http.ResponseWriter, r *http.Request) {
+		testMethod(t, r, "POST")
+		w.WriteHeader(http.StatusCreated)
+	})
+
+	ctx := context.Background()
+	resp, err := client.Actions.RerunJobByID(ctx, "o", "r", 3434)
+	if err != nil {
+		t.Errorf("Actions.RerunJobByID returned error: %v", err)
+	}
+	if resp.StatusCode != http.StatusCreated {
+		t.Errorf("Actions.RerunJobByID returned status: %d, want %d", resp.StatusCode, http.StatusCreated)
+	}
+
+	const methodName = "RerunJobByID"
+	testBadOptions(t, methodName, func() (err error) {
+		_, err = client.Actions.RerunJobByID(ctx, "\n", "\n", 3434)
+		return err
+	})
+
+	testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) {
+		return client.Actions.RerunJobByID(ctx, "o", "r", 3434)
+	})
+}
+
 func TestActionsService_CancelWorkflowRunByID(t *testing.T) {
 	client, mux, _, teardown := setup()
 	defer teardown()
diff --git a/github/checks_test.go b/github/checks_test.go
index d3c01cdd..2fdd2476 100644
--- a/github/checks_test.go
+++ b/github/checks_test.go
@@ -1718,3 +1718,28 @@ func TestCheckSuitePreferenceResults_Marshal(t *testing.T) {
 
 	testJSONMarshal(t, u, want)
 }
+
+func TestChecksService_ReRequestCheckRun(t *testing.T) {
+	client, mux, _, teardown := setup()
+	defer teardown()
+
+	mux.HandleFunc("/repos/o/r/check-runs/1/rerequest", func(w http.ResponseWriter, r *http.Request) {
+		testMethod(t, r, "POST")
+		testHeader(t, r, "Accept", mediaTypeCheckRunsPreview)
+		w.WriteHeader(http.StatusCreated)
+	})
+	ctx := context.Background()
+	resp, err := client.Checks.ReRequestCheckRun(ctx, "o", "r", 1)
+	if err != nil {
+		t.Errorf("Checks.ReRequestCheckRun return error: %v", err)
+	}
+	if got, want := resp.StatusCode, http.StatusCreated; got != want {
+		t.Errorf("Checks.ReRequestCheckRun = %v, want %v", got, want)
+	}
+
+	const methodName = "ReRequestCheckRun"
+	testBadOptions(t, methodName, func() (err error) {
+		_, err = client.Checks.ReRequestCheckRun(ctx, "\n", "\n", 1)
+		return err
+	})
+}
diff --git a/github/github-accessors_test.go b/github/github-accessors_test.go
index 8fdb12e5..aadfab90 100644
--- a/github/github-accessors_test.go
+++ b/github/github-accessors_test.go
@@ -15761,6 +15761,20 @@ func TestPushEventRepository_GetWatchersCount(tt *testing.T) {
 	p.GetWatchersCount()
 }
 
+func TestRateLimits_GetActionsRunnerRegistration(tt *testing.T) {
+	r := &RateLimits{}
+	r.GetActionsRunnerRegistration()
+	r = nil
+	r.GetActionsRunnerRegistration()
+}
+
+func TestRateLimits_GetCodeScanningUpload(tt *testing.T) {
+	r := &RateLimits{}
+	r.GetCodeScanningUpload()
+	r = nil
+	r.GetCodeScanningUpload()
+}
+
 func TestRateLimits_GetCore(tt *testing.T) {
 	r := &RateLimits{}
 	r.GetCore()
@@ -15768,6 +15782,27 @@ func TestRateLimits_GetCore(tt *testing.T) {
 	r.GetCore()
 }
 
+func TestRateLimits_GetGraphQL(tt *testing.T) {
+	r := &RateLimits{}
+	r.GetGraphQL()
+	r = nil
+	r.GetGraphQL()
+}
+
+func TestRateLimits_GetIntegrationManifest(tt *testing.T) {
+	r := &RateLimits{}
+	r.GetIntegrationManifest()
+	r = nil
+	r.GetIntegrationManifest()
+}
+
+func TestRateLimits_GetSCIM(tt *testing.T) {
+	r := &RateLimits{}
+	r.GetSCIM()
+	r = nil
+	r.GetSCIM()
+}
+
 func TestRateLimits_GetSearch(tt *testing.T) {
 	r := &RateLimits{}
 	r.GetSearch()
@@ -15775,6 +15810,13 @@ func TestRateLimits_GetSearch(tt *testing.T) {
 	r.GetSearch()
 }
 
+func TestRateLimits_GetSourceImport(tt *testing.T) {
+	r := &RateLimits{}
+	r.GetSourceImport()
+	r = nil
+	r.GetSourceImport()
+}
+
 func TestReaction_GetContent(tt *testing.T) {
 	var zeroValue string
 	r := &Reaction{Content: &zeroValue}
@@ -16194,6 +16236,46 @@ func TestRenameOrgResponse_GetURL(tt *testing.T) {
 	r.GetURL()
 }
 
+func TestRepoMergeUpstreamRequest_GetBranch(tt *testing.T) {
+	var zeroValue string
+	r := &RepoMergeUpstreamRequest{Branch: &zeroValue}
+	r.GetBranch()
+	r = &RepoMergeUpstreamRequest{}
+	r.GetBranch()
+	r = nil
+	r.GetBranch()
+}
+
+func TestRepoMergeUpstreamResult_GetBaseBranch(tt *testing.T) {
+	var zeroValue string
+	r := &RepoMergeUpstreamResult{BaseBranch: &zeroValue}
+	r.GetBaseBranch()
+	r = &RepoMergeUpstreamResult{}
+	r.GetBaseBranch()
+	r = nil
+	r.GetBaseBranch()
+}
+
+func TestRepoMergeUpstreamResult_GetMergeType(tt *testing.T) {
+	var zeroValue string
+	r := &RepoMergeUpstreamResult{MergeType: &zeroValue}
+	r.GetMergeType()
+	r = &RepoMergeUpstreamResult{}
+	r.GetMergeType()
+	r = nil
+	r.GetMergeType()
+}
+
+func TestRepoMergeUpstreamResult_GetMessage(tt *testing.T) {
+	var zeroValue string
+	r := &RepoMergeUpstreamResult{Message: &zeroValue}
+	r.GetMessage()
+	r = &RepoMergeUpstreamResult{}
+	r.GetMessage()
+	r = nil
+	r.GetMessage()
+}
+
 func TestRepoName_GetFrom(tt *testing.T) {
 	var zeroValue string
 	r := &RepoName{From: &zeroValue}
@@ -18223,6 +18305,13 @@ func TestRepositoryVulnerabilityAlertEvent_GetRepository(tt *testing.T) {
 	r.GetRepository()
 }
 
+func TestRepositoryVulnerabilityAlertEvent_GetSender(tt *testing.T) {
+	r := &RepositoryVulnerabilityAlertEvent{}
+	r.GetSender()
+	r = nil
+	r.GetSender()
+}
+
 func TestRepoStats_GetForkRepos(tt *testing.T) {
 	var zeroValue int
 	r := &RepoStats{ForkRepos: &zeroValue}
diff --git a/github/github_test.go b/github/github_test.go
index 475eb9d8..93698718 100644
--- a/github/github_test.go
+++ b/github/github_test.go
@@ -474,10 +474,16 @@ func TestClient_rateLimits(t *testing.T) {
 
 func TestRateLimits_String(t *testing.T) {
 	v := RateLimits{
-		Core:   &Rate{},
-		Search: &Rate{},
-	}
-	want := `github.RateLimits{Core:github.Rate{Limit:0, Remaining:0, Reset:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}}, Search:github.Rate{Limit:0, Remaining:0, Reset:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}}}`
+		Core:                      &Rate{},
+		Search:                    &Rate{},
+		GraphQL:                   &Rate{},
+		IntegrationManifest:       &Rate{},
+		SourceImport:              &Rate{},
+		CodeScanningUpload:        &Rate{},
+		ActionsRunnerRegistration: &Rate{},
+		SCIM:                      &Rate{},
+	}
+	want := `github.RateLimits{Core:github.Rate{Limit:0, Remaining:0, Reset:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}}, Search:github.Rate{Limit:0, Remaining:0, Reset:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}}, GraphQL:github.Rate{Limit:0, Remaining:0, Reset:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}}, IntegrationManifest:github.Rate{Limit:0, Remaining:0, Reset:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}}, SourceImport:github.Rate{Limit:0, Remaining:0, Reset:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}}, CodeScanningUpload:github.Rate{Limit:0, Remaining:0, Reset:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}}, ActionsRunnerRegistration:github.Rate{Limit:0, Remaining:0, Reset:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}}, SCIM:github.Rate{Limit:0, Remaining:0, Reset:github.Timestamp{0001-01-01 00:00:00 +0000 UTC}}}`
 	if got := v.String(); got != want {
 		t.Errorf("RateLimits.String = %v, want %v", got, want)
 	}
@@ -1862,7 +1868,13 @@ func TestRateLimits(t *testing.T) {
 		testMethod(t, r, "GET")
 		fmt.Fprint(w, `{"resources":{
 			"core": {"limit":2,"remaining":1,"reset":1372700873},
-			"search": {"limit":3,"remaining":2,"reset":1372700874}
+			"search": {"limit":3,"remaining":2,"reset":1372700874},
+			"graphql": {"limit":4,"remaining":3,"reset":1372700875},
+			"integration_manifest": {"limit":5,"remaining":4,"reset":1372700876},
+			"source_import": {"limit":6,"remaining":5,"reset":1372700877},
+			"code_scanning_upload": {"limit":7,"remaining":6,"reset":1372700878},
+			"actions_runner_registration": {"limit":8,"remaining":7,"reset":1372700879},
+			"scim": {"limit":9,"remaining":8,"reset":1372700880}
 		}}`)
 	})
 
@@ -1883,6 +1895,36 @@ func TestRateLimits(t *testing.T) {
 			Remaining: 2,
 			Reset:     Timestamp{time.Date(2013, time.July, 1, 17, 47, 54, 0, time.UTC).Local()},
 		},
+		GraphQL: &Rate{
+			Limit:     4,
+			Remaining: 3,
+			Reset:     Timestamp{time.Date(2013, time.July, 1, 17, 47, 55, 0, time.UTC).Local()},
+		},
+		IntegrationManifest: &Rate{
+			Limit:     5,
+			Remaining: 4,
+			Reset:     Timestamp{time.Date(2013, time.July, 1, 17, 47, 56, 0, time.UTC).Local()},
+		},
+		SourceImport: &Rate{
+			Limit:     6,
+			Remaining: 5,
+			Reset:     Timestamp{time.Date(2013, time.July, 1, 17, 47, 57, 0, time.UTC).Local()},
+		},
+		CodeScanningUpload: &Rate{
+			Limit:     7,
+			Remaining: 6,
+			Reset:     Timestamp{time.Date(2013, time.July, 1, 17, 47, 58, 0, time.UTC).Local()},
+		},
+		ActionsRunnerRegistration: &Rate{
+			Limit:     8,
+			Remaining: 7,
+			Reset:     Timestamp{time.Date(2013, time.July, 1, 17, 47, 59, 0, time.UTC).Local()},
+		},
+		SCIM: &Rate{
+			Limit:     9,
+			Remaining: 8,
+			Reset:     Timestamp{time.Date(2013, time.July, 1, 17, 48, 00, 0, time.UTC).Local()},
+		},
 	}
 	if !cmp.Equal(rate, want) {
 		t.Errorf("RateLimits returned %+v, want %+v", rate, want)
@@ -1894,6 +1936,24 @@ func TestRateLimits(t *testing.T) {
 	if got, want := client.rateLimits[searchCategory], *want.Search; got != want {
 		t.Errorf("client.rateLimits[searchCategory] is %+v, want %+v", got, want)
 	}
+	if got, want := client.rateLimits[graphqlCategory], *want.GraphQL; got != want {
+		t.Errorf("client.rateLimits[graphqlCategory] is %+v, want %+v", got, want)
+	}
+	if got, want := client.rateLimits[integrationManifestCategory], *want.IntegrationManifest; got != want {
+		t.Errorf("client.rateLimits[integrationManifestCategory] is %+v, want %+v", got, want)
+	}
+	if got, want := client.rateLimits[sourceImportCategory], *want.SourceImport; got != want {
+		t.Errorf("client.rateLimits[sourceImportCategory] is %+v, want %+v", got, want)
+	}
+	if got, want := client.rateLimits[codeScanningUploadCategory], *want.CodeScanningUpload; got != want {
+		t.Errorf("client.rateLimits[codeScanningUploadCategory] is %+v, want %+v", got, want)
+	}
+	if got, want := client.rateLimits[actionsRunnerRegistrationCategory], *want.ActionsRunnerRegistration; got != want {
+		t.Errorf("client.rateLimits[actionsRunnerRegistrationCategory] is %+v, want %+v", got, want)
+	}
+	if got, want := client.rateLimits[scimCategory], *want.SCIM; got != want {
+		t.Errorf("client.rateLimits[scimCategory] is %+v, want %+v", got, want)
+	}
 }
 
 func TestRateLimits_coverage(t *testing.T) {
@@ -2394,6 +2454,36 @@ func TestRateLimits_Marshal(t *testing.T) {
 			Remaining: 1,
 			Reset:     Timestamp{referenceTime},
 		},
+		GraphQL: &Rate{
+			Limit:     1,
+			Remaining: 1,
+			Reset:     Timestamp{referenceTime},
+		},
+		IntegrationManifest: &Rate{
+			Limit:     1,
+			Remaining: 1,
+			Reset:     Timestamp{referenceTime},
+		},
+		SourceImport: &Rate{
+			Limit:     1,
+			Remaining: 1,
+			Reset:     Timestamp{referenceTime},
+		},
+		CodeScanningUpload: &Rate{
+			Limit:     1,
+			Remaining: 1,
+			Reset:     Timestamp{referenceTime},
+		},
+		ActionsRunnerRegistration: &Rate{
+			Limit:     1,
+			Remaining: 1,
+			Reset:     Timestamp{referenceTime},
+		},
+		SCIM: &Rate{
+			Limit:     1,
+			Remaining: 1,
+			Reset:     Timestamp{referenceTime},
+		},
 	}
 
 	want := `{
@@ -2406,6 +2496,36 @@ func TestRateLimits_Marshal(t *testing.T) {
 			"limit": 1,
 			"remaining": 1,
 			"reset": ` + referenceTimeStr + `
+		},
+		"graphql": {
+			"limit": 1,
+			"remaining": 1,
+			"reset": ` + referenceTimeStr + `
+		},
+		"integration_manifest": {
+			"limit": 1,
+			"remaining": 1,
+			"reset": ` + referenceTimeStr + `
+		},
+		"source_import": {
+			"limit": 1,
+			"remaining": 1,
+			"reset": ` + referenceTimeStr + `
+		},
+		"code_scanning_upload": {
+			"limit": 1,
+			"remaining": 1,
+			"reset": ` + referenceTimeStr + `
+		},
+		"actions_runner_registration": {
+			"limit": 1,
+			"remaining": 1,
+			"reset": ` + referenceTimeStr + `
+		},
+		"scim": {
+			"limit": 1,
+			"remaining": 1,
+			"reset": ` + referenceTimeStr + `
 		}
 	}`
 
diff --git a/github/repos_merging_test.go b/github/repos_merging_test.go
index 05263100..0275915b 100644
--- a/github/repos_merging_test.go
+++ b/github/repos_merging_test.go
@@ -80,3 +80,49 @@ func TestRepositoryMergeRequest_Marshal(t *testing.T) {
 
 	testJSONMarshal(t, u, want)
 }
+
+func TestRepositoriesService_MergeUpstream(t *testing.T) {
+	client, mux, _, teardown := setup()
+	defer teardown()
+
+	input := &RepoMergeUpstreamRequest{
+		Branch: String("b"),
+	}
+
+	mux.HandleFunc("/repos/o/r/merge-upstream", func(w http.ResponseWriter, r *http.Request) {
+		v := new(RepoMergeUpstreamRequest)
+		json.NewDecoder(r.Body).Decode(v)
+
+		testMethod(t, r, "POST")
+		if !cmp.Equal(v, input) {
+			t.Errorf("Request body = %+v, want %+v", v, input)
+		}
+
+		fmt.Fprint(w, `{"merge_type":"m"}`)
+	})
+
+	ctx := context.Background()
+	result, _, err := client.Repositories.MergeUpstream(ctx, "o", "r", input)
+	if err != nil {
+		t.Errorf("Repositories.MergeUpstream returned error: %v", err)
+	}
+
+	want := &RepoMergeUpstreamResult{MergeType: String("m")}
+	if !cmp.Equal(result, want) {
+		t.Errorf("Repositories.MergeUpstream returned %+v, want %+v", result, want)
+	}
+
+	const methodName = "MergeUpstream"
+	testBadOptions(t, methodName, func() (err error) {
+		_, _, err = client.Repositories.MergeUpstream(ctx, "\n", "\n", input)
+		return err
+	})
+
+	testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) {
+		got, resp, err := client.Repositories.MergeUpstream(ctx, "o", "r", input)
+		if got != nil {
+			t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got)
+		}
+		return resp, err
+	})
+}