You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -114,7 +114,7 @@ The repository ships the sync workflow template used by generated package reposi
114
114
115
115
The generated `source-sync` workflow stays thin: it checks out this repository as the generator logic, reads the consumer repo's `.msra` source tree, generates the artifact into a staging tree, syncs the generated tree into `main`, validates the result, and pushes the commit so the target repo's `publish.yml` can run on `push` to `main`.
116
116
117
-
If a project defines `[app.sync].preserved_target_paths` in its MSRA source, the generated sync step preserves those repo-specific runtime artifacts. For the FixPrice layout that means `tests/__snapshots__` stays in `main` and is not rewritten by the generator.
117
+
If a project defines `[app.sync]` in its MSRA source, the generated sync step can preserve repo-specific runtime artifacts and ignore generated noise. For the FixPrice layout that means `tests/__snapshots__` stays in `main`, while `**/__pycache__` and `**/*.pyc` are removed before commit.
118
118
119
119
Before validation, the generated workflow installs the target project's `requirements-dev.txt` so the validation step runs with the generated dependencies available.
Copy file name to clipboardExpand all lines: docs/msra-repo-b-sync.md
+22-1Lines changed: 22 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,7 +8,7 @@
8
8
- этот workflow запускается вручную через `workflow_dispatch`
9
9
- внутри job он сам checkout-ит repo с логикой генератора
10
10
- затем читает `repo B/source`, генерирует артефакт и пушит его в `repo B/main`
11
-
- при синке сохраняет repo-specific runtime artifacts, перечисленные в `[app.sync].preserved_target_paths` source-MSTRA, например `tests/__snapshots__`
11
+
- при синке сохраняет repo-specific runtime artifacts, перечисленные в `[app.sync].preserved_target_paths`, и удаляет generated noise из `[app.sync].ignored_generated_patterns`
12
12
- после `push` в `main` автоматически стартует `publish.yml`
13
13
14
14
## Почему workflow должен лежать в `main`
@@ -109,13 +109,31 @@ jobs:
109
109
- name: Replace target tree contents
110
110
run: |
111
111
python - <<'PY'
112
+
from fnmatch import fnmatch
112
113
from pathlib import Path
113
114
import shutil
114
115
115
116
target = Path("target")
116
117
generated = Path("generated")
117
118
preserved_root = Path("preserved")
118
119
preserve_paths = ["tests/__snapshots__"]
120
+
ignored_patterns = ["**/__pycache__", "**/*.pyc"]
121
+
122
+
def is_ignored(relative_path: Path) -> bool:
123
+
relative_text = relative_path.as_posix()
124
+
return any(fnmatch(relative_text, pattern) for pattern in ignored_patterns)
125
+
126
+
def remove_ignored(root: Path) -> None:
127
+
ignored_paths = sorted(
128
+
[path for path in root.rglob("*") if is_ignored(path.relative_to(root))],
0 commit comments