Skip to content

Commit e4ff06a

Browse files
committed
fix: set description unconditionally to allow clearing in update and create
1 parent 29f6931 commit e4ff06a

1 file changed

Lines changed: 8 additions & 12 deletions

File tree

github/resource_github_issue_label.go

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -84,13 +84,11 @@ func resourceGithubIssueLabelCreate(ctx context.Context, d *schema.ResourceData,
8484
Color: new(color),
8585
}
8686

87-
if v, ok := d.GetOk("description"); ok {
88-
description, ok := v.(string)
89-
if !ok {
90-
return diag.Errorf(`expected "description" to be string`)
91-
}
92-
label.Description = &description
87+
description, ok := d.Get("description").(string)
88+
if !ok {
89+
return diag.Errorf(`expected "description" to be string`)
9390
}
91+
label.Description = &description
9492
var githubLabel *github.Label
9593
_, resp, err := client.Issues.GetLabel(ctx, orgName, repoName, name)
9694
if err != nil {
@@ -200,13 +198,11 @@ func resourceGithubIssueLabelUpdate(ctx context.Context, d *schema.ResourceData,
200198
Name: new(name),
201199
Color: new(color),
202200
}
203-
if v, ok := d.GetOk("description"); ok {
204-
description, ok := v.(string)
205-
if !ok {
206-
return diag.Errorf(`expected "description" to be string`)
207-
}
208-
label.Description = &description
201+
description, ok := d.Get("description").(string)
202+
if !ok {
203+
return diag.Errorf(`expected "description" to be string`)
209204
}
205+
label.Description = &description
210206
githubLabel, resp, err := client.Issues.EditLabel(ctx, orgName, repoName, originalName, label)
211207
if err != nil {
212208
return diag.FromErr(err)

0 commit comments

Comments
 (0)