Skip to content

Commit

Permalink
Update docs (#96)
Browse files Browse the repository at this point in the history
  • Loading branch information
EyalDelarea committed Jun 28, 2023
1 parent 6988bdb commit 83c85a2
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
24 changes: 24 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ Currently supported providers are: [GitHub](#github), [Bitbucket Server](#bitbuc
- [Set Commit Status](#set-commit-status)
- [Get Commit Status](#get-commit-status)
- [Create Pull Request](#create-pull-request)
- [Update Pull Request](#update-pull-request)
- [List Open Pull Requests](#list-open-pull-requests)
- [Add Pull Request Comment](#add-pull-request-comment)
- [List Pull Request Comments](#list-pull-request-comments)
Expand Down Expand Up @@ -332,6 +333,29 @@ description := "Pull request description"
err := client.CreatePullRequest(ctx, owner, repository, sourceBranch, targetBranch, title, description)
```

##### Update Pull Request

```go
// Go context
ctx := context.Background()
// Organization or username
owner := "jfrog"
// VCS repository
repository := "jfrog-cli"
// Target pull request branch, leave empty for no change.
targetBranch := "main"
// Pull request title
title := "Pull request title"
// Pull request description
body := "Pull request description"
// Pull request ID
id := "1"
// Pull request state
state := vcsutils.Open

err := client.UpdatePullRequest(ctx, owner, repository, title, body, targetBranch, id, state)
```

#### List Open Pull Requests

```go
Expand Down
2 changes: 1 addition & 1 deletion vcsclient/github_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ func TestGitHubClient_UpdatePullRequest(t *testing.T) {
err = client.UpdatePullRequest(ctx, owner, repo1, "title", "body", "master", pullRequestId, vcsutils.Open)
assert.NoError(t, err)

err = createBadGitHubClient(t).CreatePullRequest(ctx, owner, repo1, branch1, branch2, "PR title", "PR body")
err = createBadGitHubClient(t).UpdatePullRequest(ctx, owner, repo1, "title", "body", "master", pullRequestId, vcsutils.Open)
assert.Error(t, err)
}

Expand Down

0 comments on commit 83c85a2

Please sign in to comment.