Go-github: Support the move of the GitHub Teams API

Created on 20 Jan 2020  路  13Comments  路  Source: google/go-github

Over in https://github.com/terraform-providers/terraform-provider-github/issues/323, there has been some breakage due to GitHub moving the top-level /teams endpoint to live under /organizations/:org_id/team. v28.0.0 of this codebase is used for the GitHub Terraform provider, which is affected by the change.

$ go test -v -timeout 30m  ./... -run TestAccGithubTeamMembership_basic
...
2020/01/17 20:22:46 [DEBUG] Github API Request Details:
---[ REQUEST ]---------------------------------------
GET /teams/3606334/memberships/fuzzoli87 HTTP/1.1
Host: api.github.com
User-Agent: go-github
Accept: application/vnd.github.hellcat-preview+json
Accept-Encoding: gzip


-----------------------------------------------------
2020/01/17 20:22:46 [DEBUG] Sleeping 1s between write operations
2020/01/17 20:22:47 [DEBUG] Github API Response Details:
---[ RESPONSE ]--------------------------------------
HTTP/1.1 404 Not Found
Transfer-Encoding: chunked
Access-Control-Allow-Origin: *
Access-Control-Expose-Headers: ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type
Content-Security-Policy: default-src 'none'
Content-Type: application/json; charset=utf-8
Date: Sat, 18 Jan 2020 01:22:47 GMT
Referrer-Policy: origin-when-cross-origin, strict-origin-when-cross-origin
Server: GitHub.com
Status: 404 Not Found
Strict-Transport-Security: max-age=31536000; includeSubdomains; preload
X-Accepted-Oauth-Scopes: repo
X-Content-Type-Options: nosniff
X-Frame-Options: deny
X-Github-Media-Type: github.v3; param=hellcat-preview; format=json
X-Github-Request-Id: FABE:4655:15D7FC:29DF1A:5E225DE6
X-Oauth-Scopes: admin:gpg_key, admin:org, admin:public_key, admin:repo_hook, delete_repo, repo, user
X-Ratelimit-Limit: 5000
X-Ratelimit-Remaining: 4961
X-Ratelimit-Reset: 1579312573
X-Xss-Protection: 1; mode=block

70
{
 "message": "Not Found",
 "documentation_url": "https://developer.github.com/v3/teams/members/#get-team-membership"
}

I suspect https://github.com/google/go-github/blob/master/github/teams.go will need updates as well to cope with the changes.

cc https://github.com/github/ecosystem-api/issues/1836

good first issue

Most helpful comment

OK, thank you, @dbussink! That explains it. 馃槃

@gmlewis Wanted to let you know that the post is up now at https://developer.github.com/changes/2020-01-21-moving-the-team-api-endpoints/ :smile:.

All 13 comments

To clarify here, the library is not currently broken, the above 404 is very likely because the given user is no longer a member of that team anymore.

We should though longer term move to the new API endpoints as the current ones are deprecated and will at some point in the future disappear and be only available under the new endpoints. So no immediate rush, but something to do in the future.

I'm surprised I missed GitHub Developer announcements in their blog posts that the APIs were moving.

This issue would be a great opportunity for a new Go developer or someone new to our repo to investigate the change of the API endpoints mentioned above and to bring them up-to-date.
All contributions are greatly appreciated!

Feel free to volunteer for any issue and the issue can be assigned to you so that others don't attempt to duplicate the work.

Please check out our CONTRIBUTING.md guide to get started.

Thank you!

I would like to contribute to this issue.

Thank you, @atorr !
It is yours.

Not the most familiar, but in this case do we want to preserve implementation for legacy endpoints or delete them?

Since this repo is versioned, we can go ahead and delete them. Thank you!

I'm surprised I missed GitHub Developer announcements in their blog posts that the APIs were moving.

@gmlewis That's because the announcement didn't happen yet, and is in progress :smile:. The confusion here originally started since an unrelated issue somewhere else was incorrectly thought to also affect this library. So that's why there was basically a premature issue opened here and why you didn't read about this yet :smile:.

OK, thank you, @dbussink! That explains it. :smile:

I try to stay on top of the GitHub Developer announcements via RSS and Feedly - (I wish I could subscribe via email to the announcements... is there an easy way to do that?).

Anyway, thanks for the info!

OK, thank you, @dbussink! That explains it. 馃槃

@gmlewis Wanted to let you know that the post is up now at https://developer.github.com/changes/2020-01-21-moving-the-team-api-endpoints/ :smile:.

Thanks again, @dbussink !

@atorr - as you work through the PR, please check back to the GitHub Developer blog
post
to make sure that you've addressed all the (re)moved endpoints.

Thank you!

@atorr Since this issue is assigned to you I won't start working on a PR for the changes either, please let us know in case you can't continue working on this.

Since this issue is a big one, let's make a list of what needs to be done, which will help to keep things organized.

Endpoints to be deleted:

  • [x] GET /teams/:team_id
  • [x] PATCH /teams/:team_id
  • [x] DELETE /teams/:team_id
  • [x] GET /teams/:team_id/teams
  • [x] GET /teams/:team_id/repos
  • [x] GET /teams/:team_id/repos/:owner/:repo
  • [x] PUT /teams/:team_id/repos/:owner/:repo
  • [x] DELETE /teams/:team_id/repos/:owner/:repo
  • [x] GET /teams/:team_id/projects
  • [x] GET /teams/:team_id/projects/:project_id
  • [x] PUT /teams/:team_id/projects/:project_id
  • [x] DELETE /teams/:team_id/projects/:project_id

New endpoints to be added:

  • [x] GET /orgs/:org/teams/:team_slug
  • [x] GET /organizations/:org_id/team/:team_id
  • [x] PATCH /orgs/:org/teams/:team_slug
  • [x] PATCH /organizations/:org_id/team/:team_id
  • [x] DELETE /orgs/:org/teams/:team_slug
  • [x] DELETE /organizations/:org_id/team/:team_id
  • [x] GET /orgs/:org/teams/:team_slug/teams
  • [x] GET /organizations/:org_id/team/:team_id/teams
  • [x] GET /orgs/:org/teams/:team_slug/repos
  • [x] GET /organizations/:org_id/team/:team_id/repos
  • [x] GET /orgs/:org/teams/:team_slug/repos/:owner/:repo
  • [x] GET /organizations/:org_id/team/:team_id/repos/:owner/:repo
  • [x] PUT /orgs/:org/teams/:team_slug/repos/:owner/:repo
  • [x] PUT /organizations/:org_id/team/:team_id/repos/:owner/:repo
  • [x] DELETE /orgs/:org/teams/:team_slug/repos/:owner/:repo
  • [x] DELETE /organizations/:org_id/team/:team_id/repos/:owner/:repo
  • [x] GET /orgs/:org/teams/:team_slug/projects
  • [x] GET /organizations/:org_id/team/:team_id/projects
  • [x] GET /orgs/:org/teams/:team_slug/projects/:project_id
  • [x] GET /organizations/:org_id/team/:team_id/projects/:project_id
  • [x] PUT /orgs/:org/teams/:team_slug/projects/:project_id
  • [x] PUT /organizations/:org_id/team/:team_id/projects/:project_id
  • [x] DELETE /orgs/:org/teams/:team_slug/projects/:project_id
  • [x] DELETE /organizations/:org_id/team/:team_id/projects/:project_id

@weeco - Wrapping up some changes per PR reviews. I should still be able to close this out. Thanks though!

Was this page helpful?
0 / 5 - 0 ratings