Skip to content

fix(sync): keep downstream-only files when syncing folders - #18

Merged
oahsiao merged 1 commit into
mainfrom
fix/sync-preserve-downstream-files
Jul 26, 2026
Merged

fix(sync): keep downstream-only files when syncing folders#18
oahsiao merged 1 commit into
mainfrom
fix/sync-preserve-downstream-files

Conversation

@oahsiao

@oahsiao oahsiao commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

What

資料夾同步從 mirror 改為 overlay:manifest 中結尾為 / 的路徑(prompts/instructions/)不再走 rsync --delete,只覆寫與中央同名的檔案。下游 repo 自己放在 .github/prompts/ 的專案專屬 prompt,只要檔名沒有跟中央重複就會被保留。

Why

已部署的下游 repo 在 .github/prompts/ 放了自己專案的 prompt file,每次自動同步都會被 rsync --delete 整批刪掉。同步應該只負責「中央有的檔案」,不該把下游自有內容視為髒資料清掉。

How

  • .github/workflows/sync-m2-common-ai-reusable.ymlrsync -av --deletersync -av,並就地註明為何刻意不加 --delete
  • 排除的替代方案:維護一份「中央曾同步過的檔案清單」以精準刪除中央已移除的檔案。可行但需在下游額外落地狀態檔並處理漂移,複雜度不成比例;先採最小改動。
  • 同步更新 .github/sync-manifest.txtREADME.md 的規則說明,避免文件與實作不一致。

Impact

  • 影響範圍:所有下游 repo 的自動同步行為(邏輯住在中央 reusable workflow,下游不需改任何檔案,下次排程自動生效)。
  • Breaking change:。依本 repo 版本規則「同步範圍調整=major」,記為 v2.0.0
    • 行為放寬,對既有檔案只增不減,下游無需遷移動作。
    • 但中央刪除或更名某個 prompt 時,下游的舊檔不會自動消失,需下游自行清理 —— 已寫入 CHANGELOG 與 README 注意事項。

Verification

  • python scripts/validate.py 通過(4 個 prompt file,0 警告)
  • 逐行檢視 diff,確認僅動到同步行為與對應說明文字,無夾帶其他變更
  • YAML 解析檢查:本機未安裝 PyYAML,未在本地執行,交由 CI 的 Validate sync workflows are parseable 驗證
  • 實際同步結果:需合併後由下游 repo 的下一次排程同步 PR 確認自有 prompt 未被刪除
  • CI passed

Folder paths in the manifest used rsync --delete, mirroring the central repo and deleting any prompt a downstream repo had added under .github/prompts/. Drop --delete so only same-named files are overwritten and downstream-only files survive. Trade-off: central deletions no longer propagate.
@oahsiao oahsiao added the documentation Improvements or additions to documentation label Jul 26, 2026
@oahsiao oahsiao self-assigned this Jul 26, 2026
@oahsiao
oahsiao merged commit 06f334a into main Jul 26, 2026
1 check passed
@oahsiao
oahsiao deleted the fix/sync-preserve-downstream-files branch July 26, 2026 04:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant