Skip to content

Commit 6fc8411

Browse files
committed
Address linter issues
Signed-off-by: Timo Sand <timo.sand@f-secure.com>
1 parent 21f44f9 commit 6fc8411

1 file changed

Lines changed: 13 additions & 4 deletions

File tree

github/resource_github_repository.go

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -712,17 +712,26 @@ func resourceGithubRepositoryCreate(ctx context.Context, d *schema.ResourceData,
712712
return diag.FromErr(errors.New("failed to unpack template configuration block"))
713713
}
714714

715-
templateRepo := templateConfigMap["repository"].(string)
716-
templateRepoOwner := templateConfigMap["owner"].(string)
717-
includeAllBranches := templateConfigMap["include_all_branches"].(bool)
715+
templateRepo, ok := templateConfigMap["repository"].(string)
716+
if !ok {
717+
return diag.FromErr(errors.New("failed to unpack template repository name"))
718+
}
719+
templateRepoOwner, ok := templateConfigMap["owner"].(string)
720+
if !ok {
721+
return diag.FromErr(errors.New("failed to unpack template repository owner"))
722+
}
723+
includeAllBranches, ok := templateConfigMap["include_all_branches"].(bool)
724+
if !ok {
725+
return diag.FromErr(errors.New("failed to unpack template include_all_branches"))
726+
}
718727

719728
// Template API only supports Private boolean, so treat "internal" as private, then update via PATCH.
720729
private := repoReq.GetVisibility() != "public"
721730

722731
templateRepoReq := github.TemplateRepoRequest{
723732
Name: new(repoName),
724733
Owner: new(owner),
725-
Description: new(d.Get("description").(string)),
734+
Description: new(repoReq.GetDescription()),
726735
Private: new(private),
727736
IncludeAllBranches: new(includeAllBranches),
728737
}

0 commit comments

Comments
 (0)