-
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
Ignore repo syncs for projects without project id. #1254
Conversation
Just note to self that you're working this to:
|
Things to consider moving forward: There are "classes" of webhooks, some of which pertain to the repository and project and other that don't (installation, e.g.). As CC adds more webhook handlers for various reasons, the |
|> process_event(type, delivery_id, payload) | ||
process_status = type |> EventSupport.status(action) | ||
process_status |> process_event(type, delivery_id, payload) | ||
process_status | ||
else | ||
:ignored | ||
end |
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.
So will this line right now never run, the :ignored
line?
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.
Nevermind, I get it with the above comment. Should've waited.
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.
The :ignored
line will be executed in the case where the webhook event includes %{"repository" => %{"id" => _}}
but the associated GithubRepo
does not contain an associated project_id
in the DB.
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.
One minor change but otherwise LGTM.
where: not(is_nil(repo.project_id)) | ||
Repo.one(query) != nil | ||
end | ||
def should_process?(_), do: true |
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.
We probably want to make this fn private.
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.
We absolutely do, good catch.
With that change and a squash into a single commit we're good to merge this. |
Fixes #1221