-
Notifications
You must be signed in to change notification settings - Fork 2.2k
feat: Add the Digest
field to ReleaseAsset
#3628
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
gmlewis
merged 2 commits into
google:master
from
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:master
from
suzuki-shunsuke:feat-add-digest-to-release-asset
Jul 19, 2025
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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`.
Test has passed. $ ./script/test.sh
testing .
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 statements
testing scrape
ok 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 statements
testing tools
ok tools/metadata 1.280s coverage: 81.7% of statements
testing tools/sliceofpointers
ok tools/sliceofpointers 1.452s coverage: 94.7% of statements |
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"
)
func main() {
if err := run(); err != nil {
log.Fatal(err)
}
}
func run() error {
ctx := context.Background()
httpClient := oauth2.NewClient(ctx, oauth2.StaticTokenSource(
&oauth2.Token{AccessToken: os.Getenv("GITHUB_TOKEN")},
))
client := github.NewClient(httpClient).Repositories
release, _, err := client.GetRelease(ctx, "aquaproj", "aqua", 233010212)
if err != nil {
return err
}
encoder := json.NewEncoder(os.Stdout)
encoder.SetIndent("", " ")
if err := encoder.Encode(release); err != nil {
return err
}
return nil
} module foo
go 1.24.5
require (
github.com/google/go-github/v73 v73.0.0
golang.org/x/oauth2 v0.30.0
)
replace github.com/google/go-github/v73 => github.com/suzuki-shunsuke/go-github/v73 v73.0.1-0.20250719051818-956a007e23fa
require github.com/google/go-querystring v1.1.0 // indirect GITHUB_TOKEN=$(gh auth token) go run main.go |
alexandear
approved these changes
Jul 19, 2025
Codecov ReportAll modified and coverable lines are covered by tests ✅
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. 🚀 New features to boost your workflow:
|
Digest
field to ReleaseAsset
Thank you, @suzuki-shunsuke and @alexandear! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 methodGetDigest
toReleaseAsset
.