fix(action): allow forward sync from trailer commits
This commit is contained in:
@@ -17,7 +17,7 @@ Bidirectional sync creates an infinite loop risk: forward sync pushes commit A t
|
||||
|
||||
## Decision
|
||||
|
||||
All bot commits include a git trailer with a configurable key (default: `Josh-Sync-Origin`). Both sync directions filter out commits containing this trailer.
|
||||
All bot commits include a git trailer with a configurable key (default: `Josh-Sync-Origin`). Reverse sync filters out commits containing this trailer so bot-generated forward-sync commits are not proposed back to the monorepo.
|
||||
|
||||
### Format
|
||||
|
||||
@@ -32,7 +32,7 @@ The trailer value encodes: direction, branch, and timestamp. This aids debugging
|
||||
### Filtering
|
||||
|
||||
- **Reverse sync**: `git log --invert-grep --grep="^${BOT_TRAILER}:"` excludes all commits with the trailer
|
||||
- **CI loop guard**: The composite action checks if HEAD commit has the trailer before running sync at all
|
||||
- **Forward sync**: the composite action still runs even when HEAD has the trailer; forward sync uses tree comparison, sync state, and merge checks to decide whether to push
|
||||
|
||||
### Configuration
|
||||
|
||||
@@ -44,7 +44,7 @@ The trailer key is set in `.josh-sync.yml` under `bot.trailer`. This allows mult
|
||||
- Reliable loop prevention — trailer is part of the immutable commit object
|
||||
- Configurable key avoids conflicts between multiple sync bots
|
||||
- Human-readable — `git log` shows the trailer in commit messages
|
||||
- CI loop guard prevents unnecessary sync runs entirely
|
||||
- Repositories can act as middle hops, receiving a sync commit from one relationship and forwarding relevant changes to another
|
||||
|
||||
**Negative:**
|
||||
- Commits with manually-added trailers matching the key would be incorrectly filtered
|
||||
|
||||
Reference in New Issue
Block a user