Repository: google/go-github
Pull request #2683 (2023-02-27 19:59:12)

Bump github.com/google/go-github/v50 from 50.0.0 to 50.1.0 in /scrape
Bumps [github.com/google/go-github/v50](https://github.com/google/go-github) from 50.0.0 to 50.1.0.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a href="https://github.com/google/go-github/releases">github.com/google/go-github/v50's releases</a>.</em></p>
<blockquote>
<h2>v50.1.0</h2>
<p>This minor release contains the following changes:</p>
<ul>
<li>Update scrape dependency to v50 (<a href="https://github-redirect.dependabot.com/google/go-github/issues/2648">#2648</a>)</li>
<li>Add secondary rate limit handling (prevent remote requests) and fix primary rate limit categories (<a href="https://github-redirect.dependabot.com/google/go-github/issues/2635">#2635</a>)</li>
<li>Fix parse token expiration (<a href="https://github-redirect.dependabot.com/google/go-github/issues/2650">#2650</a>)</li>
<li>Add support for actions variables (<a href="https://github-redirect.dependabot.com/google/go-github/issues/2652">#2652</a>)</li>
<li>Remove failing unit tests for Go 1.20 (<a href="https://github-redirect.dependabot.com/google/go-github/issues/2656">#2656</a>)</li>
<li>Add permission filter for list collaborators (<a href="https://github-redirect.dependabot.com/google/go-github/issues/2653">#2653</a>)</li>
<li>Update workflow to use Go 1.20 and 1.19 (<a href="https://github-redirect.dependabot.com/google/go-github/issues/2657">#2657</a>)</li>
<li>Add Account field to MarketplacePurchase struct (<a href="https://github-redirect.dependabot.com/google/go-github/issues/2659">#2659</a>)</li>
<li>Add URL, UpdateAt, and WorkflowRun fields to Artifacts (<a href="https://github-redirect.dependabot.com/google/go-github/issues/2660">#2660</a>)</li>
<li>Add milestone field to IssuesEvent (<a href="https://github-redirect.dependabot.com/google/go-github/issues/2663">#2663</a>)</li>
<li>Add go generate mention to CONTRIBUTING.md (<a href="https://github-redirect.dependabot.com/google/go-github/issues/2587">#2587</a>)</li>
<li>Add RequestedTeam to issues Timeline type (<a href="https://github-redirect.dependabot.com/google/go-github/issues/2665">#2665</a>)</li>
<li>Bump github.com/PuerkitoBio/goquery from 1.8.0 to 1.8.1 in /scrape (<a href="https://github-redirect.dependabot.com/google/go-github/issues/2667">#2667</a>)</li>
<li>Add Permission, OldPermission to AuditEntry type (<a href="https://github-redirect.dependabot.com/google/go-github/issues/2670">#2670</a>)</li>
<li>Add created_at to WorkflowJob struct (<a href="https://github-redirect.dependabot.com/google/go-github/issues/2671">#2671</a>)</li>
<li>Bump version of go-github to v50.1.0 (<a href="https://github-redirect.dependabot.com/google/go-github/issues/2673">#2673</a>)</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="https://github.com/google/go-github/commit/4814a50d3876239c88772c10bcd470e3a7ebe4ee"><code>4814a50</code></a> Bump version of go-github to v50.1.0 (<a href="https://github-redirect.dependabot.com/google/go-github/issues/2673">#2673</a>)</li>
<li><a href="https://github.com/google/go-github/commit/1f3c5a52d715da4f84f0a677df9a68526f2ca36a"><code>1f3c5a5</code></a> Add created_at to WorkflowJob struct (<a href="https://github-redirect.dependabot.com/google/go-github/issues/2671">#2671</a>)</li>
<li><a href="https://github.com/google/go-github/commit/e7e7149cd202a9ef5f05fd983a15984bab2577e4"><code>e7e7149</code></a> Add Permission, OldPermission to AuditEntry type (<a href="https://github-redirect.dependabot.com/google/go-github/issues/2670">#2670</a>)</li>
<li><a href="https://github.com/google/go-github/commit/b9cb801b8aa1f2e928a13e579e8a58fc0667a053"><code>b9cb801</code></a> Bump github.com/PuerkitoBio/goquery from 1.8.0 to 1.8.1 in /scrape (<a href="https://github-redirect.dependabot.com/google/go-github/issues/2667">#2667</a>)</li>
<li><a href="https://github.com/google/go-github/commit/0730976bf48f4d1051a94c58e7bff1ad9781b684"><code>0730976</code></a> Add RequestedTeam to issues Timeline type (<a href="https://github-redirect.dependabot.com/google/go-github/issues/2665">#2665</a>)</li>
<li><a href="https://github.com/google/go-github/commit/175f3bf4a3791c35b60dc71d3b87c39c08d23b2e"><code>175f3bf</code></a> Add go generate mention to CONTRIBUTING.md (<a href="https://github-redirect.dependabot.com/google/go-github/issues/2587">#2587</a>)</li>
<li><a href="https://github.com/google/go-github/commit/e26cdd7bcbdf63ab02a3ed925bd5023999ef9198"><code>e26cdd7</code></a> Add milestone field to IssuesEvent (<a href="https://github-redirect.dependabot.com/google/go-github/issues/2663">#2663</a>)</li>
<li><a href="https://github.com/google/go-github/commit/c855eb5fc7dcc46ab35fd5c5dda387dd0a3e0eb1"><code>c855eb5</code></a> Add URL, UpdateAt, and WorkflowRun fields to Artifacts (<a href="https://github-redirect.dependabot.com/google/go-github/issues/2660">#2660</a>)</li>
<li><a href="https://github.com/google/go-github/commit/0af462f06fbd5fd466073b1718ace1c7e78b9283"><code>0af462f</code></a> Add Account field to MarketplacePurchase struct (<a href="https://github-redirect.dependabot.com/google/go-github/issues/2659">#2659</a>)</li>
<li><a href="https://github.com/google/go-github/commit/2094f991592201d301feec818d413c136537732c"><code>2094f99</code></a> Update workflow to use Go 1.20 and 1.19 (<a href="https://github-redirect.dependabot.com/google/go-github/issues/2657">#2657</a>)</li>
<li>Additional commits viewable in <a href="https://github.com/google/go-github/compare/v50.0.0...v50.1.0">compare view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=github.com/google/go-github/v50&package-manager=go_modules&previous-version=50.0.0&new-version=50.1.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)


</details>

codecov[bot]: # [Codecov](https://codecov.io/gh/google/go-github/pull/2683?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=google) Report
> Merging [#2683](https://codecov.io/gh/google/go-github/pull/2683?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=google) (6865557) into [master](https://codecov.io/gh/google/go-github/commit/099fae4bf5d6700d159c0b4d12f23ad1194ad713?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=google) (099fae4) will **not change** coverage.
> The diff coverage is `n/a`.

```diff
@@           Coverage Diff           @@
##           master    #2683   +/-   ##
=======================================
  Coverage   98.05%   98.05%           
=======================================
  Files         131      131           
  Lines       11442    11442           
=======================================
  Hits        11219    11219           
  Misses        152      152           
  Partials       71       71           
```



Help us with your feedback. Take ten seconds to tell us [how you rate us](https://about.codecov.io/nps?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=google). Have a feature suggestion? [Share it here.](https://app.codecov.io/gh/feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=google)


Patch:
diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml
index cf4edcb6..d57bb7f4 100644
--- a/.github/workflows/linter.yml
+++ b/.github/workflows/linter.yml
@@ -26,8 +26,8 @@ jobs:
     - uses: actions/checkout@v3
 
     - name: golangci-lint ${{ matrix.working-directory }}
-      uses: golangci/golangci-lint-action@08e2f20817b15149a52b5b3ebe7de50aff2ba8c5 #v3.4.0
+      uses: golangci/golangci-lint-action@v3
       with:
-        version: v1.50.1
+        version: latest
         working-directory: ${{ matrix.working-directory}}
         args: --verbose
diff --git a/github/teams.go b/github/teams.go
index 963a69b3..0ee7c200 100644
--- a/github/teams.go
+++ b/github/teams.go
@@ -913,7 +913,7 @@ type ListExternalGroupsOptions struct {
 	ListOptions
 }
 
-// ListExternalGroups lists external groups connected to a team on GitHub.
+// ListExternalGroups lists external groups in an organization on GitHub.
 //
 // GitHub API docs: https://docs.github.com/en/enterprise-cloud@latest/rest/teams/external-groups#list-external-groups-in-an-organization
 func (s *TeamsService) ListExternalGroups(ctx context.Context, org string, opts *ListExternalGroupsOptions) (*ExternalGroupList, *Response, error) {
@@ -937,6 +937,26 @@ func (s *TeamsService) ListExternalGroups(ctx context.Context, org string, opts
 	return externalGroups, resp, nil
 }
 
+// ListExternalGroupsForTeamBySlug lists external groups connected to a team on GitHub.
+//
+// GitHub API docs: https://docs.github.com/en/enterprise-cloud@latest/rest/teams/external-groups#list-a-connection-between-an-external-group-and-a-team
+func (s *TeamsService) ListExternalGroupsForTeamBySlug(ctx context.Context, org, slug string) (*ExternalGroupList, *Response, error) {
+	u := fmt.Sprintf("orgs/%v/teams/%v/external-groups", org, slug)
+
+	req, err := s.client.NewRequest("GET", u, nil)
+	if err != nil {
+		return nil, nil, err
+	}
+
+	externalGroups := new(ExternalGroupList)
+	resp, err := s.client.Do(ctx, req, externalGroups)
+	if err != nil {
+		return nil, resp, err
+	}
+
+	return externalGroups, resp, nil
+}
+
 // UpdateConnectedExternalGroup updates the connection between an external group and a team.
 //
 // GitHub API docs: https://docs.github.com/en/enterprise-cloud@latest/rest/teams/external-groups#update-the-connection-between-an-external-group-and-a-team
diff --git a/scrape/go.mod b/scrape/go.mod
index 97c793d0..653f279f 100644
--- a/scrape/go.mod
+++ b/scrape/go.mod
@@ -5,7 +5,7 @@ go 1.13
 require (
 	github.com/PuerkitoBio/goquery v1.8.1
 	github.com/google/go-cmp v0.5.9
-	github.com/google/go-github/v50 v50.0.0
+	github.com/google/go-github/v50 v50.1.0
 	github.com/xlzd/gotp v0.1.0
 	golang.org/x/net v0.7.0
 )
diff --git a/scrape/go.sum b/scrape/go.sum
index 2ac0d30e..496eb3f6 100644
--- a/scrape/go.sum
+++ b/scrape/go.sum
@@ -8,8 +8,8 @@ github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5y
 github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
 github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
 github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
-github.com/google/go-github/v50 v50.0.0 h1:gdO1AeuSZZK4iYWwVbjni7zg8PIQhp7QfmPunr016Jk=
-github.com/google/go-github/v50 v50.0.0/go.mod h1:Ev4Tre8QoKiolvbpOSG3FIi4Mlon3S2Nt9W5JYqKiwA=
+github.com/google/go-github/v50 v50.1.0 h1:hMUpkZjklC5GJ+c3GquSqOP/T4BNsB7XohaPhtMOzRk=
+github.com/google/go-github/v50 v50.1.0/go.mod h1:Ev4Tre8QoKiolvbpOSG3FIi4Mlon3S2Nt9W5JYqKiwA=
 github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8=
 github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU=
 github.com/xlzd/gotp v0.1.0 h1:37blvlKCh38s+fkem+fFh7sMnceltoIEBYTVXyoa5Po=


Test patch:
diff --git a/github/teams_test.go b/github/teams_test.go
index 93e658af..d86fab7f 100644
--- a/github/teams_test.go
+++ b/github/teams_test.go
@@ -1935,6 +1935,79 @@ func TestTeamsService_ListExternalGroups_notFound(t *testing.T) {
 	}
 }
 
+func TestTeamsService_ListExternalGroupsForTeamBySlug(t *testing.T) {
+	client, mux, _, teardown := setup()
+	defer teardown()
+
+	mux.HandleFunc("/orgs/o/teams/t/external-groups", func(w http.ResponseWriter, r *http.Request) {
+		testMethod(t, r, "GET")
+		fmt.Fprint(w, `{
+			"groups": [
+				{
+					"group_id": 123,
+					"group_name": "Octocat admins",
+					"updated_at": "2006-01-02T15:04:05Z"
+				}
+			]
+		}`)
+	})
+
+	ctx := context.Background()
+	list, _, err := client.Teams.ListExternalGroupsForTeamBySlug(ctx, "o", "t")
+	if err != nil {
+		t.Errorf("Teams.ListExternalGroupsForTeamBySlug returned error: %v", err)
+	}
+
+	want := &ExternalGroupList{
+		Groups: []*ExternalGroup{
+			{
+				GroupID:   Int64(123),
+				GroupName: String("Octocat admins"),
+				UpdatedAt: &Timestamp{Time: referenceTime},
+			},
+		},
+	}
+	if !cmp.Equal(list, want) {
+		t.Errorf("Teams.ListExternalGroupsForTeamBySlug returned %+v, want %+v", list, want)
+	}
+
+	const methodName = "ListExternalGroupsForTeamBySlug"
+	testBadOptions(t, methodName, func() (err error) {
+		_, _, err = client.Teams.ListExternalGroupsForTeamBySlug(ctx, "\n", "\n")
+		return err
+	})
+
+	testNewRequestAndDoFailure(t, methodName, client, func() (*Response, error) {
+		got, resp, err := client.Teams.ListExternalGroupsForTeamBySlug(ctx, "o", "t")
+		if got != nil {
+			t.Errorf("testNewRequestAndDoFailure %v = %#v, want nil", methodName, got)
+		}
+		return resp, err
+	})
+}
+
+func TestTeamsService_ListExternalGroupsForTeamBySlug_notFound(t *testing.T) {
+	client, mux, _, teardown := setup()
+	defer teardown()
+
+	mux.HandleFunc("/orgs/o/teams/t/external-groups", func(w http.ResponseWriter, r *http.Request) {
+		testMethod(t, r, "GET")
+		w.WriteHeader(http.StatusNotFound)
+	})
+
+	ctx := context.Background()
+	eg, resp, err := client.Teams.ListExternalGroupsForTeamBySlug(ctx, "o", "t")
+	if err == nil {
+		t.Errorf("Expected HTTP 404 response")
+	}
+	if got, want := resp.Response.StatusCode, http.StatusNotFound; got != want {
+		t.Errorf("Teams.ListExternalGroupsForTeamBySlug returned status %d, want %d", got, want)
+	}
+	if eg != nil {
+		t.Errorf("Teams.ListExternalGroupsForTeamBySlug returned %+v, want nil", eg)
+	}
+}
+
 func TestTeamsService_UpdateConnectedExternalGroup(t *testing.T) {
 	client, mux, _, teardown := setup()
 	defer teardown()