Skip to content

feat: Add the Digest field to ReleaseAsset - #3628

Merged
gmlewis merged 2 commits into
google:masterfrom
suzuki-shunsuke:feat-add-digest-to-release-asset
Jul 19, 2025
Merged

feat: Add the Digest field to ReleaseAsset#3628
gmlewis merged 2 commits into
google:masterfrom
suzuki-shunsuke:feat-add-digest-to-release-asset

Conversation

@suzuki-shunsuke

@suzuki-shunsukesuzuki-shunsuke commented Jul 19, 2025

Copy link
Copy Markdown
Contributor

Close#3627

https://github.blog/changelog/2025-06-03-releases-now-expose-digests-for-release-assets/
https://docs.github.com/en/rest/releases/releases?apiVersion=2022-11-28#get-a-release

The Get a Release API returns digests of assets.
To get digests, this commit adds the field Digest and the method GetDigest to ReleaseAsset.

https://github.blog/changelog/2025-06-03-releases-now-expose-digests-for-release-assets/https://docs.github.com/en/rest/releases/releases?apiVersion=2022-11-28#get-a-release
The `Get a Release` API returns digests of assets.
To get digests, this commit adds the field `Digest` and the method `GetDigest` to `ReleaseAsset`.
@suzuki-shunsuke

Copy link
Copy Markdown
ContributorAuthor

Test has passed.

$ ./script/test.shtesting .ok github.com/google/go-github/v73/github	3.617s	coverage: 99.1% of statements	github.com/google/go-github/v73/test/fields coverage: 0.0% of statements? github.com/google/go-github/v73/test/integration	[no test files]testing example	github.com/google/go-github/v73/example/actionpermissions coverage: 0.0% of statements	github.com/google/go-github/v73/example/appengine coverage: 0.0% of statements	github.com/google/go-github/v73/example/basicauth coverage: 0.0% of statements	github.com/google/go-github/v73/example/codespaces/newreposecretwithxcrypto coverage: 0.0% of statements	github.com/google/go-github/v73/example/codespaces/newusersecretwithxcrypto coverage: 0.0% of statements	github.com/google/go-github/v73/example/commitpr coverage: 0.0% of statements	github.com/google/go-github/v73/example/listenvironments coverage: 0.0% of statements	github.com/google/go-github/v73/example/migrations coverage: 0.0% of statements	github.com/google/go-github/v73/example/newfilewithappauth coverage: 0.0% of statements	github.com/google/go-github/v73/example/newrepo coverage: 0.0% of statements	github.com/google/go-github/v73/example/newreposecretwithxcrypto coverage: 0.0% of statements	github.com/google/go-github/v73/example/ratelimit coverage: 0.0% of statements	github.com/google/go-github/v73/example/simple coverage: 0.0% of statements	github.com/google/go-github/v73/example/tokenauth coverage: 0.0% of statements	github.com/google/go-github/v73/example/topics coverage: 0.0% of statements	github.com/google/go-github/v73/example/verifyartifact coverage: 0.0% of statementstesting scrapeok github.com/google/go-github/scrape	1.234s	coverage: 59.4% of statements	github.com/google/go-github/scrape/example/scrape coverage: 0.0% of statementstesting toolsok tools/metadata	1.280s	coverage: 81.7% of statementstesting tools/sliceofpointersok tools/sliceofpointers	1.452s	coverage: 94.7% of statements

@suzuki-shunsuke

Copy link
Copy Markdown
ContributorAuthor

I've confirmed the fix works as expected.

package main
import (
"context""encoding/json""log""os""github.com/google/go-github/v73/github""golang.org/x/oauth2"
)
funcmain() {
iferr:=run(); err!=nil {
log.Fatal(err)
}
}
funcrun() error {
ctx:=context.Background()
httpClient:=oauth2.NewClient(ctx, oauth2.StaticTokenSource(
&oauth2.Token{AccessToken: os.Getenv("GITHUB_TOKEN")},
))
client:=github.NewClient(httpClient).Repositoriesrelease, _, err:=client.GetRelease(ctx, "aquaproj", "aqua", 233010212)
iferr!=nil {
returnerr
}
encoder:=json.NewEncoder(os.Stdout)
encoder.SetIndent("", " ")
iferr:=encoder.Encode(release); err!=nil {
returnerr
}
returnnil
}
modulefoogo1.24.5require (
github.com/google/go-github/v73v73.0.0golang.org/x/oauth2v0.30.0
)
replacegithub.com/google/go-github/v73=>github.com/suzuki-shunsuke/go-github/v73v73.0.1-0.20250719051818-956a007e23farequiregithub.com/google/go-querystringv1.1.0// indirect
GITHUB_TOKEN=$(gh auth token) go run main.go

@codecov

codecovBot commented Jul 19, 2025

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 91.33%. Comparing base (69f5bc7) to head (956a007).
Report is 1 commits behind head on master.

Additional details and impacted files
@@ Coverage Diff @@## master #3628 +/- ##
=======================================
Coverage 91.33% 91.33% =======================================
Files 184 184 Lines 16174 16174 =======================================
Hits 14773 14773 Misses 1227 1227 Partials 174 174 

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@gmlewisgmlewis changed the title feat: add the field to Digest to ReleaseAssetfeat: Add the Digest field to ReleaseAssetJul 19, 2025
@gmlewis

Copy link
Copy Markdown
Collaborator

Thank you, @suzuki-shunsuke and @alexandear!
LGTM.
Merging.

@gmlewis
gmlewis merged commit 18877d9 into google:masterJul 19, 2025
7 checks passed
@suzuki-shunsuke
suzuki-shunsuke deleted the feat-add-digest-to-release-asset branch July 19, 2025 12:18
jlaportebot added a commit to jlaportebot/go-github that referenced this pull request Jun 28, 2026
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add the field Digest to ReleaseAsset

3 participants

@suzuki-shunsuke@gmlewis@alexandear