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

Add dispatch support for esc-cli #73

Merged
merged 1 commit into from
Oct 10, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions cmd/pulumictl/create/cli-docs-build/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ type Payload struct {
Ref string `json:"ref"`
}

const eventType = "pulumi-cli"

func Command() *cobra.Command {
viper := viperlib.New()
command := &cobra.Command{
Expand All @@ -41,6 +39,7 @@ func Command() *cobra.Command {
githubToken := viperlib.GetString("token")
org = viper.GetString("org")
docsRepo := viper.GetString("docs-repo")
eventType := viper.GetString("event-type")
ref := args[0]

// perform some string manipulation and validation
Expand Down Expand Up @@ -86,7 +85,7 @@ func Command() *cobra.Command {
}

// output stuff
fmt.Println("Submitting dispatch event to:", docsRepo)
fmt.Printf("Submitting %q dispatch event to: %s\n", eventType, docsRepo)
fmt.Println(string(payload))

return nil
Expand All @@ -96,11 +95,14 @@ func Command() *cobra.Command {

command.Flags().StringP("org", "o", "pulumi", "the GitHub org that hosts the provider in the arg")
command.Flags().StringP("docs-repo", "d", "pulumi/docs", "the docs repository to send in the payload")
command.Flags().StringP("event-type", "e", "pulumi-cli", "the event type for the repository dispatch")

util.NoErr(viper.BindEnv("org", "GITHUB_ORG"))
util.NoErr(viper.BindEnv("docs-repo", "GITHUB_DOCS_REPO"))
util.NoErr(viper.BindEnv("event-type", "GITHUB_EVENT_TYPE"))
util.NoErr(viper.BindPFlag("org", command.Flags().Lookup("org")))
util.NoErr(viper.BindPFlag("docs-repo", command.Flags().Lookup("docs-repo")))
util.NoErr(viper.BindPFlag("event-type", command.Flags().Lookup("event-type")))

return command
}