feat: add bidirectional sync workflow - #14
Conversation
6c12aaf to
3e5fecd
Compare
Adds workflow to sync changes between ExaDev and adpeak repos. Rebases on push; creates PR for manual conflict resolution.
3e5fecd to
743ff7c
Compare
Adds workflow to sync changes between ExaDev and adpeak repos. Rebases on push; creates PR for manual conflict resolution.
|
Previous review superseded by force push. Reviewing current changes. |
Git commit --amend doesn't always trigger pre-commit hooks. Add post-rewrite hook that runs lint-staged after amends/rebases to catch formatting issues that would otherwise slip through.
0c1251a to
c8654ed
Compare
There was a problem hiding this comment.
Mixed changes with one critical issue that must be fixed.
Security fix (good): Environment variables prevent secret leakage in logs.
Husky hook (good): Post-rewrite hook correctly catches lint issues on amends since pre-commit doesn't run on git commit --amend.
Critical bug: The -o ci.skip flag doesn't exist. Without loop prevention, this creates infinite workflow triggers between repos.
| # Rebase successful - push directly to main | ||
| git push target HEAD:main | ||
| # Rebase successful - push with ci.skip to prevent triggering workflow loop | ||
| git push target HEAD:main -o ci.skip |
There was a problem hiding this comment.
The -o ci.skip push option doesn't exist in GitHub. To skip workflow triggers, include [skip ci], [ci skip], [no ci], [skip actions], or [actions skip] in commit messages instead.
However, you can't modify commit messages during git rebase of others' commits. This workflow will create an infinite loop: ExaDev pushes → triggers adpeak workflow → adpeak pushes → triggers ExaDev workflow.
You need loop prevention. Options:
- Check commit messages for a sync marker (e.g., skip if any commit contains
[sync from) - Check if commits were authored by
github-actions[bot] - Use a repository variable or separate sync token to detect sync commits
| git push target HEAD:main -o ci.skip | |
| # Rebase successful - push directly to main | |
| git push target HEAD:main |
|
|
||
| - name: Verify required configuration | ||
| env: | ||
| SYNC_PRIVATE_KEY: ${{ secrets.SYNC_PRIVATE_KEY }} |
There was a problem hiding this comment.
Good security fix. Moving secrets into environment variables prevents them from appearing in logs if the script encounters errors that echo the command.
| #!/bin/sh | ||
| # Run lint-staged after git commit --amend or rebase | ||
| # This catches formatting issues that pre-commit missed | ||
| npx lint-staged |
There was a problem hiding this comment.
Correct solution. The pre-commit hook does not run on git commit --amend, so formatting issues can slip through. The post-rewrite hook runs after amends and rebases, catching these issues.
One consideration: this will run lint-staged after every rewritten commit during an interactive rebase, which could slow down multi-commit rebases. This is standard behavior and acceptable.
Improves workflow security, adds markdown formatting consistency, and fixes git hook coverage:
git commit --amend(pre-commit doesn't run on amends)-o ci.skipflag that needs removal (GitHub doesn't support this push option)Note: The
-o ci.skipapproach won't work and creates an infinite loop risk. Needs loop prevention mechanism.