Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
b7e9be8
feat(copier): workflow config
cbullinger Nov 14, 2025
08f2722
fix: update test calls to AddFilesToTargetRepoBranch after signature …
cbullinger Nov 14, 2025
ce7210c
refactor: rename env vars to clarify they're for config repo
cbullinger Nov 17, 2025
f96e330
Fix pagination and PR body template rendering in workflow processor
cbullinger Nov 17, 2025
8fbb822
docs(copier): delete unneeded docs
cbullinger Nov 17, 2025
98bbe96
Remove all legacy code and backward compatibility support
cbullinger Nov 19, 2025
6bc12af
feat: add enabled field to workflow config references
cbullinger Nov 19, 2025
bdecb6e
feat: add source context inference for workflows in repo configs
cbullinger Nov 19, 2025
1481176
docs: update env.yaml files with latest main config features
cbullinger Nov 19, 2025
c2bb796
docs: clarify syntax is a future enhancement in example files
cbullinger Nov 19, 2025
ce84854
feat: implement full support for workflow components
cbullinger Nov 19, 2025
ca167f4
docs: update example files for .copier/workflows/config.yaml structure
cbullinger Nov 19, 2025
b8aa4f1
feat: make config loader resilient to missing workflow configs
cbullinger Nov 19, 2025
b1c82cf
docs: update documentation to reflect main config system and current …
cbullinger Nov 19, 2025
dcfd714
docs: update CLI tool documentation for current config system
cbullinger Nov 19, 2025
6bb4fdf
refactor: remove all legacy/backward compatibility code and docs
cbullinger Nov 19, 2025
c62d3e4
docs(copier): remove legacy rules references from example configs
cbullinger Nov 19, 2025
6bebbdb
fix: remove references to deleted GetConfigTemplates function
cbullinger Nov 19, 2025
955c578
fix: add missing INSTALLATION_ID to example env files
cbullinger Nov 19, 2025
6428789
docs(copier): apply Dachary feedback to READMEs
cbullinger Nov 20, 2025
9f882f9
chore(copier): update go.mod versions
cbullinger Nov 20, 2025
d5af4a0
chore(copier): update main config file
cbullinger Nov 20, 2025
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
6 changes: 3 additions & 3 deletions .copier/workflows/main.yaml → .copier/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ workflow_configs:
- source: "repo"
repo: "mongodb/docs-sample-apps"
branch: "main" # optional, defaults to main
path: ".copier/workflows.yaml"
path: ".copier/config.yaml"
enabled: true

# --------------------------------------------------------------------------
Expand All @@ -38,7 +38,7 @@ workflow_configs:
- source: "repo"
repo: "10gen/docs-mongodb-internal"
branch: "main"
path: ".copier/workflows.yaml"
path: ".copier/config.yaml"
enabled: true

# --------------------------------------------------------------------------
Expand All @@ -47,7 +47,7 @@ workflow_configs:
- source: "repo"
repo: "mongodb/docs-code-examples"
branch: "main"
path: ".copier/workflows.yaml"
path: ".copier/config.yaml"
enabled: false

# --------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion examples-copier/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Build stage
FROM golang:1.23.4-alpine AS builder
FROM golang:1.24.0-alpine AS builder

# Install build dependencies
RUN apk add --no-cache git ca-certificates
Expand Down
168 changes: 81 additions & 87 deletions examples-copier/QUICK-REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,37 +42,43 @@

## Configuration Patterns

### Prefix Pattern
### Move Transformation
```yaml
source_pattern:
type: "prefix"
pattern: "examples/go/"
transformations:
- move:
from: "examples/go"
to: "code/go"
```

### Glob Pattern
### Glob Transformation
```yaml
source_pattern:
type: "glob"
pattern: "examples/*/main.go"
transformations:
- glob:
pattern: "examples/*/main.go"
transform: "code/${relative_path}"
```

### Regex Pattern
### Regex Transformation
```yaml
source_pattern:
type: "regex"
pattern: "^examples/(?P<lang>[^/]+)/(?P<file>.+)$"
transformations:
- regex:
pattern: "^examples/(?P<lang>[^/]+)/(?P<file>.+)$"
transform: "code/${lang}/${file}"
```

### Pattern with Exclusions
### Workflow with Exclusions
```yaml
source_pattern:
type: "prefix"
pattern: "examples/"
exclude_patterns:
- "\.gitignore$"
- "node_modules/"
- "\.env$"
- "/dist/"
workflows:
- name: "Copy examples"
transformations:
- move:
from: "examples"
to: "code"
exclude:
- "**/.gitignore"
- "**/node_modules/**"
- "**/.env"
- "**/dist/**"
```

## Path Transformations
Expand Down Expand Up @@ -118,36 +124,22 @@ commit_strategy:
auto_merge: true
```

### Batch PRs by Repository
```yaml
batch_by_repo: true

batch_pr_config:
pr_title: "Update from ${source_repo}"
pr_body: |
🤖 Automated update
Files: ${file_count}
use_pr_template: true
commit_message: "Update from ${source_repo} PR #${pr_number}"
```

## Advanced Features

### Exclude Patterns
Exclude unwanted files from being copied:
Exclude unwanted files from being copied at the workflow level:

```yaml
source_pattern:
type: "prefix"
pattern: "examples/"
exclude_patterns:
- "\.gitignore$" # Exclude .gitignore
- "node_modules/" # Exclude dependencies
- "\.env$" # Exclude .env files
- "\.env\\..*$" # Exclude .env.local, .env.production, etc.
- "/dist/" # Exclude build output
- "/build/" # Exclude build artifacts
- "\.test\.(js|ts)$" # Exclude test files
workflows:
- name: "Copy examples"
exclude:
- "**/.gitignore" # Exclude .gitignore
- "**/node_modules/**" # Exclude dependencies
- "**/.env" # Exclude .env files
- "**/.env.*" # Exclude .env.local, .env.production, etc.
- "**/dist/**" # Exclude build output
- "**/build/**" # Exclude build artifacts
- "**/*.test.js" # Exclude test files
```

### PR Template Integration
Expand All @@ -167,20 +159,6 @@ commit_strategy:
2. Separator (`---`)
3. Your configured content (automation info)

### Batch Configuration
When `batch_by_repo: true`, use `batch_pr_config` for accurate file counts:

```yaml
batch_by_repo: true

batch_pr_config:
pr_title: "Update from ${source_repo}"
pr_body: |
Files: ${file_count} # Accurate count across all rules
Source: ${source_repo} PR #${pr_number}
use_pr_template: true
```

## Message Templates

### Available Variables
Expand Down Expand Up @@ -385,44 +363,60 @@ go build -o test-webhook ./cmd/test-webhook

### Copy All Go Files
```yaml
source_pattern:
type: "regex"
pattern: "^examples/.*\\.go$"
targets:
- repo: "org/docs"
path_transform: "code/${path}"
workflows:
- name: "Copy Go files"
source:
repo: "org/source"
branch: "main"
destination:
repo: "org/docs"
branch: "main"
transformations:
- regex:
pattern: "^examples/.*\\.go$"
transform: "code/${path}"
```

### Organize by Language
```yaml
source_pattern:
type: "regex"
pattern: "^examples/(?P<lang>[^/]+)/(?P<rest>.+)$"
targets:
- repo: "org/docs"
path_transform: "languages/${lang}/${rest}"
workflows:
- name: "Organize by language"
transformations:
- regex:
pattern: "^examples/(?P<lang>[^/]+)/(?P<rest>.+)$"
transform: "languages/${lang}/${rest}"
```

### Multiple Targets with Different Transforms
### Multiple Workflows for Different Destinations
```yaml
source_pattern:
type: "prefix"
pattern: "examples/"
targets:
- repo: "org/docs-v1"
path_transform: "examples/${path}"
- repo: "org/docs-v2"
path_transform: "code-samples/${path}"
workflows:
- name: "Copy to docs-v1"
destination:
repo: "org/docs-v1"
branch: "main"
transformations:
- move:
from: "examples"
to: "examples"

- name: "Copy to docs-v2"
destination:
repo: "org/docs-v2"
branch: "main"
transformations:
- move:
from: "examples"
to: "code-samples"
```

### Conditional Copying (by file type)
```yaml
source_pattern:
type: "regex"
pattern: "^examples/.*\\.(?P<ext>go|py|js)$"
targets:
- repo: "org/docs"
path_transform: "code/${ext}/${filename}"
workflows:
- name: "Copy by file type"
transformations:
- regex:
pattern: "^examples/.*\\.(?P<ext>go|py|js)$"
transform: "code/${ext}/${filename}"
```

## Troubleshooting
Expand Down
Loading