summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2025-07-09 12:40:16 +0300
committerPaul Buetow <paul@buetow.org>2025-07-09 12:40:16 +0300
commit9d171e6b30a589240a16d8fef15e2195189e52a9 (patch)
tree98ce1931081f12a7f14d181e3cd6f5f4026d1920
parent13a0cd1055b34a93e06b429ca75492ceb8ca1434 (diff)
docs: add documentation for --batch-run featurev0.5.0
- Document the --batch-run flag in usage section - Add to features list - Include detailed example workflow for cron automation - Explain weekly timer and state file behavior 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
-rw-r--r--README.md32
1 files changed, 32 insertions, 0 deletions
diff --git a/README.md b/README.md
index 791c132..1f5d6d0 100644
--- a/README.md
+++ b/README.md
@@ -27,6 +27,7 @@ GitSyncer is a tool for synchronizing git repositories between multiple organiza
- GitHub token validation tool
- Opt-in backup mode with --backup flag for resilient offline backups
- AI-powered project showcase generation for documentation
+- Weekly batch run mode with --batch-run for automated synchronization
## Installation
@@ -111,6 +112,16 @@ Create a `gitsyncer.json` file:
./gitsyncer --full --dry-run
```
+### Automated weekly batch run
+```bash
+# Run full sync with showcase generation, but only once per week
+# This enables --full and --showcase with a weekly timer
+./gitsyncer --batch-run
+
+# The batch run state is saved to {workDir}/.gitsyncer-state.json
+# Subsequent runs within 7 days will be skipped
+```
+
### List configured organizations
```bash
./gitsyncer --list-orgs
@@ -296,6 +307,27 @@ Projects can be excluded from the showcase by creating a `.nosync` file in their
## Example Workflows
+### Automated weekly synchronization
+The `--batch-run` feature is designed for automated weekly synchronization from cron jobs or shell scripts:
+
+1. Add to your crontab or shell profile:
+ ```bash
+ # Run daily - gitsyncer will only execute once per week
+ 0 2 * * * /path/to/gitsyncer --batch-run
+ ```
+
+2. On each run, GitSyncer will:
+ - Check if a week has passed since the last batch run
+ - If yes: Execute full sync (--full) and showcase generation (--showcase)
+ - If no: Skip execution and show when the last run occurred
+ - Save the timestamp to `.gitsyncer-state.json` in your work directory
+
+3. Benefits:
+ - Prevents excessive API usage
+ - Can be safely called daily/hourly without worry
+ - Maintains weekly sync cadence automatically
+ - Shows state file location for debugging
+
### Sync specific repositories
1. Create repositories on all platforms (GitHub, Codeberg, etc.)
2. Add the repository name to your `gitsyncer.json`