feat: add bidirectional sync workflow - #13
Conversation
dfa7342 to
efb5de4
Compare
There was a problem hiding this comment.
The workflow addresses previous feedback on configuration validation and portability, but introduces a critical infinite loop issue. When a successful rebase pushes to the target repo's main branch, that push triggers the target's sync workflow, which then syncs back, creating a ping-pong loop.
The loop detection on line 34 checks for [sync from in commit messages, but no such marker is added during the push on line 97. This must be fixed before merging.
Additionally, the cleanup step condition is incomplete and will fail when referencing an undefined token output.
| - name: Check if already a sync commit | ||
| id: check | ||
| run: | | ||
| if git log --format="%s" -1 | grep -q "\[sync from"; then |
There was a problem hiding this comment.
The loop detection only checks the most recent commit message. If someone manually pushes multiple commits where only an earlier one has the marker, this will still trigger a sync and potentially create a loop.
A safer approach: check the entire range of new commits since the last sync, or use a more robust marker like a git note or workflow run ID.
|
|
||
| if git rebase target/main 2>/dev/null; then | ||
| # Rebase successful - push directly to main | ||
| git push target HEAD:main |
There was a problem hiding this comment.
After a successful rebase and push, there's no commit message marker added to prevent loops. When the push to target triggers its own sync workflow, it will attempt to sync back, creating an infinite loop despite the check on line 34.
The workflow needs to either:
- Add a
[sync from SOURCE]marker in the commit message when pushing - Use a different mechanism to prevent bidirectional ping-pong
| echo "::notice::Created PR for conflict resolution" | ||
|
|
||
| - name: Cleanup old sync branches | ||
| if: steps.sync.outputs.skip != 'true' |
There was a problem hiding this comment.
The cleanup step condition only checks steps.sync.outputs.skip but also needs steps.check.outputs.skip because it references steps.token.outputs.token which is only generated when we don't skip early.
If we skip at line 34, the token step (line 53-59) never runs, so steps.token.outputs.token will be empty, causing the cleanup to fail.
| if: steps.sync.outputs.skip != 'true' | |
| - name: Cleanup old sync branches | |
| if: steps.check.outputs.skip != 'true' && steps.sync.outputs.skip != 'true' |
efb5de4 to
e72a494
Compare
|
Re-verified after recent force pushes. The critical infinite loop issue (no marker added at line 98) and incomplete cleanup condition (line 153) still need to be addressed before this can merge. |
Adds workflow to sync changes between ExaDev and adpeak repos. Rebases on push; creates PR for manual conflict resolution.
e72a494 to
1e4b04d
Compare
|
🎉 This PR is included in version 1.0.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
Adds automated bidirectional sync between ExaDev and adpeak forks. On push to main, the workflow attempts to rebase and sync changes to the other repo. If conflicts occur, it creates a PR for manual resolution and cleans up stale sync branches older than 7 days.
Required configuration:
SYNC_PRIVATE_KEY— GitHub App private key for authenticationEXADEV_APP_IDandADPEAK_APP_ID— GitHub App IDs for each org