Skip to content

Commit

Permalink
Merge pull request #111 from XenitAB/github-apps-support
Browse files Browse the repository at this point in the history
Remove GitHub login check
  • Loading branch information
Edvin N authored Oct 25, 2021
2 parents 3e8d4ce + 76ebc72 commit e785866
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 26 deletions.
13 changes: 0 additions & 13 deletions pkg/git/github.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package git

import (
"context"
"errors"
"fmt"
"io/ioutil"
"net/http"
Expand Down Expand Up @@ -56,18 +55,6 @@ func NewGitHubGITProvider(ctx context.Context, remoteURL, token string) (*GitHub

client := github.NewClient(tc)

_, _, err = client.Repositories.List(ctx, "", nil)
if err != nil {
var githubError *github.ErrorResponse
if errors.As(err, &githubError) {
if githubError.Response.StatusCode == 401 {
return nil, fmt.Errorf("unable to authenticate using token")
}
}

return nil, err
}

return &GitHubGITProvider{
authClient: tc,
client: client,
Expand Down
5 changes: 0 additions & 5 deletions pkg/git/github_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,6 @@ var _ = Describe("NewGitHubGITProvider", func() {
Expect(err).To(MatchError("host does not start with https://github.com: https://foo.bar"))
})

It("returns error when creating with fake token", func() {
_, err = NewGitHubGITProvider(ctx, "https://github.com/org/repo", "foo")
Expect(err).To(MatchError("unable to authenticate using token"))
})

It("is successfully created when creating with correct token", func() {
var provider *GitHubGITProvider
remoteURL := os.Getenv("GITHUB_URL")
Expand Down
8 changes: 0 additions & 8 deletions pkg/git/provider_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,6 @@ func TestNewGitProvider(t *testing.T) {
token: "fake",
expectedError: "TF400813: The user '' is not authorized to access this resource.",
},
{
testDescription: "github provider returns error",
providerString: "github",
expectedProviderType: ProviderTypeGitHub,
remoteURL: "https://github.com/organization/repository",
token: "fake",
expectedError: "unable to authenticate using token",
},
{
testDescription: "fake provider returns error",
providerString: "fake",
Expand Down

0 comments on commit e785866

Please sign in to comment.