hubstats
hubstats copied to clipboard
Handle not having access to org teams
If hubstats
is set to an org for which you are not a member (e.g., sportngin
), some features, such as adding webhooks and tracking teams, break. This is fine, but it'd be nice if thehubstats:setup
task still succeeded. It breaks when populating teams due to not having access to the ListTeams
endpoint.
Finished grabbing info about pull requests, populating teams
rake aborted!
Octokit::Forbidden: GET https://api.github.com/orgs/sportngin/teams?per_page=100: 403 - Must have admin rights to Repository. // See: https://developer.github.com/v3/orgs/teams/#list-teams
/var/lib/gems/2.3.0/gems/octokit-4.7.0/lib/octokit/response/raise_error.rb:16:in `on_complete'
/var/lib/gems/2.3.0/gems/faraday-0.13.1/lib/faraday/response.rb:9:in `block in call'
/var/lib/gems/2.3.0/gems/faraday-0.13.1/lib/faraday/response.rb:61:in `on_complete'
/var/lib/gems/2.3.0/gems/faraday-0.13.1/lib/faraday/response.rb:8:in `call'
/var/lib/gems/2.3.0/gems/octokit-4.7.0/lib/octokit/middleware/follow_redirects.rb:73:in `perform_with_redirection'
/var/lib/gems/2.3.0/gems/octokit-4.7.0/lib/octokit/middleware/follow_redirects.rb:61:in `call'
/var/lib/gems/2.3.0/gems/faraday-0.13.1/lib/faraday/rack_builder.rb:141:in `build_response'
/var/lib/gems/2.3.0/gems/faraday-0.13.1/lib/faraday/connection.rb:387:in `run_request'
/var/lib/gems/2.3.0/gems/faraday-0.13.1/lib/faraday/connection.rb:137:in `get'
/var/lib/gems/2.3.0/gems/sawyer-0.8.1/lib/sawyer/agent.rb:94:in `call'
/var/lib/gems/2.3.0/gems/octokit-4.7.0/lib/octokit/connection.rb:156:in `request'
/var/lib/gems/2.3.0/gems/octokit-4.7.0/lib/octokit/connection.rb:84:in `paginate'
/var/lib/gems/2.3.0/gems/octokit-4.7.0/lib/octokit/client/organizations.rb:287:in `organization_teams'
/home/elliott/me/projects/hubstats2/lib/hubstats/github_api.rb:102:in `update_teams'
/home/elliott/me/projects/hubstats2/lib/tasks/populate_task.rake:113:in `block (3 levels) in <top (required)>'
/home/elliott/me/projects/hubstats2/lib/tasks/populate_task.rake:13:in `block (3 levels) in <top (required)>'
/home/elliott/me/projects/hubstats2/lib/tasks/hubstats_tasks.rake:11:in `block (2 levels) in <top (required)>'
/home/elliott/me/projects/hubstats2/lib/tasks/hubstats_tasks.rake:19:in `block (2 levels) in <top (required)>'
/var/lib/gems/2.3.0/gems/rake-12.2.1/exe/rake:27:in `<top (required)>'
Also, here is my octokit.yml
, since it's related to GitHub access-control:
github_auth: # Must include access_token
access_token: redacted
github_config: # Must include org_name. The repo_list, team_list, and ignore_users_list are optional.
org_name: sportngin
webhook_secret: #<40 CHARACTER ACCESS TOKEN >
webhook_endpoint: #<url of webhook endpoint>