Merge pull request #9356 from cli/9278-gh-release-view-with-json-parser-outputs-node_id-instead-of-id

Expose json databaseId field for release commands
This commit is contained in:
Andy Feller 2024-07-23 10:06:57 -04:00 committed by GitHub
commit 78c33617cf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 37 additions and 13 deletions

View file

@ -21,22 +21,23 @@ import (
)
var ReleaseFields = []string{
"url",
"apiUrl",
"uploadUrl",
"tarballUrl",
"zipballUrl",
"id",
"tagName",
"name",
"body",
"isDraft",
"isPrerelease",
"createdAt",
"publishedAt",
"targetCommitish",
"author",
"assets",
"body",
"createdAt",
"databaseId",
"id",
"isDraft",
"isPrerelease",
"name",
"publishedAt",
"tagName",
"tarballUrl",
"targetCommitish",
"uploadUrl",
"url",
"zipballUrl",
}
type Release struct {

View file

@ -14,11 +14,34 @@ import (
"github.com/cli/cli/v2/pkg/cmdutil"
"github.com/cli/cli/v2/pkg/httpmock"
"github.com/cli/cli/v2/pkg/iostreams"
"github.com/cli/cli/v2/pkg/jsonfieldstest"
"github.com/google/shlex"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func TestJSONFields(t *testing.T) {
jsonfieldstest.ExpectCommandToSupportJSONFields(t, NewCmdView, []string{
"apiUrl",
"author",
"assets",
"body",
"createdAt",
"databaseId",
"id",
"isDraft",
"isPrerelease",
"name",
"publishedAt",
"tagName",
"tarballUrl",
"targetCommitish",
"uploadUrl",
"url",
"zipballUrl",
})
}
func Test_NewCmdView(t *testing.T) {
tests := []struct {
name string