Skip to content

Commit

Permalink
add invididual user support for github branch
Browse files Browse the repository at this point in the history
  • Loading branch information
anGie44 authored and Jeremy Udit committed Sep 4, 2020
1 parent 26c2de3 commit e83e34d
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 33 deletions.
5 changes: 0 additions & 5 deletions github/data_source_github_branch.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,6 @@ func dataSourceGithubBranch() *schema.Resource {
}

func dataSourceGithubBranchRead(d *schema.ResourceData, meta interface{}) error {
err := checkOrganization(meta)
if err != nil {
return err
}

client := meta.(*Owner).v3client
orgName := meta.(*Owner).name
repoName := d.Get("repository").(string)
Expand Down
4 changes: 0 additions & 4 deletions github/data_source_github_branch_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@ import (
)

func TestAccGithubBranchDataSource_basic(t *testing.T) {
if err := testAccCheckOrganization(); err != nil {
t.Skipf("Skipping because %s.", err.Error())
}

var (
name = "main"
repo = "test-repo"
Expand Down
17 changes: 1 addition & 16 deletions github/resource_github_branch.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,6 @@ func resourceGithubBranch() *schema.Resource {
}

func resourceGithubBranchCreate(d *schema.ResourceData, meta interface{}) error {
err := checkOrganization(meta)
if err != nil {
return err
}

ctx := context.Background()
if !d.IsNewResource() {
ctx = context.WithValue(ctx, ctxId, d.Id())
Expand Down Expand Up @@ -92,7 +87,7 @@ func resourceGithubBranchCreate(d *schema.ResourceData, meta interface{}) error

log.Printf("[DEBUG] Creating GitHub branch reference %s/%s (%s)",
orgName, repoName, branchRefName)
_, _, err = client.Git.CreateRef(ctx, orgName, repoName, &github.Reference{
_, _, err := client.Git.CreateRef(ctx, orgName, repoName, &github.Reference{
Ref: &branchRefName,
Object: &github.GitObject{SHA: &sourceBranchSHA},
})
Expand All @@ -107,11 +102,6 @@ func resourceGithubBranchCreate(d *schema.ResourceData, meta interface{}) error
}

func resourceGithubBranchRead(d *schema.ResourceData, meta interface{}) error {
err := checkOrganization(meta)
if err != nil {
return err
}

ctx := context.WithValue(context.Background(), ctxId, d.Id())
if !d.IsNewResource() {
ctx = context.WithValue(ctx, ctxEtag, d.Get("etag").(string))
Expand Down Expand Up @@ -155,11 +145,6 @@ func resourceGithubBranchRead(d *schema.ResourceData, meta interface{}) error {
}

func resourceGithubBranchDelete(d *schema.ResourceData, meta interface{}) error {
err := checkOrganization(meta)
if err != nil {
return err
}

ctx := context.WithValue(context.Background(), ctxId, d.Id())

client := meta.(*Owner).v3client
Expand Down
8 changes: 0 additions & 8 deletions github/resource_github_branch_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,6 @@ import (
)

func TestAccGithubBranch_basic(t *testing.T) {
if err := testAccCheckOrganization(); err != nil {
t.Skipf("Skipping because %s.", err.Error())
}

var (
reference github.Reference

Expand Down Expand Up @@ -71,10 +67,6 @@ func TestAccGithubBranch_basic(t *testing.T) {
})
}
func TestAccGithubBranch_withSourceBranch(t *testing.T) {
if err := testAccCheckOrganization(); err != nil {
t.Skipf("Skipping because %s.", err.Error())
}

var (
reference github.Reference

Expand Down

0 comments on commit e83e34d

Please sign in to comment.