From 92ffddbc0af09ea00786137cc8fd44e21f8ca073 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Sun, 2 Nov 2025 15:42:05 +0000 Subject: [PATCH 1/2] feat: Add `collect github repos` command and update docs This commit introduces a new `collect github repos` command to the CLI. This command allows users to fetch all public repositories for a given user or organization. Key changes: - Added a new command file `cmd/collect_github_repos.go`. - Updated the documentation in `docs/index.md` to include the new command and the `collect github release` command. --- .github/workflows/mkdocs.yml | 17 +++++++++++++++++ cmd/collect_github_repos.go | 28 ++++++++++++++++++++++++++++ docs/{README.md => index.md} | 24 ++++++++++++++++++++++++ mkdocs.yml | 4 ++++ 4 files changed, 73 insertions(+) create mode 100644 .github/workflows/mkdocs.yml create mode 100644 cmd/collect_github_repos.go rename docs/{README.md => index.md} (84%) create mode 100644 mkdocs.yml diff --git a/.github/workflows/mkdocs.yml b/.github/workflows/mkdocs.yml new file mode 100644 index 0000000..9c24e0c --- /dev/null +++ b/.github/workflows/mkdocs.yml @@ -0,0 +1,17 @@ +name: mkdocs +on: + push: + branches: + - main +jobs: + deploy: + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: '3.11' + - run: pip install mkdocs-material + - run: mkdocs gh-deploy --force diff --git a/cmd/collect_github_repos.go b/cmd/collect_github_repos.go new file mode 100644 index 0000000..d6cf5af --- /dev/null +++ b/cmd/collect_github_repos.go @@ -0,0 +1,28 @@ +package cmd + +import ( + "fmt" + + "github.com/Snider/Borg/pkg/github" + "github.com/spf13/cobra" +) + +var collectGithubReposCmd = &cobra.Command{ + Use: "repos [user-or-org]", + Short: "Collects all public repositories for a user or organization", + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) error { + repos, err := github.GetPublicRepos(cmd.Context(), args[0]) + if err != nil { + return err + } + for _, repo := range repos { + fmt.Println(repo) + } + return nil + }, +} + +func init() { + collectGithubCmd.AddCommand(collectGithubReposCmd) +} diff --git a/docs/README.md b/docs/index.md similarity index 84% rename from docs/README.md rename to docs/index.md index 4151a29..8ec50b0 100644 --- a/docs/README.md +++ b/docs/index.md @@ -27,6 +27,30 @@ borg collect github repo [repository-url] [flags] ./borg collect github repo https://github.com/Snider/Borg --output borg.dat ``` +#### `collect github release` + +Download the latest release of a file from GitHub releases. If the file or URL has a version number, it will check for a higher version and download it if found. + +**Usage:** +``` +borg-data-collector collect github release [repository-url] [flags] +``` + +**Flags:** +- `--file string`: The file to download from the release +- `--output string`: Output directory for the downloaded file (default ".") +- `--pack`: Pack all assets into a DataNode +- `--version string`: The version to check against + +#### `collect github repos` + +Collects all public repositories for a user or organization + +**Usage:** +``` +borg-data-collector collect github repos [user-or-org] [flags] +``` + #### `collect website` Collects a single website and stores it in a DataNode. diff --git a/mkdocs.yml b/mkdocs.yml new file mode 100644 index 0000000..b22daf7 --- /dev/null +++ b/mkdocs.yml @@ -0,0 +1,4 @@ +site_name: Borg Data Collector +repo_url: https://github.com/Snider/Borg +theme: + name: material From f27bb14d959fd735b1ef57125cfe9d67533298bf Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Sun, 2 Nov 2025 15:59:24 +0000 Subject: [PATCH 2/2] feat: Add MkDocs site, new CLI command, and documentation This commit consolidates several features into a single, cohesive change set. Key features: - **MkDocs Website:** Introduces a new documentation website built with MkDocs and the Material theme. The source is located in the `docs/` directory. - **GitHub Pages Deployment:** Adds a GitHub Actions workflow (`.github/workflows/mkdocs.yml`) to automatically build and deploy the website to GitHub Pages on every push to the `main` branch. - **New CLI Command:** Implements the `collect github repos` command, which allows users to fetch all public repositories for a given user or organization. - **Documentation Updates:** The `docs/index.md` file has been updated to include documentation for the new `collect github repos` command, as well as the existing `collect github release` command.