Skip to content

Commit 77035e6

Browse files
authored
fix: missing error returns (#2962)
* fix env secrets * fixes env vars * fixes default branch * fixes issues * fixes membership * fixes org webhooks * fixes org webhook * fixes repo collab, deply key, policy, and project * fix the remaining batch of resources * fixes the final batch of resources * Removes workflow * Removes all redundant returns * Updates the logic to remove duplicate contionals and simplify
1 parent 6d7a787 commit 77035e6

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

github/resource_github_actions_environment_variable.go

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -78,14 +78,11 @@ func resourceGithubActionsEnvironmentVariableCreateOrUpdate(d *schema.ResourceDa
7878
_, err := client.Actions.CreateEnvVariable(ctx, owner, repoName, escapedEnvName, variable)
7979
if err != nil {
8080
ghErr := &github.ErrorResponse{}
81-
if errors.As(err, &ghErr) {
82-
if ghErr.Response.StatusCode == http.StatusConflict {
83-
// Variable already exists, try to update instead
84-
_, err = client.Actions.UpdateEnvVariable(ctx, owner, repoName, escapedEnvName, variable)
85-
if err != nil {
86-
return err
87-
}
88-
} else {
81+
if errors.As(err, &ghErr) && ghErr.Response.StatusCode == http.StatusConflict {
82+
// Variable already exists, try to update instead
83+
// If it fails here, we want to return the error otherwise continue
84+
_, err = client.Actions.UpdateEnvVariable(ctx, owner, repoName, escapedEnvName, variable)
85+
if err != nil {
8986
return err
9087
}
9188
} else {

github/resource_github_user_ssh_key.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ func resourceGithubUserSshKeyRead(d *schema.ResourceData, meta any) error {
9797
return nil
9898
}
9999
}
100+
return err
100101
}
101102

102103
if err = d.Set("etag", resp.Header.Get("ETag")); err != nil {

0 commit comments

Comments
 (0)