Skip to content

Commit

Permalink
Set GITHUB_TOKEN environment variable for hub (GoogleCloudPlatform#10091
Browse files Browse the repository at this point in the history
)
  • Loading branch information
trodge authored and Charles Leon committed Mar 11, 2024
1 parent bd43fc0 commit 81aa510
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions .ci/magician/cmd/generate_downstream.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,17 @@ var generateDownstreamCmd = &cobra.Command{
os.Exit(1)
}
ctlr := source.NewController(env["GOPATH"], "modular-magician", githubToken, rnr)
oldToken := os.Getenv("GITHUB_TOKEN")
if err := os.Setenv("GITHUB_TOKEN", githubToken); err != nil {
fmt.Println("Error setting GITHUB_TOKEN environment variable: ", err)
os.Exit(1)
}
defer func() {
if err := os.Setenv("GITHUB_TOKEN", oldToken); err != nil {
fmt.Println("Error setting GITHUB_TOKEN environment variable: ", err)
os.Exit(1)
}
}()

if len(args) != 4 {
fmt.Printf("Wrong number of arguments %d, expected 4\n", len(args))
Expand Down

0 comments on commit 81aa510

Please sign in to comment.