-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
enhancementNew feature or requestNew feature or request
Description
package main
import (
"context"
"fmt"
"log"
"github.com/google/go-github/v65/github"
)
func main() {
token := ""
repo := "stuttgart-things"
owner := "stuttgart-things"
if token == "" {
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)
if err != nil {
log.Fatal(err)
}
// The number of environments here should be equal to expectedPageSize
fmt.Printf("%d environments returned\n", len(envResponse.Environments))
// loop through the environments and print the name
for _, env := range envResponse.Environments {
fmt.Printf("Environment: %s\n", env.GetName())
}
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request