import (
"github.com/drone/drone-go/drone"
"golang.org/x/oauth2"
)
const (
token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9"
host = "http://drone.company.com"
)
func main() {
// create an http client with oauth authentication.
config := new(oauth2.Config)
auther := config.Client(
oauth2.NoContext,
&oauth2.Token{
AccessToken: token,
},
)
// create the drone client with authenticator
client := drone.NewClient(host, auther)
// gets the current user
user, err := client.Self()
fmt.Println(user, err)
// gets the named repository information
repo, err := client.Repo("drone", "drone-go")
fmt.Println(repo, err)
}
forked from drone/drone-go
-
Notifications
You must be signed in to change notification settings - Fork 0
Go client for the Drone API
License
wzjgo1/drone-go
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
Go client for the Drone API
Resources
License
Stars
Watchers
Forks
Packages 0
No packages published
Languages
- Go 100.0%