-
Notifications
You must be signed in to change notification settings - Fork 86
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"installation_repositories" webhook #834
Conversation
NOTE: One of the tests in the |
51852b9
to
2609560
Compare
I pushed this as far as I could. There are edge cases to be handled, but I believe they are out of scope for this PR. Here's a list. I'm currently creating issues for these:
|
2609560
to
8b78a8c
Compare
Based on your feedback from standup, we create/delete From that, it's not completely clear what we do on Is the end goal creation/removal of If so, how do the Is it not possible to "follow", "unfollow" repositories for an app from Github's own UI? Also, if it's just a single click, without a select/deselect all, then #839 is way smaller in priority, possibly even not necessary. This will certainly make things simpler in the module being added here, though. |
Yes. However, in the
I don't think we need to handle these. We're only concerned with the repositories available to a given installation.
It is possible. This is the only way repositories get added/removed to/from an installation, other than those repositories added in the initial install step (which may have been all).
I think we'd prefer a single click for now. Maybe at some point we can do a select all, but the interactions are just too complex right now for us to concern ourselves with bundling all these up into a single action just yet. |
It's entirely possible that an event is not yet processable because we don't have sufficient information to process it. We need to be able to mark the state of these events and loop back to them to reprocess once we have the data. There are numerous reasons that could lead to receiving and processing webhooks out of order, so we need to be resilient and idempotent. |
I think these questions are maybe resolved due to our conversation earlier this morning. You can correct me if I'm wrong. |
See my comment above about idempotency. |
@joshsmith There's a small part that irks e a bit. The "repositories_added"/"removed_lists" in the event payload only have I guess https://developer.github.com/v3/repos/#get points us in the direction of However, in the payload, we do have the From https://developer.github.com/v3/apps/installations/#add-repository-to-installation
That would imply the sender could be an admin to, so no-go on that part. However, the "installation" hash of the payload also has an "account" hash, which, again, contains information about the repo. Any chance that one is guaranteed to be the correct one? If neither is right, we'd have to fetch from API, of course, but if it can be avoided, I would prefer to go one of these routes. |
14f76b7
to
1c3d633
Compare
def change do | ||
create table(:project_github_repos) do | ||
add :project_id, references(:projects, on_delete: :delete_all) | ||
add :github_repo_id, references(:github_repos, on_delete: :delete_all) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
on_delete:
specifies what happens when the parent record, in this case, GithubRepo
or Project
gets deleted, not what happens when we delete this record.
We want to delete a ProjectGithubRepo
whenever a Project
or a GithubRepo
get deleted.
1c3d633
to
a3bee28
Compare
…" events Make github repo adapter more strict. Add error response for invalid structure Updated dialyxir Add types to GithubRepo, GithubAppInstallation Fixed some GitHub request issues and specs Cleaned up Installation::created event handling - restructured flow - added transaction - made sure all paths can execute without errors
f8bd4c3
to
fbe130b
Compare
Closes #826
This is a spike to get the most basic path for handling of the "installation_repositories" webhook working. The 3 basic cases work
These 3 paths are done and tests for them pass. However, there are details we need to iron out as well as edge cases we need to handle. They are all marked by TODO comments in the event module.