-
Notifications
You must be signed in to change notification settings - Fork 60
/
main.go
47 lines (35 loc) · 1.01 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package main
import (
"fmt"
"log"
"github.com/buildkite/go-buildkite/v3/buildkite"
"gopkg.in/alecthomas/kingpin.v2"
)
var (
apiToken = kingpin.Flag("token", "API token").Required().String()
org = kingpin.Flag("org", "Orginization slug").Required().String()
debug = kingpin.Flag("debug", "Enable debugging").Bool()
)
func main() {
kingpin.Parse()
config, err := buildkite.NewTokenConfig(*apiToken, *debug)
if err != nil {
log.Fatalf("client config failed: %s", err)
}
client := buildkite.NewClient(config.Client())
pipeline := buildkite.Pipeline{
Slug: buildkite.String("my-great-repo"),
Description: buildkite.String("This ia a great pipeline!"),
Provider: &buildkite.Provider{
Settings: &buildkite.GitHubSettings{
TriggerMode: buildkite.String("fork"),
BuildPullRequests: buildkite.Bool(false),
},
},
}
resp, err := client.Pipelines.Update(*org, &pipeline)
if err != nil {
log.Fatalf("Updating pipeline failed: %s", err)
}
fmt.Println(resp.StatusCode)
}