From dfeae6313a8019b34bac491609d2c3e7a205ea87 Mon Sep 17 00:00:00 2001 From: Nick Taylor Date: Thu, 19 Sep 2024 19:34:59 -0400 Subject: [PATCH 01/24] chore: update pizza action (#201) --- .github/workflows/pizza.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pizza.yml b/.github/workflows/pizza.yml index aa0b863..852dade 100644 --- a/.github/workflows/pizza.yml +++ b/.github/workflows/pizza.yml @@ -11,6 +11,8 @@ jobs: runs-on: ubuntu-latest steps: - name: Pizza Action - uses: open-sauced/pizza-action@v2.1.0 + uses: open-sauced/pizza-action@v2.3.0 with: + cli-version: "v2.2.0" commit-and-pr: "true" + pr-title: "chore: update repository codeowners" From eec884b816404fdbbc5fb5445cb44fe211b8b0c8 Mon Sep 17 00:00:00 2001 From: BekahHW <34313413+BekahHW@users.noreply.github.com> Date: Fri, 20 Sep 2024 14:13:55 -0400 Subject: [PATCH 02/24] feat: Add quick start section (#203) * Add quick start section * Fix repo -> repositories * Update path to codeowners Co-authored-by: John McBride --------- Co-authored-by: John McBride --- README.md | 74 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 73 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 3de39d5..678c6e0 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ -# 📦 Install +# 📦 [Install](#-install) #### Homebrew @@ -149,6 +149,78 @@ jobs: how to use the Pizza command line tool and how it works with the rest of the OpenSauced ecosystem. +# 🚀 Quickstart + +Get up and running with the Pizza CLI in minutes using `npx`: + +1. **Ensure you have Node.js installed** + + Pizza CLI can be run using `npx`, which comes with Node.js. If you don't have Node.js installed, download it from [nodejs.org](https://nodejs.org/). + + > NOTE + > For other installation methods, see the [Install](#-Install) section. + +2. **Generate a configuration file** + + Navigate to your project directory and run: + ```sh + npx pizza@latest generate config ./ -i + ``` + This will create a `.sauced.yaml` file, interactively prompting you to attribute commit emails to GitHub handles. + +3. **Generate CODEOWNERS file** + + In your project directory, run: + ```sh + npx pizza@latest generate codeowners ./ + ``` + This will create a `CODEOWNERS` file based on your project's git history and the `.sauced.yaml` configuration. + +4. **Create OpenSauced [Contributor Insight](https://opensauced.pizza/docs/features/contributor-insights/)** + + After generating the CODEOWNERS file, you can create an OpenSauced Contributor Insight: + ```sh + npx pizza@latest generate insight . + ``` + +5. **Explore repository insights** + Get metrics and insights for your repository: + ```sh + npx pizza@latest insights repositories your-username/your-repo + ``` + +6. **Set up automated CODEOWNERS updates (Optional)** + Add the [Pizza GitHub Action](https://github.com/open-sauced/pizza-action) to your repository to automate CODEOWNERS updates: + ```yaml + # In .github/workflows/pizza-action.yml + name: OpenSauced Pizza Action + on: + schedule: + # Run once a week on Sunday at 00:00 UTC + - cron: "0 0 * * 0" + workflow_dispatch: # Allow manual triggering + + jobs: + pizza-action: + runs-on: ubuntu-latest + steps: + - name: Pizza Action + uses: open-sauced/pizza-action@v2.2.0 + with: + # optional and default is "latest". Add this parameter if you want to use a specific version, e.g. v2.0.0 + cli-version: "v2.2.0" + # optional and false by default. Set this to true if you want to have a pull request for the changes created automatically. + commit-and-pr: "true" + # optional + pr-title: "chore: update repository codeowners" + + ``` + +Now you're ready to leverage the Pizza CLI for managing code ownership and getting project insights with OpenSauced! + +> Note +> Using `npx pizza@latest` ensures you're always running the most recent version of Pizza CLI. If you prefer to use a specific version, you can replace `@latest` with a version number, e.g., `npx pizza@2.0.0`. + # ✨ Usage ## Codeowners generation From c102528670adab9e881a465d47c47fce62e23205 Mon Sep 17 00:00:00 2001 From: BekahHW <34313413+BekahHW@users.noreply.github.com> Date: Fri, 20 Sep 2024 18:14:38 +0000 Subject: [PATCH 03/24] chore(minor): release 2.2.0-beta.3 on beta channel [skip ci] MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## [2.2.0-beta.3](https://github.com/open-sauced/pizza-cli/compare/v2.2.0-beta.2...v2.2.0-beta.3) (2024-09-20) ### 🍕 Features * Add quick start section ([#203](https://github.com/open-sauced/pizza-cli/issues/203)) ([eec884b](https://github.com/open-sauced/pizza-cli/commit/eec884b816404fdbbc5fb5445cb44fe211b8b0c8)) --- CHANGELOG.md | 7 +++++++ npm/package-lock.json | 4 ++-- npm/package.json | 2 +- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 07ba2f3..2551a78 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,13 @@ > All notable changes to this project will be documented in this file +## [2.2.0-beta.3](https://github.com/open-sauced/pizza-cli/compare/v2.2.0-beta.2...v2.2.0-beta.3) (2024-09-20) + + +### 🍕 Features + +* Add quick start section ([#203](https://github.com/open-sauced/pizza-cli/issues/203)) ([eec884b](https://github.com/open-sauced/pizza-cli/commit/eec884b816404fdbbc5fb5445cb44fe211b8b0c8)) + ## [2.2.0-beta.2](https://github.com/open-sauced/pizza-cli/compare/v2.2.0-beta.1...v2.2.0-beta.2) (2024-09-18) diff --git a/npm/package-lock.json b/npm/package-lock.json index 178ae21..aac99c2 100644 --- a/npm/package-lock.json +++ b/npm/package-lock.json @@ -1,12 +1,12 @@ { "name": "pizza", - "version": "2.2.0-beta.2", + "version": "2.2.0-beta.3", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "pizza", - "version": "2.2.0-beta.2", + "version": "2.2.0-beta.3", "hasInstallScript": true, "license": "MIT", "bin": { diff --git a/npm/package.json b/npm/package.json index 12c9412..433bb2c 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "pizza", - "version": "2.2.0-beta.2", + "version": "2.2.0-beta.3", "description": "A command line utility for insights, metrics, and generating CODEOWNERS documentation for your open source projects", "repository": "https://github.com/open-sauced/pizza-cli", "license": "MIT", From 8d36d187c29ee55a7c4996115b02db4e833c7a67 Mon Sep 17 00:00:00 2001 From: Zeu Capua Date: Tue, 24 Sep 2024 10:40:09 -0700 Subject: [PATCH 04/24] init offboard command --- cmd/offboard/offboard.go | 37 +++++++++++++++++++++++++++++++++++++ cmd/root/root.go | 2 ++ 2 files changed, 39 insertions(+) create mode 100644 cmd/offboard/offboard.go diff --git a/cmd/offboard/offboard.go b/cmd/offboard/offboard.go new file mode 100644 index 0000000..4e0390a --- /dev/null +++ b/cmd/offboard/offboard.go @@ -0,0 +1,37 @@ +package offboard + +import ( + "fmt" + "errors" + + "github.com/spf13/cobra" +) + +type Options struct { + offboardingUsers []string +} + +const configLongDesc string = `[WIP] Removes a user from the \".sauced.yaml\" config and \"CODEOWNERS\" files. +Requires the user's name OR email.` + +func NewConfigCommand() *cobra.Command { + options := &Options{} + cmd := &cobra.Command{ + Use: "offboard [flags]", + Short: "[WIP] Removes a user from the \".sauced.yaml\" config and \"CODEOWNERS\" files.", + Long: configLongDesc, + Args: func(_ *cobra.Command, args []string) error { + if !(len(args) > 0) { + errors.New("you must provide at least one argument: the offboarding user's email/username") + } + + options.offboardingUsers = args + + return nil + }, + RunE: func(cmd *cobra.Command, args []string) error { + return nil + }, + } + return cmd +} diff --git a/cmd/root/root.go b/cmd/root/root.go index d41a435..0cd054f 100644 --- a/cmd/root/root.go +++ b/cmd/root/root.go @@ -10,6 +10,7 @@ import ( "github.com/open-sauced/pizza-cli/v2/cmd/docs" "github.com/open-sauced/pizza-cli/v2/cmd/generate" "github.com/open-sauced/pizza-cli/v2/cmd/insights" + "github.com/open-sauced/pizza-cli/v2/cmd/offboard" "github.com/open-sauced/pizza-cli/v2/cmd/version" "github.com/open-sauced/pizza-cli/v2/pkg/constants" ) @@ -44,6 +45,7 @@ func NewRootCommand() (*cobra.Command, error) { cmd.AddCommand(generate.NewGenerateCommand()) cmd.AddCommand(insights.NewInsightsCommand()) cmd.AddCommand(version.NewVersionCommand()) + cmd.AddCommand(offboard.NewConfigCommand()) // The docs command is hidden as it's only used by the pizza-cli maintainers docsCmd := docs.NewDocsCommand() From 74a6defe64b4cac538e9ba1c7f2e83c503354726 Mon Sep 17 00:00:00 2001 From: Zeu Capua Date: Tue, 24 Sep 2024 11:35:36 -0700 Subject: [PATCH 05/24] implement removing user from config based on name, only w specified config path --- cmd/offboard/offboard.go | 55 ++++++++++++++++++++++++++++++++++++---- cmd/offboard/output.go | 35 +++++++++++++++++++++++++ 2 files changed, 85 insertions(+), 5 deletions(-) create mode 100644 cmd/offboard/output.go diff --git a/cmd/offboard/offboard.go b/cmd/offboard/offboard.go index 4e0390a..834eab7 100644 --- a/cmd/offboard/offboard.go +++ b/cmd/offboard/offboard.go @@ -1,37 +1,82 @@ package offboard import ( - "fmt" "errors" + "fmt" + + "github.com/open-sauced/pizza-cli/v2/pkg/config" "github.com/spf13/cobra" ) type Options struct { offboardingUsers []string + + // config file path + configPath string + + // CODEOWNERS file path + ownersPath string + + // from global config + ttyDisabled bool } -const configLongDesc string = `[WIP] Removes a user from the \".sauced.yaml\" config and \"CODEOWNERS\" files. +const offboardLongDesc string = `[WIP] Removes a user from the \".sauced.yaml\" config and \"CODEOWNERS\" files. Requires the user's name OR email.` func NewConfigCommand() *cobra.Command { - options := &Options{} + opts := &Options{} cmd := &cobra.Command{ Use: "offboard [flags]", Short: "[WIP] Removes a user from the \".sauced.yaml\" config and \"CODEOWNERS\" files.", - Long: configLongDesc, + Long: offboardLongDesc, Args: func(_ *cobra.Command, args []string) error { if !(len(args) > 0) { errors.New("you must provide at least one argument: the offboarding user's email/username") } - options.offboardingUsers = args + opts.offboardingUsers = args return nil }, RunE: func(cmd *cobra.Command, args []string) error { + opts.ttyDisabled, _ = cmd.Flags().GetBool("tty-disable") + opts.configPath, _ = cmd.Flags().GetString("config") + + opts.ownersPath, _ = cmd.Flags().GetString("owners-path") + err := run(opts) + if err != nil { + return err + } return nil }, } + + cmd.PersistentFlags().StringP("owners-path", "o", "./CODEOWNERS", "the CODEOWNERS or OWNERS file to update") return cmd } + +func run(opts *Options) error { + // read config spec + spec, _, err := config.LoadConfig(opts.configPath) + + if err != nil { + return err + } + + attributions := spec.Attributions + for _, user := range opts.offboardingUsers { + // deletes if the user is a name (key) + delete(attributions, user) + } + + fmt.Print(attributions) + + err = generateOutputFile(opts.configPath, attributions) + if err != nil { + return err + } + + return nil +} diff --git a/cmd/offboard/output.go b/cmd/offboard/output.go new file mode 100644 index 0000000..5f092a9 --- /dev/null +++ b/cmd/offboard/output.go @@ -0,0 +1,35 @@ +package offboard + +import ( + "fmt" + "os" + + "github.com/open-sauced/pizza-cli/v2/pkg/config" + "github.com/open-sauced/pizza-cli/v2/pkg/utils" +) + +func generateOutputFile(outputPath string, attributionMap map[string][]string) error { + file, err := os.Create(outputPath) + if err != nil { + return fmt.Errorf("error creating %s file: %w", outputPath, err) + } + defer file.Close() + + var config config.Spec + config.Attributions = attributionMap + + // for pretty print test + yaml, err := utils.OutputYAML(config) + + if err != nil { + return fmt.Errorf("failed to turn into YAML: %w", err) + } + + _, err = file.WriteString(yaml) + + if err != nil { + return fmt.Errorf("failed to turn into YAML: %w", err) + } + + return nil +} From 8660829a5db494d30b290698d06f42b3b02124b6 Mon Sep 17 00:00:00 2001 From: Zeu Capua Date: Tue, 24 Sep 2024 12:00:30 -0700 Subject: [PATCH 06/24] remove a user based on email from config --- cmd/offboard/offboard.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/cmd/offboard/offboard.go b/cmd/offboard/offboard.go index 834eab7..2272517 100644 --- a/cmd/offboard/offboard.go +++ b/cmd/offboard/offboard.go @@ -3,6 +3,7 @@ package offboard import ( "errors" "fmt" + "slices" "github.com/open-sauced/pizza-cli/v2/pkg/config" @@ -69,6 +70,13 @@ func run(opts *Options) error { for _, user := range opts.offboardingUsers { // deletes if the user is a name (key) delete(attributions, user) + + // delete if the user is an email (value) + for k, v := range attributions { + if slices.Contains(v, user) { + delete(attributions, k) + } + } } fmt.Print(attributions) From 80dbb31e87d232593f78132a6f7d07c0e4174561 Mon Sep 17 00:00:00 2001 From: Zeu Capua Date: Wed, 25 Sep 2024 01:00:59 -0700 Subject: [PATCH 07/24] wip implement regenerating owners file --- cmd/offboard/offboard.go | 29 ++++++++++++++++-------- cmd/offboard/output.go | 49 +++++++++++++++++++++++++++++++++++++++- 2 files changed, 68 insertions(+), 10 deletions(-) diff --git a/cmd/offboard/offboard.go b/cmd/offboard/offboard.go index 2272517..ccb5fac 100644 --- a/cmd/offboard/offboard.go +++ b/cmd/offboard/offboard.go @@ -16,8 +16,8 @@ type Options struct { // config file path configPath string - // CODEOWNERS file path - ownersPath string + // repository path + path string // from global config ttyDisabled bool @@ -45,7 +45,7 @@ func NewConfigCommand() *cobra.Command { opts.ttyDisabled, _ = cmd.Flags().GetBool("tty-disable") opts.configPath, _ = cmd.Flags().GetString("config") - opts.ownersPath, _ = cmd.Flags().GetString("owners-path") + opts.path, _ = cmd.Flags().GetString("path") err := run(opts) if err != nil { return err @@ -54,36 +54,47 @@ func NewConfigCommand() *cobra.Command { }, } - cmd.PersistentFlags().StringP("owners-path", "o", "./CODEOWNERS", "the CODEOWNERS or OWNERS file to update") + cmd.PersistentFlags().StringP("path", "p", "./", "the path to the repository") return cmd } func run(opts *Options) error { - // read config spec spec, _, err := config.LoadConfig(opts.configPath) if err != nil { - return err + return fmt.Errorf("error loading config: %v", err) } + var offboardingNames []string attributions := spec.Attributions for _, user := range opts.offboardingUsers { + added := false + // deletes if the user is a name (key) delete(attributions, user) // delete if the user is an email (value) for k, v := range attributions { if slices.Contains(v, user) { + offboardingNames = append(offboardingNames, k) delete(attributions, k) + added = true } } + + if !added { + offboardingNames = append(offboardingNames, user) + } } - fmt.Print(attributions) + err = generateConfigFile(opts.configPath, attributions) + if err != nil { + return fmt.Errorf("error generating config file: %v", err) + } - err = generateOutputFile(opts.configPath, attributions) + err = generateOwnersFile(opts.path, offboardingNames) if err != nil { - return err + return fmt.Errorf("error generating owners file: %v", err) } return nil diff --git a/cmd/offboard/output.go b/cmd/offboard/output.go index 5f092a9..554978f 100644 --- a/cmd/offboard/output.go +++ b/cmd/offboard/output.go @@ -1,14 +1,16 @@ package offboard import ( + "errors" "fmt" "os" + "strings" "github.com/open-sauced/pizza-cli/v2/pkg/config" "github.com/open-sauced/pizza-cli/v2/pkg/utils" ) -func generateOutputFile(outputPath string, attributionMap map[string][]string) error { +func generateConfigFile(outputPath string, attributionMap map[string][]string) error { file, err := os.Create(outputPath) if err != nil { return fmt.Errorf("error creating %s file: %w", outputPath, err) @@ -33,3 +35,48 @@ func generateOutputFile(outputPath string, attributionMap map[string][]string) e return nil } + +func generateOwnersFile(path string, offboardingUsers []string) error { + outputType := "CODEOWNERS" + var owners []byte + var err error + + if _, err = os.Stat(path + "/CODEOWNERS"); !errors.Is(err, os.ErrNotExist) { + fmt.Print("CODEOWNERS EXISTS") + outputType = "CODEOWNERS" + owners, err = os.ReadFile(path + "/CODEOWNERS") + } else if _, err = os.Stat(path + "/OWNERS"); !errors.Is(err, os.ErrNotExist) { + fmt.Print("OWNERS EXISTS") + outputType = "OWNERS" + owners, err = os.ReadFile(path + "/OWNERS") + } + + if err != nil { + // fmt.Errorf("failed to find existing owners: %w", err) + fmt.Printf("WTF %v", err) + fmt.Printf("will create a new %s file in the path %s", outputType, path) + } + + lines := strings.Split(string(owners), "\n") + for _, line := range lines { + for _, name := range offboardingUsers { + fmt.Println(name) + strings.Cut(line, name) + } + } + + output := strings.Join(lines, "\n") + file, err := os.Create(path+"/"+outputType) + + if err != nil { + return fmt.Errorf("error creating %s file: %w", outputType, err) + } + defer file.Close() + + _, err = file.WriteString(output) + if err != nil { + return fmt.Errorf("failed writing file %s: %w", path+outputType, err) + } + + return nil +} From db866b3b9b50a83e019ae43835383a6407108652 Mon Sep 17 00:00:00 2001 From: Zeu Capua Date: Wed, 25 Sep 2024 10:13:00 -0700 Subject: [PATCH 08/24] implement remove by name --- cmd/offboard/output.go | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/cmd/offboard/output.go b/cmd/offboard/output.go index 554978f..f076838 100644 --- a/cmd/offboard/output.go +++ b/cmd/offboard/output.go @@ -4,6 +4,7 @@ import ( "errors" "fmt" "os" + "path/filepath" "strings" "github.com/open-sauced/pizza-cli/v2/pkg/config" @@ -37,37 +38,40 @@ func generateConfigFile(outputPath string, attributionMap map[string][]string) e } func generateOwnersFile(path string, offboardingUsers []string) error { - outputType := "CODEOWNERS" + outputType := "/CODEOWNERS" var owners []byte var err error - if _, err = os.Stat(path + "/CODEOWNERS"); !errors.Is(err, os.ErrNotExist) { + var ownersPath string + + if _, err = os.Stat(filepath.Join(path, "/CODEOWNERS")); !errors.Is(err, os.ErrNotExist) { fmt.Print("CODEOWNERS EXISTS") outputType = "CODEOWNERS" - owners, err = os.ReadFile(path + "/CODEOWNERS") - } else if _, err = os.Stat(path + "/OWNERS"); !errors.Is(err, os.ErrNotExist) { + ownersPath = filepath.Join(path, "/CODEOWNERS") + owners, err = os.ReadFile(ownersPath) + } else if _, err = os.Stat(filepath.Join(path, "OWNERS")); !errors.Is(err, os.ErrNotExist) { fmt.Print("OWNERS EXISTS") outputType = "OWNERS" - owners, err = os.ReadFile(path + "/OWNERS") + ownersPath = filepath.Join(path, "/OWNERS") + owners, err = os.ReadFile(ownersPath) } if err != nil { - // fmt.Errorf("failed to find existing owners: %w", err) - fmt.Printf("WTF %v", err) fmt.Printf("will create a new %s file in the path %s", outputType, path) } lines := strings.Split(string(owners), "\n") + var newLines []string for _, line := range lines { + var result string for _, name := range offboardingUsers { - fmt.Println(name) - strings.Cut(line, name) + result, _, _ = strings.Cut(line, "@"+name) } + newLines = append(newLines, result) } - output := strings.Join(lines, "\n") - file, err := os.Create(path+"/"+outputType) - + output := strings.Join(newLines, "\n") + file, err := os.Create(ownersPath) if err != nil { return fmt.Errorf("error creating %s file: %w", outputType, err) } From 1661bad61b77dc84f2e6cd4b781937afac78163d Mon Sep 17 00:00:00 2001 From: Zeu Capua Date: Wed, 25 Sep 2024 15:38:08 -0700 Subject: [PATCH 09/24] remove users by email working --- cmd/offboard/offboard.go | 2 +- cmd/offboard/output.go | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/cmd/offboard/offboard.go b/cmd/offboard/offboard.go index ccb5fac..354a03b 100644 --- a/cmd/offboard/offboard.go +++ b/cmd/offboard/offboard.go @@ -34,7 +34,7 @@ func NewConfigCommand() *cobra.Command { Long: offboardLongDesc, Args: func(_ *cobra.Command, args []string) error { if !(len(args) > 0) { - errors.New("you must provide at least one argument: the offboarding user's email/username") + return errors.New("you must provide at least one argument: the offboarding user's email/username") } opts.offboardingUsers = args diff --git a/cmd/offboard/output.go b/cmd/offboard/output.go index f076838..3563f98 100644 --- a/cmd/offboard/output.go +++ b/cmd/offboard/output.go @@ -63,11 +63,14 @@ func generateOwnersFile(path string, offboardingUsers []string) error { lines := strings.Split(string(owners), "\n") var newLines []string for _, line := range lines { - var result string + newLine := line for _, name := range offboardingUsers { - result, _, _ = strings.Cut(line, "@"+name) + result, _, found := strings.Cut(newLine, "@"+name) + if found { + newLine = result + } } - newLines = append(newLines, result) + newLines = append(newLines, newLine) } output := strings.Join(newLines, "\n") From bf119b9168ca520a894750f193d9ed4c13d9328b Mon Sep 17 00:00:00 2001 From: Zeu Capua Date: Wed, 25 Sep 2024 15:43:49 -0700 Subject: [PATCH 10/24] remove logging prints --- cmd/offboard/output.go | 2 -- 1 file changed, 2 deletions(-) diff --git a/cmd/offboard/output.go b/cmd/offboard/output.go index 3563f98..f429fa0 100644 --- a/cmd/offboard/output.go +++ b/cmd/offboard/output.go @@ -45,12 +45,10 @@ func generateOwnersFile(path string, offboardingUsers []string) error { var ownersPath string if _, err = os.Stat(filepath.Join(path, "/CODEOWNERS")); !errors.Is(err, os.ErrNotExist) { - fmt.Print("CODEOWNERS EXISTS") outputType = "CODEOWNERS" ownersPath = filepath.Join(path, "/CODEOWNERS") owners, err = os.ReadFile(ownersPath) } else if _, err = os.Stat(filepath.Join(path, "OWNERS")); !errors.Is(err, os.ErrNotExist) { - fmt.Print("OWNERS EXISTS") outputType = "OWNERS" ownersPath = filepath.Join(path, "/OWNERS") owners, err = os.ReadFile(ownersPath) From 649be323f77d84d059637151cd2a6882ad01a31f Mon Sep 17 00:00:00 2001 From: Zeu Capua Date: Wed, 25 Sep 2024 15:58:04 -0700 Subject: [PATCH 11/24] rename args param --- cmd/offboard/offboard.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/offboard/offboard.go b/cmd/offboard/offboard.go index 354a03b..625dbb7 100644 --- a/cmd/offboard/offboard.go +++ b/cmd/offboard/offboard.go @@ -41,7 +41,7 @@ func NewConfigCommand() *cobra.Command { return nil }, - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(cmd *cobra.Command, _ []string) error { opts.ttyDisabled, _ = cmd.Flags().GetBool("tty-disable") opts.configPath, _ = cmd.Flags().GetString("config") From 34aed665e5f49bc6a88c123ce63eefa310cb843f Mon Sep 17 00:00:00 2001 From: Zeu Capua Date: Wed, 25 Sep 2024 16:02:36 -0700 Subject: [PATCH 12/24] gci lint? --- cmd/offboard/offboard.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/offboard/offboard.go b/cmd/offboard/offboard.go index 625dbb7..0f1e738 100644 --- a/cmd/offboard/offboard.go +++ b/cmd/offboard/offboard.go @@ -5,9 +5,9 @@ import ( "fmt" "slices" - "github.com/open-sauced/pizza-cli/v2/pkg/config" - "github.com/spf13/cobra" + + "github.com/open-sauced/pizza-cli/v2/pkg/config" ) type Options struct { From 3fdefe42131aacd59bc2f99f539773cc6e448ba7 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 2 Oct 2024 16:57:49 -0400 Subject: [PATCH 13/24] chore: update repository codeowners (#208) --- CODEOWNERS | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/CODEOWNERS b/CODEOWNERS index 55afa11..e57e907 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -13,7 +13,7 @@ .github/workflows/test.yaml @jpmcb @zeucapua .golangci.yaml @jpmcb @zeucapua .sauced.yaml @jpmcb @nickytonline @zeucapua -CHANGELOG.md @jpmcb @nickytonline @zeucapua +CHANGELOG.md @jpmcb @zeucapua @nickytonline CODEOWNERS @jpmcb @nickytonline Dockerfile @jpmcb @nickytonline @zeucapua Makefile @jpmcb @@ -46,14 +46,14 @@ cmd/auth/success.html @jpmcb cmd/auth/success.html @jpmcb cmd/bake/bake.go @jpmcb cmd/bake/bake_test.go @jpmcb -cmd/docs/docs.go @nickytonline @jpmcb @zeucapua +cmd/docs/docs.go @jpmcb @zeucapua @nickytonline cmd/docs/docs_test.go @nickytonline @jpmcb @zeucapua cmd/generate/codeowners/codeowners.go @jpmcb @zeucapua cmd/generate/codeowners/output.go @jpmcb @zeucapua @brandonroberts cmd/generate/codeowners/output_test.go @jpmcb @brandonroberts @zeucapua cmd/generate/codeowners/spec.go @jpmcb cmd/generate/codeowners/traversal.go @jpmcb -cmd/generate/config/config.go @zeucapua @zeucapua @jpmcb +cmd/generate/config/config.go @zeucapua @jpmcb @zeucapua cmd/generate/config/output.go @zeucapua @jpmcb @zeucapua cmd/generate/config/spec.go @zeucapua @zeucapua @jpmcb cmd/generate/generate.go @jpmcb @zeucapua @@ -71,25 +71,26 @@ cmd/show/dashboard.go @jpmcb cmd/show/show.go @jpmcb cmd/show/tui.go @jpmcb cmd/version/version.go @jpmcb @nickytonline -docs/pizza.md @jpmcb @zeucapua @nickytonline +docs/pizza.md @jpmcb @nickytonline @zeucapua docs/pizza_completion.md @jpmcb @nickytonline @zeucapua -docs/pizza_completion_bash.md @jpmcb @zeucapua @nickytonline -docs/pizza_completion_fish.md @jpmcb @nickytonline @zeucapua -docs/pizza_completion_powershell.md @jpmcb @nickytonline @zeucapua +docs/pizza_completion_bash.md @jpmcb @nickytonline @zeucapua +docs/pizza_completion_fish.md @jpmcb @zeucapua @nickytonline +docs/pizza_completion_powershell.md @jpmcb @zeucapua @nickytonline docs/pizza_completion_zsh.md @jpmcb @nickytonline @zeucapua docs/pizza_generate.md @jpmcb @nickytonline @zeucapua docs/pizza_generate_codeowners.md @jpmcb docs/pizza_generate_config.md @jpmcb -docs/pizza_generate_insight.md -docs/pizza_insights.md @jpmcb @zeucapua @nickytonline -docs/pizza_insights_contributors.md @jpmcb @zeucapua @nickytonline -docs/pizza_insights_repositories.md @jpmcb @zeucapua @nickytonline +docs/pizza_generate_insight.md @jpmcb +docs/pizza_insights.md @jpmcb @nickytonline @zeucapua +docs/pizza_insights_contributors.md @jpmcb @nickytonline @zeucapua +docs/pizza_insights_repositories.md @jpmcb @nickytonline @zeucapua docs/pizza_insights_user-contributions.md @jpmcb @nickytonline @zeucapua -docs/pizza_login.md @jpmcb @nickytonline @zeucapua +docs/pizza_login.md @jpmcb @zeucapua @nickytonline docs/pizza_version.md @jpmcb @nickytonline @zeucapua go.mod @jpmcb @nickytonline @zeucapua -go.sum @jpmcb @zeucapua @zeucapua +go.sum @jpmcb @zeucapua @nickytonline justfile @jpmcb @zeucapua @nickytonline +main.go @jpmcb npm/.gitignore @jpmcb @zeucapua npm/README.md @jpmcb npm/package-lock.json @jpmcb @nickytonline @zeucapua @@ -106,5 +107,5 @@ pkg/utils/posthog.go @jpmcb @zeucapua @zeucapua pkg/utils/root.go @jpmcb @zeucapua pkg/utils/telemetry.go @jpmcb pkg/utils/version.go @nickytonline @jpmcb -scripts/generate-docs.sh @jpmcb @nickytonline +scripts/generate-docs.sh @nickytonline @jpmcb telemetry.go @jpmcb @zeucapua @zeucapua From d3684bbccc162394d6f51026854b468f45bf95a3 Mon Sep 17 00:00:00 2001 From: Zeu Capua Date: Thu, 3 Oct 2024 13:32:29 -0700 Subject: [PATCH 14/24] add posthog telemetry --- cmd/offboard/offboard.go | 19 +++++++++++++++---- pkg/utils/posthog.go | 22 ++++++++++++++++++++++ 2 files changed, 37 insertions(+), 4 deletions(-) diff --git a/cmd/offboard/offboard.go b/cmd/offboard/offboard.go index 0f1e738..9ba3275 100644 --- a/cmd/offboard/offboard.go +++ b/cmd/offboard/offboard.go @@ -8,6 +8,8 @@ import ( "github.com/spf13/cobra" "github.com/open-sauced/pizza-cli/v2/pkg/config" + "github.com/open-sauced/pizza-cli/v2/pkg/constants" + "github.com/open-sauced/pizza-cli/v2/pkg/utils" ) type Options struct { @@ -21,6 +23,9 @@ type Options struct { // from global config ttyDisabled bool + + // telemetry for capturing CLI events via PostHog + telemetry *utils.PosthogCliClient } const offboardLongDesc string = `[WIP] Removes a user from the \".sauced.yaml\" config and \"CODEOWNERS\" files. @@ -44,13 +49,15 @@ func NewConfigCommand() *cobra.Command { RunE: func(cmd *cobra.Command, _ []string) error { opts.ttyDisabled, _ = cmd.Flags().GetBool("tty-disable") opts.configPath, _ = cmd.Flags().GetString("config") + disableTelem, _ := cmd.Flags().GetBool(constants.FlagNameTelemetry) + + opts.telemetry = utils.NewPosthogCliClient(!disableTelem) opts.path, _ = cmd.Flags().GetString("path") err := run(opts) - if err != nil { - return err - } - return nil + _ = opts.telemetry.Done() + + return err }, } @@ -62,6 +69,7 @@ func run(opts *Options) error { spec, _, err := config.LoadConfig(opts.configPath) if err != nil { + _ = opts.telemetry.CaptureFailedOffboard() return fmt.Errorf("error loading config: %v", err) } @@ -89,13 +97,16 @@ func run(opts *Options) error { err = generateConfigFile(opts.configPath, attributions) if err != nil { + _ = opts.telemetry.CaptureFailedOffboard() return fmt.Errorf("error generating config file: %v", err) } err = generateOwnersFile(opts.path, offboardingNames) if err != nil { + _ = opts.telemetry.CaptureFailedOffboard() return fmt.Errorf("error generating owners file: %v", err) } + _ = opts.telemetry.CaptureOffboard() return nil } diff --git a/pkg/utils/posthog.go b/pkg/utils/posthog.go index 9a9fb41..32503d8 100644 --- a/pkg/utils/posthog.go +++ b/pkg/utils/posthog.go @@ -198,6 +198,28 @@ func (p *PosthogCliClient) CaptureFailedConfigGenerate() error { return nil } +func (p *PosthogCliClient) CaptureOffboard() error { + if p.activated { + return p.client.Enqueue(posthog.Capture{ + DistinctId: p.uniqueID, + Event: "pizza_cli_offboard", + }) + } + + return nil +} + +func (p *PosthogCliClient) CaptureFailedOffboard() error { + if p.activated { + return p.client.Enqueue(posthog.Capture{ + DistinctId: p.uniqueID, + Event: "pizza_cli_failed_to_offboard", + }) + } + + return nil +} + // CaptureInsights gathers telemetry on successful Insights command runs func (p *PosthogCliClient) CaptureInsights() error { if p.activated { From bfaf37ffb584aac34cd8246b8acf0c897af7c8cf Mon Sep 17 00:00:00 2001 From: Zeu Capua Date: Thu, 3 Oct 2024 14:36:52 -0700 Subject: [PATCH 15/24] update offboard cmd description copy --- cmd/offboard/offboard.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cmd/offboard/offboard.go b/cmd/offboard/offboard.go index 9ba3275..3b226b6 100644 --- a/cmd/offboard/offboard.go +++ b/cmd/offboard/offboard.go @@ -28,14 +28,14 @@ type Options struct { telemetry *utils.PosthogCliClient } -const offboardLongDesc string = `[WIP] Removes a user from the \".sauced.yaml\" config and \"CODEOWNERS\" files. -Requires the user's name OR email.` +const offboardLongDesc string = `CAUTION: Experimental Command. Removes users from the \".sauced.yaml\" config and \"CODEOWNERS\" files. +Requires the users' name OR email.` func NewConfigCommand() *cobra.Command { opts := &Options{} cmd := &cobra.Command{ Use: "offboard [flags]", - Short: "[WIP] Removes a user from the \".sauced.yaml\" config and \"CODEOWNERS\" files.", + Short: "CAUTION: Experimental Command. Removes users from the \".sauced.yaml\" config and \"CODEOWNERS\" files.", Long: offboardLongDesc, Args: func(_ *cobra.Command, args []string) error { if !(len(args) > 0) { From d19e8d1e9d847926491a61fbb06dd0123686b125 Mon Sep 17 00:00:00 2001 From: Zeu Capua Date: Thu, 3 Oct 2024 15:12:49 -0700 Subject: [PATCH 16/24] make --path flag required with no default, check current path for config if flag not set --- cmd/offboard/offboard.go | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/cmd/offboard/offboard.go b/cmd/offboard/offboard.go index 3b226b6..1b6c410 100644 --- a/cmd/offboard/offboard.go +++ b/cmd/offboard/offboard.go @@ -4,6 +4,7 @@ import ( "errors" "fmt" "slices" + "strings" "github.com/spf13/cobra" @@ -61,12 +62,28 @@ func NewConfigCommand() *cobra.Command { }, } - cmd.PersistentFlags().StringP("path", "p", "./", "the path to the repository") + cmd.Flags().StringP("path", "p", "", "the path to the repository") + cmd.MarkFlagRequired("path") return cmd } func run(opts *Options) error { - spec, _, err := config.LoadConfig(opts.configPath) + var spec *config.Spec + var err error + if len(opts.configPath) != 0 { + fmt.Printf("IF != 0 %s", opts.configPath) + spec, _, err = config.LoadConfig(opts.configPath) + } else { + var dir string + if (strings.Compare(string(opts.path[len(opts.path)-1]), "/") == 0) { + dir = fmt.Sprintf("%s.sauced.yaml", opts.path) + } else { + dir = fmt.Sprintf("%s/.sauced.yaml", opts.path) + } + fmt.Printf("ELSE %s", dir) + spec, _, err = config.LoadConfig(dir) + } + if err != nil { _ = opts.telemetry.CaptureFailedOffboard() @@ -95,7 +112,13 @@ func run(opts *Options) error { } } - err = generateConfigFile(opts.configPath, attributions) + + if len(opts.configPath) != 0 { + err = generateConfigFile(opts.configPath, attributions) + } else { + err = generateConfigFile(fmt.Sprintf("%s/.sauced.yaml", opts.path), attributions) + } + if err != nil { _ = opts.telemetry.CaptureFailedOffboard() return fmt.Errorf("error generating config file: %v", err) From c18ca7227e37cd276ae8a1df45c1f242fe5d1067 Mon Sep 17 00:00:00 2001 From: Zeu Capua Date: Thu, 3 Oct 2024 15:31:47 -0700 Subject: [PATCH 17/24] handle persistent flag error, gci --- cmd/offboard/offboard.go | 28 ++++++++++++++++------------ pkg/utils/posthog.go | 4 ++-- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/cmd/offboard/offboard.go b/cmd/offboard/offboard.go index 1b6c410..4e282f9 100644 --- a/cmd/offboard/offboard.go +++ b/cmd/offboard/offboard.go @@ -62,8 +62,10 @@ func NewConfigCommand() *cobra.Command { }, } - cmd.Flags().StringP("path", "p", "", "the path to the repository") - cmd.MarkFlagRequired("path") + cmd.PersistentFlags().StringP("path", "p", "", "the path to the repository (required)") + if err := cmd.MarkPersistentFlagRequired("path"); err != nil { + fmt.Printf("error MarkPersistentFlagRequired: %v", err) + } return cmd } @@ -71,20 +73,17 @@ func run(opts *Options) error { var spec *config.Spec var err error if len(opts.configPath) != 0 { - fmt.Printf("IF != 0 %s", opts.configPath) spec, _, err = config.LoadConfig(opts.configPath) } else { - var dir string - if (strings.Compare(string(opts.path[len(opts.path)-1]), "/") == 0) { - dir = fmt.Sprintf("%s.sauced.yaml", opts.path) + var configPath string + if strings.Compare(string(opts.path[len(opts.path)-1]), "/") == 0 { + configPath = opts.path + ".sauced.yaml" } else { - dir = fmt.Sprintf("%s/.sauced.yaml", opts.path) + configPath = opts.path + "/.sauced.yaml" } - fmt.Printf("ELSE %s", dir) - spec, _, err = config.LoadConfig(dir) + spec, _, err = config.LoadConfig(configPath) } - if err != nil { _ = opts.telemetry.CaptureFailedOffboard() return fmt.Errorf("error loading config: %v", err) @@ -112,11 +111,16 @@ func run(opts *Options) error { } } - if len(opts.configPath) != 0 { err = generateConfigFile(opts.configPath, attributions) } else { - err = generateConfigFile(fmt.Sprintf("%s/.sauced.yaml", opts.path), attributions) + var configPath string + if strings.Compare(string(opts.path[len(opts.path)-1]), "/") == 0 { + configPath = opts.path + ".sauced.yaml" + } else { + configPath = opts.path + "/.sauced.yaml" + } + err = generateConfigFile(configPath, attributions) } if err != nil { diff --git a/pkg/utils/posthog.go b/pkg/utils/posthog.go index 32503d8..10d66d1 100644 --- a/pkg/utils/posthog.go +++ b/pkg/utils/posthog.go @@ -202,7 +202,7 @@ func (p *PosthogCliClient) CaptureOffboard() error { if p.activated { return p.client.Enqueue(posthog.Capture{ DistinctId: p.uniqueID, - Event: "pizza_cli_offboard", + Event: "pizza_cli_offboard", }) } @@ -213,7 +213,7 @@ func (p *PosthogCliClient) CaptureFailedOffboard() error { if p.activated { return p.client.Enqueue(posthog.Capture{ DistinctId: p.uniqueID, - Event: "pizza_cli_failed_to_offboard", + Event: "pizza_cli_failed_to_offboard", }) } From 60c919a0e4e23077210592e2373368262816fc0d Mon Sep 17 00:00:00 2001 From: zeudev Date: Mon, 7 Oct 2024 09:08:31 -0700 Subject: [PATCH 18/24] Update cmd/offboard/offboard.go Co-authored-by: John McBride --- cmd/offboard/offboard.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/offboard/offboard.go b/cmd/offboard/offboard.go index 4e282f9..64c1f3c 100644 --- a/cmd/offboard/offboard.go +++ b/cmd/offboard/offboard.go @@ -39,7 +39,7 @@ func NewConfigCommand() *cobra.Command { Short: "CAUTION: Experimental Command. Removes users from the \".sauced.yaml\" config and \"CODEOWNERS\" files.", Long: offboardLongDesc, Args: func(_ *cobra.Command, args []string) error { - if !(len(args) > 0) { + if (len(args) <= 0) { return errors.New("you must provide at least one argument: the offboarding user's email/username") } From 695a6eaee2f1b871ceb73b47c2535de9cbc4a4ce Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 7 Oct 2024 11:29:38 -0500 Subject: [PATCH 19/24] chore: update repository codeowners (#210) Co-authored-by: open-sauced[bot] <63161813+open-sauced[bot]@users.noreply.github.com> --- CODEOWNERS | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/CODEOWNERS b/CODEOWNERS index e57e907..d2144a3 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -46,7 +46,7 @@ cmd/auth/success.html @jpmcb cmd/auth/success.html @jpmcb cmd/bake/bake.go @jpmcb cmd/bake/bake_test.go @jpmcb -cmd/docs/docs.go @jpmcb @zeucapua @nickytonline +cmd/docs/docs.go @nickytonline @jpmcb @zeucapua cmd/docs/docs_test.go @nickytonline @jpmcb @zeucapua cmd/generate/codeowners/codeowners.go @jpmcb @zeucapua cmd/generate/codeowners/output.go @jpmcb @zeucapua @brandonroberts @@ -73,19 +73,19 @@ cmd/show/tui.go @jpmcb cmd/version/version.go @jpmcb @nickytonline docs/pizza.md @jpmcb @nickytonline @zeucapua docs/pizza_completion.md @jpmcb @nickytonline @zeucapua -docs/pizza_completion_bash.md @jpmcb @nickytonline @zeucapua -docs/pizza_completion_fish.md @jpmcb @zeucapua @nickytonline -docs/pizza_completion_powershell.md @jpmcb @zeucapua @nickytonline +docs/pizza_completion_bash.md @jpmcb @zeucapua @nickytonline +docs/pizza_completion_fish.md @jpmcb @nickytonline @zeucapua +docs/pizza_completion_powershell.md @jpmcb @nickytonline @zeucapua docs/pizza_completion_zsh.md @jpmcb @nickytonline @zeucapua docs/pizza_generate.md @jpmcb @nickytonline @zeucapua docs/pizza_generate_codeowners.md @jpmcb docs/pizza_generate_config.md @jpmcb docs/pizza_generate_insight.md @jpmcb -docs/pizza_insights.md @jpmcb @nickytonline @zeucapua +docs/pizza_insights.md @jpmcb @zeucapua @nickytonline docs/pizza_insights_contributors.md @jpmcb @nickytonline @zeucapua -docs/pizza_insights_repositories.md @jpmcb @nickytonline @zeucapua +docs/pizza_insights_repositories.md @jpmcb @zeucapua @nickytonline docs/pizza_insights_user-contributions.md @jpmcb @nickytonline @zeucapua -docs/pizza_login.md @jpmcb @zeucapua @nickytonline +docs/pizza_login.md @jpmcb @nickytonline @zeucapua docs/pizza_version.md @jpmcb @nickytonline @zeucapua go.mod @jpmcb @nickytonline @zeucapua go.sum @jpmcb @zeucapua @nickytonline From 5a60659bdfec594f7fb24d105435870268accfb8 Mon Sep 17 00:00:00 2001 From: Zeu Capua Date: Mon, 7 Oct 2024 13:02:42 -0700 Subject: [PATCH 20/24] gci lint --- cmd/offboard/offboard.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/offboard/offboard.go b/cmd/offboard/offboard.go index 64c1f3c..feabfd8 100644 --- a/cmd/offboard/offboard.go +++ b/cmd/offboard/offboard.go @@ -39,7 +39,7 @@ func NewConfigCommand() *cobra.Command { Short: "CAUTION: Experimental Command. Removes users from the \".sauced.yaml\" config and \"CODEOWNERS\" files.", Long: offboardLongDesc, Args: func(_ *cobra.Command, args []string) error { - if (len(args) <= 0) { + if len(args) == 0 { return errors.New("you must provide at least one argument: the offboarding user's email/username") } From aa7b1a4f8b792c0be444b811ec7eb7188e377864 Mon Sep 17 00:00:00 2001 From: "open-sauced[bot]" <63161813+open-sauced[bot]@users.noreply.github.com> Date: Mon, 7 Oct 2024 20:04:49 +0000 Subject: [PATCH 21/24] chore: automated docs generation for release Co-authored-by: Zeu Capua --- docs/pizza.md | 1 + docs/pizza_offboard.md | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 docs/pizza_offboard.md diff --git a/docs/pizza.md b/docs/pizza.md index dfd6ca4..27789df 100644 --- a/docs/pizza.md +++ b/docs/pizza.md @@ -26,5 +26,6 @@ pizza [flags] * [pizza generate](pizza_generate.md) - Generates documentation and insights from your codebase * [pizza insights](pizza_insights.md) - Gather insights about git contributors, repositories, users and pull requests * [pizza login](pizza_login.md) - Log into the CLI via GitHub +* [pizza offboard](pizza_offboard.md) - CAUTION: Experimental Command. Removes users from the ".sauced.yaml" config and "CODEOWNERS" files. * [pizza version](pizza_version.md) - Displays the build version of the CLI diff --git a/docs/pizza_offboard.md b/docs/pizza_offboard.md new file mode 100644 index 0000000..82155b2 --- /dev/null +++ b/docs/pizza_offboard.md @@ -0,0 +1,33 @@ +## pizza offboard + +CAUTION: Experimental Command. Removes users from the ".sauced.yaml" config and "CODEOWNERS" files. + +### Synopsis + +CAUTION: Experimental Command. Removes users from the \".sauced.yaml\" config and \"CODEOWNERS\" files. +Requires the users' name OR email. + +``` +pizza offboard [flags] +``` + +### Options + +``` + -h, --help help for offboard + -p, --path string the path to the repository (required) +``` + +### Options inherited from parent commands + +``` + -c, --config string The codeowners config + --disable-telemetry Disable sending telemetry data to OpenSauced + -l, --log-level string The logging level. Options: error, warn, info, debug (default "info") + --tty-disable Disable log stylization. Suitable for CI/CD and automation +``` + +### SEE ALSO + +* [pizza](pizza.md) - OpenSauced CLI + From deb22a247f6aa3f1a64e1ed13f6554060e67a533 Mon Sep 17 00:00:00 2001 From: zeudev Date: Fri, 11 Oct 2024 07:38:49 -0700 Subject: [PATCH 22/24] feat: add comment preamble to generated config (#214) * add comment preamble to generated config --- cmd/generate/config/output.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cmd/generate/config/output.go b/cmd/generate/config/output.go index 2743b5a..5e7d254 100644 --- a/cmd/generate/config/output.go +++ b/cmd/generate/config/output.go @@ -15,6 +15,13 @@ func generateOutputFile(outputPath string, attributionMap map[string][]string) e } defer file.Close() + // write the header preamble + _, err = file.WriteString("# Configuration for attributing commits with emails to GitHub user profiles\n# Used during codeowners generation.\n\n# List the emails associated with the given username\n# The commits associated with these emails will be attributed to\n# the username in this yaml map. Any number of emails may be listed\n\n") + + if err != nil { + return fmt.Errorf("error writing to %s file: %w", outputPath, err) + } + var config config.Spec config.Attributions = attributionMap From e62549a16af54625d46c354e03a6db7eb667a9ee Mon Sep 17 00:00:00 2001 From: zeudev Date: Fri, 11 Oct 2024 14:39:27 +0000 Subject: [PATCH 23/24] chore(minor): release 2.2.0-beta.4 on beta channel [skip ci] MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## [2.2.0-beta.4](https://github.com/open-sauced/pizza-cli/compare/v2.2.0-beta.3...v2.2.0-beta.4) (2024-10-11) ### 🍕 Features * add comment preamble to generated config ([#214](https://github.com/open-sauced/pizza-cli/issues/214)) ([deb22a2](https://github.com/open-sauced/pizza-cli/commit/deb22a247f6aa3f1a64e1ed13f6554060e67a533)) --- CHANGELOG.md | 7 +++++++ npm/package-lock.json | 4 ++-- npm/package.json | 2 +- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2551a78..17a19ab 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,13 @@ > All notable changes to this project will be documented in this file +## [2.2.0-beta.4](https://github.com/open-sauced/pizza-cli/compare/v2.2.0-beta.3...v2.2.0-beta.4) (2024-10-11) + + +### 🍕 Features + +* add comment preamble to generated config ([#214](https://github.com/open-sauced/pizza-cli/issues/214)) ([deb22a2](https://github.com/open-sauced/pizza-cli/commit/deb22a247f6aa3f1a64e1ed13f6554060e67a533)) + ## [2.2.0-beta.3](https://github.com/open-sauced/pizza-cli/compare/v2.2.0-beta.2...v2.2.0-beta.3) (2024-09-20) diff --git a/npm/package-lock.json b/npm/package-lock.json index aac99c2..531aad3 100644 --- a/npm/package-lock.json +++ b/npm/package-lock.json @@ -1,12 +1,12 @@ { "name": "pizza", - "version": "2.2.0-beta.3", + "version": "2.2.0-beta.4", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "pizza", - "version": "2.2.0-beta.3", + "version": "2.2.0-beta.4", "hasInstallScript": true, "license": "MIT", "bin": { diff --git a/npm/package.json b/npm/package.json index 433bb2c..25bbbaf 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "pizza", - "version": "2.2.0-beta.3", + "version": "2.2.0-beta.4", "description": "A command line utility for insights, metrics, and generating CODEOWNERS documentation for your open source projects", "repository": "https://github.com/open-sauced/pizza-cli", "license": "MIT", From cfdde7e38a426ea3117b16bd74576d3e59dae0dc Mon Sep 17 00:00:00 2001 From: John McBride Date: Fri, 11 Oct 2024 14:47:00 +0000 Subject: [PATCH 24/24] chore(minor): release 2.3.0-beta.1 on beta channel [skip ci] MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## [2.3.0-beta.1](https://github.com/open-sauced/pizza-cli/compare/v2.2.0...v2.3.0-beta.1) (2024-10-11) ### 🍕 Features * add comment preamble to generated config ([#214](https://github.com/open-sauced/pizza-cli/issues/214)) ([deb22a2](https://github.com/open-sauced/pizza-cli/commit/deb22a247f6aa3f1a64e1ed13f6554060e67a533)) * Add quick start section ([#203](https://github.com/open-sauced/pizza-cli/issues/203)) ([eec884b](https://github.com/open-sauced/pizza-cli/commit/eec884b816404fdbbc5fb5445cb44fe211b8b0c8)) --- CHANGELOG.md | 8 ++++++++ npm/package-lock.json | 4 ++-- npm/package.json | 2 +- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9e67961..dfa1eef 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,14 @@ > All notable changes to this project will be documented in this file +## [2.3.0-beta.1](https://github.com/open-sauced/pizza-cli/compare/v2.2.0...v2.3.0-beta.1) (2024-10-11) + + +### 🍕 Features + +* add comment preamble to generated config ([#214](https://github.com/open-sauced/pizza-cli/issues/214)) ([deb22a2](https://github.com/open-sauced/pizza-cli/commit/deb22a247f6aa3f1a64e1ed13f6554060e67a533)) +* Add quick start section ([#203](https://github.com/open-sauced/pizza-cli/issues/203)) ([eec884b](https://github.com/open-sauced/pizza-cli/commit/eec884b816404fdbbc5fb5445cb44fe211b8b0c8)) + ## [2.2.0](https://github.com/open-sauced/pizza-cli/compare/v2.1.0...v2.2.0) (2024-09-18) diff --git a/npm/package-lock.json b/npm/package-lock.json index 12565e5..6aad955 100644 --- a/npm/package-lock.json +++ b/npm/package-lock.json @@ -1,12 +1,12 @@ { "name": "pizza", - "version": "2.2.0", + "version": "2.3.0-beta.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "pizza", - "version": "2.2.0", + "version": "2.3.0-beta.1", "hasInstallScript": true, "license": "MIT", "bin": { diff --git a/npm/package.json b/npm/package.json index 34b1c9f..876d5ea 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,6 +1,6 @@ { "name": "pizza", - "version": "2.2.0", + "version": "2.3.0-beta.1", "description": "A command line utility for insights, metrics, and generating CODEOWNERS documentation for your open source projects", "repository": "https://github.com/open-sauced/pizza-cli", "license": "MIT",