Skip to content

Commit

Permalink
Add PullRequestResource functionality for updating labels and comments.
Browse files Browse the repository at this point in the history
Missing from this change:
* Statuses, since this might involve more discussion on the set of statuses
  that we want to support.
* Updating from changes to the raw payloads. Unclear how we want to
  handle these at the moment. Punting on this for now.

First step for supporting #778.

Co-authored-by: Dan Lorenc <[email protected]>
Co-authored-by: Billy Lynch <[email protected]>
  • Loading branch information
wlynch and dlorenc committed May 30, 2019
1 parent f456845 commit 8f80faf
Show file tree
Hide file tree
Showing 117 changed files with 39,644 additions and 8,191 deletions.
85 changes: 56 additions & 29 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

58 changes: 58 additions & 0 deletions cmd/pullrequest-init/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# pullrequest-init

pullrequest-init fetches pull request data from the given URL and places it in
the provided path.

This binary outputs a generic pull request object into `pr.json`, as well as
provider specific payloads.

Currently supported providers:

* GitHub

## Generic pull request payload

The payload generated by default aims to abstract the base features of any
pull request provider. Since there is no one true spec for pull requests, not
every feature may be available. The payload is output to `$PATH/pr.json` and
looks like:

```json
{
"Type": "github",
"ID": 188184279,
"Head": {
"Repo": "https://github.com/wlynch/test.git",
"Branch": "dev",
"SHA": "9bcde245572c74329827acdcab88792ebb84d578"
},
"Base": {
"Repo": "https://github.com/wlynch/test.git",
"Branch": "master",
"SHA": "1e80c83ed01e187669b836096335d1c8a2c57182"
},
"Comments": [
{
"Text": "test comment",
"Author": "wlynch",
"ID": 494418247,
"Raw": "/tmp/prtest/github/comments/494418247.json"
}
],
"Labels": [
{
"Text": "my-label"
}
],
"Raw": "/tmp/prtest/github/pr.json"
}
```

## GitHub

GitHub pull requests will output these additional files:

* `$PATH/github/pr.json`: The raw GitHub payload as specified by
https://developer.github.com/v3/pulls/#get-a-single-pull-request
* `$PATH/github/comments/#.json`: Comments associated to the PR as specified by
https://developer.github.com/v3/issues/comments/#get-a-single-comment
Loading

0 comments on commit 8f80faf

Please sign in to comment.