@@ -84,27 +84,16 @@ 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 }
94- var githubLabel * github.Label
95- _ , resp , err := client .Issues .GetLabel (ctx , orgName , repoName , name )
96- if err != nil {
97- if resp == nil || resp .StatusCode != http .StatusNotFound {
98- return diag .FromErr (err )
99- }
100- githubLabel , resp , err = client .Issues .CreateLabel (ctx , orgName , repoName , label )
101- } else {
102- githubLabel , resp , err = client .Issues .EditLabel (ctx , orgName , repoName , name , label )
103- }
104-
91+ label .Description = & description
92+ githubLabel , resp , err := client .Issues .CreateLabel (ctx , orgName , repoName , label )
10593 if err != nil {
10694 return diag .FromErr (err )
10795 }
96+
10897 id , err := buildID (repoName , name )
10998 if err != nil {
11099 return diag .FromErr (err )
@@ -200,13 +189,11 @@ func resourceGithubIssueLabelUpdate(ctx context.Context, d *schema.ResourceData,
200189 Name : new (name ),
201190 Color : new (color ),
202191 }
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
192+ description , ok := d .Get ("description" ).(string )
193+ if ! ok {
194+ return diag .Errorf (`expected "description" to be string` )
209195 }
196+ label .Description = & description
210197 githubLabel , resp , err := client .Issues .EditLabel (ctx , orgName , repoName , originalName , label )
211198 if err != nil {
212199 return diag .FromErr (err )
0 commit comments