Skip to content

Commit 8ceea22

Browse files
committed
fixup! fix: Refactor repository custom property
1 parent e1fe18e commit 8ceea22

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

github/resource_github_repository_custom_property.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,10 @@ func resourceGithubRepositoryCustomProperty() *schema.Resource {
7878
func resourceGithubRepositoryCustomPropertyDiff(ctx context.Context, d *schema.ResourceDiff, _ any) error {
7979
tflog.Debug(ctx, "Diffing GitHub repository custom property")
8080

81+
if !d.NewValueKnown("property_type") || !d.NewValueKnown("property_value") {
82+
return nil
83+
}
84+
8185
propertyTypeVal, _ := d.Get("property_type").(string)
8286
propertyType := github.PropertyValueType(propertyTypeVal)
8387
propertyValueVal, _ := d.Get("property_value").(*schema.Set)
@@ -248,6 +252,9 @@ func resourceGithubRepositoryCustomPropertyDelete(ctx context.Context, d *schema
248252

249253
_, err := client.Repositories.CreateOrUpdateCustomProperties(ctx, owner, repoName, []*github.CustomPropertyValue{&customProperty})
250254
if err != nil {
255+
if err, ok := errors.AsType[*github.ErrorResponse](err); ok && err.Response.StatusCode == 404 {
256+
return nil
257+
}
251258
return diag.FromErr(err)
252259
}
253260

0 commit comments

Comments
 (0)