Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions github/data_source_github_branch.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ package github
import (
"context"
"errors"
"log"
"fmt"
"net/http"

"github.com/google/go-github/v84/github"
"github.com/hashicorp/terraform-plugin-log/tflog"
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
)
Expand Down Expand Up @@ -54,7 +55,11 @@ func dataSourceGithubBranchRead(ctx context.Context, d *schema.ResourceData, met
var ghErr *github.ErrorResponse
if errors.As(err, &ghErr) {
if ghErr.Response.StatusCode == http.StatusNotFound {
log.Printf("[DEBUG] Missing GitHub branch %s/%s (%s)", orgName, repoName, branchRefName)
tflog.Debug(ctx, fmt.Sprintf("Missing GitHub branch %s/%s (%s)", orgName, repoName, branchRefName), map[string]any{
"org": orgName,
"repo": repoName,
"branch": branchRefName,
})
d.SetId("")
return nil
}
Expand Down