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
2 changes: 2 additions & 0 deletions pkg/cmd/release/shared/fetch.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ type ReleaseAsset struct {
Name string
Label string
Size int64
Digest *string
Comment thread
bdehamer marked this conversation as resolved.
Comment thread
andyfeller marked this conversation as resolved.
State string
APIURL string `json:"url"`

Expand Down Expand Up @@ -107,6 +108,7 @@ func (rel *Release) ExportData(fields []string) map[string]interface{} {
"name": a.Name,
"label": a.Label,
"size": a.Size,
"digest": a.Digest,
"state": a.State,
"createdAt": a.CreatedAt,
"updatedAt": a.UpdatedAt,
Expand Down
8 changes: 6 additions & 2 deletions pkg/cmd/release/view/view.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,10 +154,14 @@ func renderReleaseTTY(io *iostreams.IOStreams, release *shared.Release) error {

if len(release.Assets) > 0 {
fmt.Fprintln(w, cs.Bold("Assets"))
//nolint:staticcheck // SA1019: Showing NAME|SIZE headers adds nothing to table.
table := tableprinter.New(io, tableprinter.NoHeader)
table := tableprinter.New(io, tableprinter.WithHeader("Name", "Digest", "Size"))

@andyfeller andyfeller May 29, 2025 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

note: I've asked @bdehamer to add the header since we have multiple fields now and am concerned for screen readers.

for _, a := range release.Assets {
table.AddField(a.Name)
if a.Digest == nil {
table.AddField("")

Copilot AI May 27, 2025

Copy link

Choose a reason for hiding this comment

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

[nitpick] Instead of rendering an empty string for missing digests, consider using a visible placeholder (e.g., "-") so users can clearly tell that the digest is unavailable.

Suggested change
table.AddField("")
table.AddField("-")

Copilot uses AI. Check for mistakes.
} else {
table.AddField(*a.Digest)
Comment thread
andyfeller marked this conversation as resolved.
}
table.AddField(humanFileSize(a.Size))
table.EndRow()
}
Expand Down
14 changes: 8 additions & 6 deletions pkg/cmd/release/view/view_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,9 @@ func Test_viewRun(t *testing.T) {


Assets
windows.zip 12 B
linux.tgz 34 B
NAME DIGEST SIZE
windows.zip sha256:deadc0de 12 B
linux.tgz 34 B

View on GitHub: https://github.com/OWNER/REPO/releases/tags/v1.2.3
`),
Expand All @@ -174,8 +175,9 @@ func Test_viewRun(t *testing.T) {


Assets
windows.zip 12 B
linux.tgz 34 B
NAME DIGEST SIZE
windows.zip sha256:deadc0de 12 B
linux.tgz 34 B

View on GitHub: https://github.com/OWNER/REPO/releases/tags/v1.2.3
`),
Expand Down Expand Up @@ -248,8 +250,8 @@ func Test_viewRun(t *testing.T) {
"published_at": "%[1]s",
"html_url": "https://github.com/OWNER/REPO/releases/tags/v1.2.3",
"assets": [
{ "name": "windows.zip", "size": 12 },
{ "name": "linux.tgz", "size": 34 }
{ "name": "windows.zip", "size": 12, "digest": "sha256:deadc0de" },
{ "name": "linux.tgz", "size": 34, "digest": null }
]
}`, tt.releasedAt.Format(time.RFC3339), tt.releaseBody))

Expand Down