Documentation
¶
Overview ¶
SPDX-License-Identifier: MIT
Copyright (c) 2018 Telia Company ¶
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
SPDX-License-Identifier: BSD-3-Clause
Authors: Alexander Jung <alex@nderjung.net>
Copyright (c) 2020, Alexander Jung. All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
- Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Index ¶
- func ParseCommentHTMLURL(prUrl string) (int, error)
- type Git
- type GitClient
- func (g *GitClient) Checkout(branch, sha string, submodules bool) error
- func (g *GitClient) Endpoint(uri string) (string, error)
- func (g *GitClient) Fetch(uri string, prNumber int, depth int, submodules bool) error
- func (g *GitClient) GitCryptUnlock(base64key string) error
- func (g *GitClient) Init(branch string) error
- func (g *GitClient) Merge(sha string, submodules bool) error
- func (g *GitClient) Pull(uri, branch string, depth int, submodules bool, fetchTags bool) error
- func (g *GitClient) Rebase(baseRef string, headSha string, submodules bool) error
- func (g *GitClient) RevParse(branch string) (string, error)
- type Github
- type GithubClient
- func (c *GithubClient) AddPullRequestLabels(prID int, labels []string) error
- func (c *GithubClient) CreatePullRequestComment(prID int, comment string) error
- func (c *GithubClient) DeleteLastPullRequestComment(prID int) error
- func (c *GithubClient) GetPullRequest(prID int) (*github.PullRequest, error)
- func (c *GithubClient) GetPullRequestComment(commentID int64) (*github.IssueComment, error)
- func (c *GithubClient) GetPullRequestReview(prID int, reviewID int64) (*github.PullRequestReview, error)
- func (c *GithubClient) ListPullRequestComments(prID int) ([]*github.IssueComment, error)
- func (c *GithubClient) ListPullRequestReviews(prID int) ([]*github.PullRequestReview, error)
- func (c *GithubClient) ListPullRequests() ([]*github.PullRequest, error)
- func (c *GithubClient) RemovePullRequestLabels(prID int, labels []string) error
- func (c *GithubClient) ReplacePullRequestLabels(prID int, labels []string) error
- func (c *GithubClient) SetPullRequestState(prID int, state string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ParseCommentHTMLURL ¶
ParseCommentHTMLURL takes in a standard issue URL and returns the issue number, e.g.: https://github.com/octocat/Hello-World/issues/1347#issuecomment-1
Types ¶
type Git ¶ added in v0.1.4
type Git interface {
Init(string) error
Pull(string, string, int, bool, bool) error
RevParse(string) (string, error)
Fetch(string, int, int, bool) error
Checkout(string, string, bool) error
Merge(string, bool) error
Rebase(string, string, bool) error
GitCryptUnlock(string) error
}
Git interface for testing purposes.
type GitClient ¶ added in v0.1.4
GitClient ...
func NewGitClient ¶ added in v0.1.4
func NewGitClient(accessToken string, skipSsl, disableGitLfs bool, dir string, output io.Writer) (*GitClient, error)
NewGitClient ...
func (*GitClient) Endpoint ¶ added in v0.1.4
Endpoint takes an uri and produces an endpoint with the login information baked in.
func (*GitClient) GitCryptUnlock ¶ added in v0.1.4
GitCryptUnlock unlocks the repository using git-crypt
type Github ¶
type Github interface {
ListPullRequests() ([]*github.PullRequest, error)
GetPullRequest(prID int) (*github.PullRequest, error)
ListPullRequestComments(prID int) ([]*github.PullRequestComment, error)
ListPullRequestReviews(prID int) ([]*github.PullRequestReview, error)
GetPullRequestComment(commentID int64) (*github.IssueComment, error)
GetPullRequestReview(prID int, reviewID int64) (*github.PullRequestReview, error)
SetPullRequestState(prID int, state string) error
DeleteLastPullRequestComment(prID int) error
AddPullRequestLabels(prID int, labels []string) error
RemovePullRequestLabels(prID int, labels []string) error
ReplacePullRequestLabels(prID int, labels []string) error
CreatePullRequestComment(prID int, comment string) error
}
Github interface representing the desired functions for this resource.
type GithubClient ¶
GithubClient containing the necessary information to authenticate and perform actions against the REST API.
func NewGithubClient ¶
func NewGithubClient(repo string, accessToken string, skipSSL bool, githubEndpoint string) (*GithubClient, error)
NewGitHubClient for creating a new instance of the client.
func (*GithubClient) AddPullRequestLabels ¶
func (c *GithubClient) AddPullRequestLabels(prID int, labels []string) error
AddPullRequestLabels adds the list of labels to the existing set of labels given the relative pull request ID to the configure repo
func (*GithubClient) CreatePullRequestComment ¶
func (c *GithubClient) CreatePullRequestComment(prID int, comment string) error
CreatePullRequestComment adds a new comment to the pull request given its ID relative to the configured repo
func (*GithubClient) DeleteLastPullRequestComment ¶
func (c *GithubClient) DeleteLastPullRequestComment(prID int) error
func (*GithubClient) GetPullRequest ¶
func (c *GithubClient) GetPullRequest(prID int) (*github.PullRequest, error)
GetPullRequest returns the specific pull request given its ID relative to the configured repo
func (*GithubClient) GetPullRequestComment ¶
func (c *GithubClient) GetPullRequestComment(commentID int64) (*github.IssueComment, error)
GetPulLRequestComment returns the specific comment given its unique Github ID
func (*GithubClient) GetPullRequestReview ¶ added in v0.1.4
func (c *GithubClient) GetPullRequestReview(prID int, reviewID int64) (*github.PullRequestReview, error)
GetPulLRequestReview returns the specific review given its unique Github ID
func (*GithubClient) ListPullRequestComments ¶
func (c *GithubClient) ListPullRequestComments(prID int) ([]*github.IssueComment, error)
ListPullRequestComments returns the list of comments for the specific pull request given its ID relative to the configured repo
func (*GithubClient) ListPullRequestReviews ¶ added in v0.1.4
func (c *GithubClient) ListPullRequestReviews(prID int) ([]*github.PullRequestReview, error)
ListPullRequestReviews returns the list of reviews for the specific pull request given its ID relative to the configured repo
func (*GithubClient) ListPullRequests ¶
func (c *GithubClient) ListPullRequests() ([]*github.PullRequest, error)
ListPullRequests returns the list of pull requests for the configured repo
func (*GithubClient) RemovePullRequestLabels ¶
func (c *GithubClient) RemovePullRequestLabels(prID int, labels []string) error
RemovePullRequestLabels remove the list of labels from the set of existing labels given the relative pull request ID to the configured repo
func (*GithubClient) ReplacePullRequestLabels ¶
func (c *GithubClient) ReplacePullRequestLabels(prID int, labels []string) error
ReplacePullRequestLabels overrides all existing labels with the given set of labels for the pull request ID relative to the configured repo
func (*GithubClient) SetPullRequestState ¶
func (c *GithubClient) SetPullRequestState(prID int, state string) error