Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions github/github-accessors.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions github/github-accessors_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion github/github-stringify_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions github/repos_releases.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ type RepositoryRelease struct {
TarballURL *string `json:"tarball_url,omitempty"`
Author *User `json:"author,omitempty"`
NodeID *string `json:"node_id,omitempty"`
Immutable *bool `json:"immutable,omitempty"`
}

func (r RepositoryRelease) String() string {
Expand Down
6 changes: 5 additions & 1 deletion github/repos_releases_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ func TestRepositoriesService_CreateRelease(t *testing.T) {
TarballURL: Ptr("http://tarballurl/"),
Author: &User{Name: Ptr("octocat")},
NodeID: Ptr("nodeid"),
Immutable: Ptr(false),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can't set Immutable in CreateRelease, see https://docs.github.com/en/rest/releases/releases?apiVersion=2022-11-28#create-a-release--parameters

If I understand correctly, @alexandear, this is a case where the documentation does not properly reflect the actual behavior of the system. In #3720 there is a demonstration using curl of receiving the immutable field, so it does indeed appear to exist.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This added line is in a section commented as "Fields to be removed". It contains a bunch of other fields that I suppose one cannot set when creating a release, such as the release id, created at, published at, etc. IIUC the purpose of having these set here is to verify that we will not be sending them in create requests even if they're set.

}

mux.HandleFunc("/repos/o/r/releases", func(w http.ResponseWriter, r *http.Request) {
Expand Down Expand Up @@ -290,6 +291,7 @@ func TestRepositoriesService_EditRelease(t *testing.T) {
TarballURL: Ptr("http://tarballurl/"),
Author: &User{Name: Ptr("octocat")},
NodeID: Ptr("nodeid"),
Immutable: Ptr(false),
}

mux.HandleFunc("/repos/o/r/releases/1", func(w http.ResponseWriter, r *http.Request) {
Expand Down Expand Up @@ -875,6 +877,7 @@ func TestRepositoryRelease_Marshal(t *testing.T) {
TarballURL: Ptr("turl"),
Author: &User{ID: Ptr(int64(1))},
NodeID: Ptr("nid"),
Immutable: Ptr(true),
}

want := `{
Expand Down Expand Up @@ -903,7 +906,8 @@ func TestRepositoryRelease_Marshal(t *testing.T) {
"author": {
"id": 1
},
"node_id": "nid"
"node_id": "nid",
"immutable": true
}`

testJSONMarshal(t, u, want)
Expand Down
Loading