Skip to content

Commit 4cb5474

Browse files
scootafewnickfloydkfcampbell
authored
fix(resource_github_actions_environment_secret): handle 404 on repo read (#2323)
Co-authored-by: Nick Floyd <[email protected]> Co-authored-by: Keegan Campbell <[email protected]>
1 parent a6be28b commit 4cb5474

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

github/resource_github_actions_environment_secret.go

+8
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,14 @@ func resourceGithubActionsEnvironmentSecretRead(d *schema.ResourceData, meta int
130130

131131
repo, _, err := client.Repositories.Get(ctx, owner, repoName)
132132
if err != nil {
133+
if ghErr, ok := err.(*github.ErrorResponse); ok {
134+
if ghErr.Response.StatusCode == http.StatusNotFound {
135+
log.Printf("[INFO] Removing environment secret %s from state because it no longer exists in GitHub",
136+
d.Id())
137+
d.SetId("")
138+
return nil
139+
}
140+
}
133141
return err
134142
}
135143

0 commit comments

Comments
 (0)