Skip to content

Commit

Permalink
Added additional documentation and testing for PullRequest CRD.
Browse files Browse the repository at this point in the history
  • Loading branch information
wlynch committed Jun 4, 2019
1 parent 6dedd98 commit b0c3441
Show file tree
Hide file tree
Showing 5 changed files with 354 additions and 170 deletions.
22 changes: 13 additions & 9 deletions cmd/pullrequest-init/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ provider specific payloads.

Currently supported providers:

* GitHub
* 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:
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
{
Expand Down Expand Up @@ -52,7 +52,11 @@ looks like:

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
* `$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

The binary will look for GitHub credentials in the `${GITHUBTOKEN}` environment
variable. This should generally be specified as a secret with the field name
`githubToken` in the `PullRequestResource` definition.
2 changes: 1 addition & 1 deletion cmd/pullrequest-init/github.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ type GitHubHandler struct {
// NewGitHubHandler initializes a new handler for interacting with GitHub
// resources.
func NewGitHubHandler(ctx context.Context, logger *zap.SugaredLogger, rawURL string) (*GitHubHandler, error) {
token := strings.TrimSpace(os.Getenv("GITHUBOAUTHTOKEN"))
token := strings.TrimSpace(os.Getenv("GITHUBTOKEN"))
var hc *http.Client
if token != "" {
ts := oauth2.StaticTokenSource(
Expand Down
Loading

0 comments on commit b0c3441

Please sign in to comment.