Skip to content

Rename GitHub Apps installation and installation_repositories events. - #655

Merged
dmitshur merged 2 commits into
google:masterfrom
bradleyfalzon:gh-apps
Jun 4, 2017
Merged

dmitshur merged 2 commits into
google:masterfrom
bradleyfalzon:gh-apps

Conversation

@bradleyfalzon

Copy link
Copy Markdown
Contributor

With the release of GitHub Apps (was GitHub Integrations), GitHub
have renamed the integration_installation and integration_installation_repositories
event to installation and installation_repositories respectively.

This is a breaking change for those using this API, and can be fixed with:

gofmt -w -r 'IntegrationInstallationEvent -> InstallationEvent' [path ...]
gofmt -w -r 'IntegrationInstallationRepositoriesEvent -> InstallationRepositoriesEvent' [path ...]

Closes #627.
Updates #434.

@bradleyfalzon

Copy link
Copy Markdown
Contributor Author

The PR closes 627 as I believe this was the only action item (address the breaking changes).

@dmitshur dmitshur left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks.

I don't see any issues, but I'm not the most familiar with the issue.

I think we'll want to bump libraryVersion as part of a breaking API change like this.

@gmlewis, what are your thoughts on this?

Comment thread github/event_types.go
// The action that was performed. Can be either "added" or "removed".
Action *string `json:"action,omitempty"`
RepositoriesAdded []*Repository `json:"repositories_added,omitempty"`
RepositoriesRemoved []*Repository `json:"repositories_removed,omitempty"`

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This struct is missing repository_selection field from https://developer.github.com/v3/activity/events/types/#installationrepositoriesevent. Is it in scope of this PR too add it?

@dmitshur
dmitshur requested a review from gmlewis June 3, 2017 06:30
@dmitshur

dmitshur commented Jun 3, 2017

Copy link
Copy Markdown
Member

Question. I don't see any entries for these 2 events in messages_test.go. Is there a reason for that, or is it unintentional? Could you add it as part of this PR too?

@bradleyfalzon

Copy link
Copy Markdown
Contributor Author

I was only addressing the renaming of fields in preparation for the removal, I can address the additional fields and tests too. Once there's agreement on libraryVersion I'll make the other changes then.

@dmitshur

dmitshur commented Jun 3, 2017

Copy link
Copy Markdown
Member

I'm completely okay with keeping the scope of this PR with dealing with the breaking API change rename, and leaving the rest out. Up to you.

@bradleyfalzon

bradleyfalzon commented Jun 3, 2017 •

Copy link
Copy Markdown
Contributor Author

Let me know what you want to do with the library version, and I'll take a closer look at the other changes (they sound straight forward), and I'll just look at making the PR two commits.

@dmitshur

dmitshur commented Jun 3, 2017

Copy link
Copy Markdown
Member

Let me know what you want to do with the library version

It's currently "7", it should be bumped up by one to become "8".

Comment thread github/event_types.go
// event are: "created", "deleted".
// GitHub API docs: https://developer.github.com/v3/activity/events/types/#installationevent
type InstallationEvent struct {
// The action that was performed. Can be either "created" or "deleted".

@bradleyfalzon bradleyfalzon Jun 3, 2017 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shurcooL do you want me to remove these field comments? They duplicate the GitHub API and it's only a comment for a single field, yet the GitHub API have docs for other fields. So either these should be removed or all of the fields should have the docs duplicated IMHO - is there another reason they are there?

Just the field comments, not the struct comments.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, keep them, they're helpful and appreciated (as long as they're accurate, and I've checked, they are).

@bradleyfalzon

Copy link
Copy Markdown
Contributor Author

OK, leave this with me, I'll get at it within a week.

@gmlewis gmlewis left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM after the libraryVersion is bumped.

With the release of GitHub Apps (was GitHub Integrations), GitHub
have renamed the integration_installation and integration_installation_repositories
event to installation and installation_repositories respectively.

This is a breaking change for those using this API, and can be fixed with:

gofmt -w -r 'IntegrationInstallationEvent -> InstallationEvent' [path ...]
gofmt -w -r 'IntegrationInstallationRepositoriesEvent -> InstallationRepositoriesEvent' [path ...]

Closes google#627.
Updates google#434.
@bradleyfalzon

Copy link
Copy Markdown
Contributor Author

OK, I've pushed the changes as discussed in the first commit, libraryVersion was incremented, repository_selection was added to InstallationRepositoriesEvent and tests were added to messages_test.go. Can you please confirm these are the changes that were intended?

I've also pushed another commit in the related GitHub Apps service. Essentially, renaming it from IntegrationsService to AppsService. I don't use this service at all, so hopefully these changes are correct and follow conventions. Specifically should it be AppsService or AppService (the GitHub docs URLs refer to /apps/ but the API refers to /app/). Also, the file rename from github/integration_installation.go to github/installation.go, I was unsure whether it should have been renamed to github/apps_installation.go to follow the docs hierarchy https://developer.github.com/v3/apps/installations or the API GET /installation/repositories.

@dmitshur

dmitshur commented Jun 3, 2017 •

Copy link
Copy Markdown
Member

OK, I've pushed the changes as discussed in the first commit, libraryVersion was incremented, repository_selection was added to InstallationRepositoriesEvent and tests were added to messages_test.go. Can you please confirm these are the changes that were intended?

Looks good.

I've also pushed another commit in the related GitHub Apps service. Essentially, renaming it from IntegrationsService to AppsService. I don't use this service at all, so hopefully these changes are correct and follow conventions. Specifically should it be AppsService or AppService (the GitHub docs URLs refer to /apps/ but the API refers to /app/). Also, the file rename from github/integration_installation.go to github/installation.go, I was unsure whether it should have been renamed to github/apps_installation.go to follow the docs hierarchy https://developer.github.com/v3/apps/installations or the API GET /installation/repositories.

Let's go with AppsService. It's consistent with docs, and with the plural versions of RepositoriesService, IssuesService, etc. Naming the file apps_installation.go with the apps_ prefix SGTM.

From https://github.com/google/go-github/blob/master/CONTRIBUTING.md#other-notes-on-code-organization:

Other notes on code organization

Currently, everything is defined in the main github package, with API methods
broken into separate service objects. These services map directly to how
the GitHub API documentation is organized, so use that as your guide for
where to put new methods.

Code is organized in files also based pretty closely on the GitHub API
documentation, following the format {service}_{api}.go. For example, methods
defined at https://developer.github.com/v3/repos/hooks/ live in
repos_hooks.go.

So in general prefer looking at the API docs structure, not the API endpoint URLs.

@bradleyfalzon

Copy link
Copy Markdown
Contributor Author

Thanks @shurcooL, I've added the apps_ prefix. I believe everything is in order if you do.

Comment thread github/apps.go Outdated
//
// GitHub API docs: https://developer.github.com/v3/integrations/
type IntegrationsService service
// GitHub API docs: https://developer.github.com/v3/apps/

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There should be a single space after colon.

@dmitshur dmitshur left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Few minor nits, and this LGTM again. Thanks!

Comment thread github/github.go Outdated
Git *GitService
Gitignores *GitignoresService
Integrations *IntegrationsService
Apps *AppsService

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's move it up so it's alphabetical.

Comment thread github/github.go Outdated
c.Git = (*GitService)(&c.common)
c.Gitignores = (*GitignoresService)(&c.common)
c.Integrations = (*IntegrationsService)(&c.common)
c.Apps = (*AppsService)(&c.common)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also here.

This is to follow new GitHub Apps naming from GitHub Integrations.
@bradleyfalzon

Copy link
Copy Markdown
Contributor Author

All fixed, can you review again?

@dmitshur

dmitshur commented Jun 4, 2017 •

Copy link
Copy Markdown
Member

If this is ready from your side, I can merge.

@bradleyfalzon

Copy link
Copy Markdown
Contributor Author

I'm happy with this. This isn't an extensive update of all GitHub Apps end points, it was just focusing on making the naming changes required from Integrations to GitHub Apps. There's still some missing pieces there.

@dmitshur
dmitshur merged commit 108c01a into google:master Jun 4, 2017
@bradleyfalzon
bradleyfalzon deleted the gh-apps branch June 4, 2017 04:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support new GitHub Apps (formerly Integrations) API.

3 participants