aboutsummaryrefslogtreecommitdiffstats
path: root/src/pull_request.rs
AgeCommit message (Collapse)Author
2017-11-17CommitRef::new(): Take a `JsonValue` instead of an `&str`Teddy Wing
We expect to have pre-parsed the JSON as this function will get called after `pull_request_opened_or_synchronized()`. To avoid doing the same JSON parsing work twice, take a `JsonValue` argument in both functions.
2017-11-17pull_request.rs: Add `pull_request_opened_or_synchronized()`Teddy Wing
A new function that, given the parsed JSON from a pull request webhook, tells us whether the pull request was "opened" or "synchronize"d with a boolean. This will enable us to only update commit statuses when actions on the pull request result in new commits being available. Otherwise, we don't want to set a commit status that we've already set before.
2017-11-17pull_request.rs: Remove old comments from testTeddy Wing
These are no longer relevant.
2017-11-12Add license (GNU GPLv3+)Teddy Wing
Add COPYING file and license notices to sources.
2017-11-11Handle `Result` return values in testsTeddy Wing
Update our failing test suite to work with our new return types now that many of our functions return `Result`s. Since these are tests, we handle them by panicking with error messages.
2017-11-11CommitRef::new(): Return `Result`Teddy Wing
Eliminate `.unwrap()` by returning a `Result`. The `JsonValue::take_string`s return `Options`, so if they're `None`, just fill the struct with the default for `String`, which is `""` empty string.
2017-11-09CommitRef::new: Parse `PullRequestEvent` payload instead of `PushEvent`Teddy Wing
I had originally written this method to parse the payload from the `PushEvent` GitHub webhook, but I now decided that I'd rather listen to the `PullRequestEvent` webhook. It'll mean less traffic and eliminates the work of updating GitHub commit statuses when they're not really going to be seen.
2017-11-09CommitRef: Add `owner` fieldTeddy Wing
This field stores the "owner" of the commit on GitHub, in other words, a user or organisation. Storing that information in this struct makes it easier to pass around.
2017-11-08pull_request.rs: Make `CommitRef` publicTeddy Wing
I had forgotten I needed to make the struct and its fields public. We need this to be able to use it outside of the module.
2017-11-07pull_request.rs: Parse JSON payload to create `CommitRef` structTeddy Wing
The test now passes, and we create our `CommitRef` struct using actual values from the parsed JSON. In order to get the branch name, we need the part after the last "/" in the "ref" key. There are a ton of `unwrap`s here, but at least it's a start and it's working now.
2017-11-07pull_request.rs: Idea to get needed data from JSON payloadTeddy Wing
Non-working app code, but the test tries to check that we get a structure with the right data given a JSON payload coming from the GitHub PushEvent webhook (copied from https://developer.github.com/v3/activity/events/types/#pushevent).
2017-11-07Add modules for GitHub and Jenkins interactionTeddy Wing
Empty stub modules that will be filled in with the communication code.