-
Notifications
You must be signed in to change notification settings - Fork 234
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
Enable Webhooks for Pull Requests #746
Conversation
can you elaborate on what this will be used for / what this enabled or fixes ? |
The intent is to be able to build and upload assets on Pull requests that are deemed by those involved as something worth testing. Currently they need to copy their sha to Samson. I am aiming to expedite that process by watching for an explicit |
@@ -3,6 +3,8 @@ class Changeset::PullRequest | |||
CODE_ONLY = "[A-Z][A-Z\\d]+-\\d+" # e.g., S4MS0N-123, SAM-456 | |||
PUNCT = "\\s|\\p{Punct}|~|=" | |||
|
|||
WEBHOOK_FILTER = /(\[)\s*(samson)\s*(\])/i # [samson] |
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.
how about /\[\s*samson\s*\]/i
?
so when I push multiple times, this will run multiple times ? sounds like a useful feature ... |
This is separate from the code push webhook. In a hypothetical example: |
I noticed some behavior that was slightly different than I expected, but I think I'm in favor of. If you put If you only include This could be useful for developers that want to cause all code pushes on a PR to be deployed using I'm open to either way, but as it stands I left the behavior as is described here. |
Was discussing the usage of |
charon does |
wfm 👍 |
@@ -29,6 +30,19 @@ | |||
end | |||
end | |||
|
|||
describe ".changeset_from_webhook" do | |||
before do | |||
Rails.cache.clear |
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.
Where does this come from?
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.
Leftover from when the changeset_from_webhook
was making a github api call. thanks.
Decided to follow Charon's pattern using |
Enable Webhooks for Pull Requests
This PR will add functionality to the github webhook. It expands the types of webhook types Samson will respond to beyond Code Push. It uses the
ChangeSet
namespace to establish a common protocol to be a webhook handler. TheGithubController
then delegates the method calls to the webhook handler, and uses the returned info to decide how to respond.[samson]
to be present in the body of either the Pull Request or Issue Comment.production
Samson will ignore the[samson]
requirement.@zendesk/samson