Skip to content
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

[FEATURE] - ADD GH ENVIRONMENT SECRET CREATION #124

Open
patrick-hermann-sva opened this issue Sep 28, 2024 · 0 comments
Open

[FEATURE] - ADD GH ENVIRONMENT SECRET CREATION #124

patrick-hermann-sva opened this issue Sep 28, 2024 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@patrick-hermann-sva
Copy link
Contributor

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())
	}

}
@patrick-hermann-sva patrick-hermann-sva added the enhancement New feature or request label Sep 28, 2024
@patrick-hermann-sva patrick-hermann-sva self-assigned this Sep 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant