Skip to content
Merged
Show file tree
Hide file tree
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
1 change: 0 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ docs/

# Build artifacts
target/
Cargo.lock

# Local configs and data
config.yaml
Expand Down
53 changes: 26 additions & 27 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,42 +1,41 @@
# Build stage
FROM rust:1.88-alpine3.22 as builder
FROM rust:1.90-alpine3.22 AS builder

WORKDIR /app

# Install dependencies
RUN apt-get update && apt-get install -y \
pkg-config \
libssl-dev \
# Install build dependencies for Alpine
RUN apk add --no-cache \
musl-dev \
pkgconfig \
openssl-dev \
openssl-libs-static \
git \
&& rm -rf /var/lib/apt/lists/*
gcc

# Copy source code
COPY . .
# Copy dependency files first for better caching
COPY Cargo.toml Cargo.lock ./

# Build the application
RUN cargo build --release
# Create dummy source to build dependencies
RUN mkdir src && echo "fn main() {}" > src/main.rs && \
cargo build --release && \
rm -rf src

# Runtime stage
FROM debian:12.8-slim
# Copy actual source code
COPY src ./src

# Install runtime dependencies
RUN apt-get update && apt-get install -y \
git \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*

# Create a non-root user
RUN useradd -r -s /bin/false repos
# Build the application with optimizations (already musl in Alpine)
RUN cargo build --release && \
strip target/release/repos

# Copy the binary from builder stage
COPY --from=builder /app/target/release/repos /usr/local/bin/repos
# Runtime stage - use scratch for minimal size
FROM scratch

# Set the user
USER repos
# Copy CA certificates for HTTPS
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/

# Set the working directory
WORKDIR /workspace
# Copy the statically linked binary
COPY --from=builder /app/target/release/repos /repos

# Set the entrypoint
ENTRYPOINT ["repos"]
ENTRYPOINT ["/repos"]
CMD ["--help"]
78 changes: 62 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,19 @@ Repos is a CLI tool to manage multiple GitHub repositories - clone them, run
commands across all repositories, create pull requests, and more—all with
colored output and comprehensive logging.

## Table of contents

- [Features](#features)
- [Installation](#installation)
- [Configuration](#configuration)
- [Usage](#usage)
- [Repository management](#repository-management)
- [Running commands](#running-commands)
- [Creating Pull Requests](#creating-pull-requests)
- [Docker image](#docker-image)
- [Contributing](#contributing)
- [License](#license)

## Features

- **Multi-repository management**: Clone and manage multiple repositories from a
Expand All @@ -20,7 +33,7 @@ repositories

## Installation

### From Source
### From source

```bash
git clone https://github.com/codcod/repos.git
Expand Down Expand Up @@ -77,7 +90,7 @@ git clone http://github.com/example/project2.git
repos init
```

## Typical Session
## Typical session

Once you have a configuration file in place, an example session can look like the following:

Expand All @@ -100,7 +113,7 @@ repos pr --title "Update dependencies" --body "Update Cargo.lock files"

## Usage

### Repository Management
### Repository management

To configure, clone and remove repositories:

Expand Down Expand Up @@ -136,7 +149,7 @@ repos rm -t rust
repos rm -p
```

### Running Commands
### Running commands

To run arbitrary commands in repositories:

Expand All @@ -154,7 +167,7 @@ repos run -p "cargo test"
repos run -l custom/logs "make build"
```

#### Example Commands
#### Example commands

Example commands to run with `repos run ""`:

Expand All @@ -180,25 +193,38 @@ git log --all --author='$(id -un)' --since='1 month ago' --pretty=format:'%h %an

### Creating Pull Requests

To submit changes made in the cloned repositories:
Set GITHUB_TOKEN in the environment (or pass via `--token`), then:

```bash
export GITHUB_TOKEN=your_github_token
# Basic: create PRs for repos with changes
export GITHUB_TOKEN=your_token
repos pr --title "Update deps" --body "Update Cargo.lock files"

# Create PRs for repositories with changes
repos pr --title "My changes" --body "Description of changes"
# Use a specific branch name and base branch
repos pr --branch feature/foo --base develop --title "My change"

# Create PRs with specific branch name
repos pr --branch feature/my-changes --title "My changes"
# Commit message override and make draft PRs
repos pr --commit-msg "chore: update deps" --draft

# Create draft pull requests
repos pr --draft
# Only create PR (don't push/commit) — useful for dry-run workflows
repos pr --create-only

# Create PRs for specific repositories
repos pr -t backend
# Filter repositories and run in parallel
repos pr -t backend -p --title "Backend changes"
```

## Command Reference
Available PR options (CLI flags)

- --title TITLE (required for PR creation)
- --body BODY
- --branch / --branch-name NAME (optional)
- --base BRANCH (optional; defaults to repo default branch — will detect it)
- --commit-msg MSG (optional)
- --draft (optional)
- --create-only (optional)
- --token TOKEN (optional; otherwise uses GITHUB_TOKEN env var)

## Command reference

```text
A tool to manage multiple GitHub repositories
Expand Down Expand Up @@ -233,6 +259,26 @@ Options:
- `walkdir` - Directory traversal
- `uuid` - Unique ID generation

## Docker image

Quick usage:

```bash
# build image (from repo root)
docker build -t repos:latest .

# run help
docker run --rm repos:latest

# run PR command (ensure token passed)
docker run --rm
-e GITHUB_TOKEN="$GITHUB_TOKEN" \
repos:latest pr --title "fix: update config" --body "Detailed description"
```

Tip: mount host workspace if operations need local files:
`docker run --rm -v "$(pwd):/work" -w /work -e GITHUB_TOKEN="$GITHUB_TOKEN" repos:latest run "ls -la"`

## Contributing

1. Fork the repository
Expand Down