Skip to content

Commit 2a3fb4d

Browse files
committed
Merge branch 'main' into v6
2 parents f73621b + 414299f commit 2a3fb4d

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

github/resource_github_release.go

+8
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"context"
55
"fmt"
66
"log"
7+
"net/http"
78
"strconv"
89

910
"github.com/google/go-github/v57/github"
@@ -162,6 +163,13 @@ func resourceGithubReleaseRead(d *schema.ResourceData, meta interface{}) error {
162163

163164
release, _, err := client.Repositories.GetRelease(ctx, owner, repository, releaseID)
164165
if err != nil {
166+
if ghErr, ok := err.(*github.ErrorResponse); ok {
167+
if ghErr.Response.StatusCode == http.StatusNotFound {
168+
log.Printf("[INFO] Removing release ID %d for repository %s from state, because it no longer exists on GitHub", releaseID, repository)
169+
d.SetId("")
170+
return nil
171+
}
172+
}
165173
return err
166174
}
167175
transformResponseToResourceData(d, release, repository)

website/docs/r/repository_file.html.markdown

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ The following arguments are supported:
5151

5252
* `commit_email` - (Optional) Committer email address to use. **NOTE:** GitHub app users may omit author and email information so GitHub can verify commits as the GitHub App. This may be useful when a branch protection rule requires signed commits.
5353

54-
* `commit_message` - (Optional) Commit message when adding or updating the managed file.
54+
* `commit_message` - (Optional) The commit message when creating, updating or deleting the managed file.
5555

5656
* `overwrite_on_create` - (Optional) Enable overwriting existing files. If set to `true` it will overwrite an existing file with the same name. If set to `false` it will fail if there is an existing file with the same name.
5757

0 commit comments

Comments
 (0)