You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
package main
import (
"context""fmt""log""github.com/google/go-github/v65/github"
)
funcmain() {
token:=""repo:="stuttgart-things"owner:="stuttgart-things"iftoken=="" {
log.Fatal("Unauthorized: No token present")
}
ctx:=context.Background()
client:=github.NewClient(nil).WithAuthToken(token)
opts:=&github.EnvironmentListOptions{ListOptions: github.ListOptions{}}
envResponse, _, err:=client.Repositories.ListEnvironments(ctx, owner, repo, opts)
iferr!=nil {
log.Fatal(err)
}
// The number of environments here should be equal to expectedPageSizefmt.Printf("%d environments returned\n", len(envResponse.Environments))
// loop through the environments and print the namefor_, env:=rangeenvResponse.Environments {
fmt.Printf("Environment: %s\n", env.GetName())
}
}
The text was updated successfully, but these errors were encountered:
The text was updated successfully, but these errors were encountered: