Stage original workflow files separately for authorized GitHub import
davoodmehraban89 committed
Oct 13, 2026 at 15:56 UTC
3aeb438a4211f193d87e98b27dc0b9b1f9075e19
1 file changed
+9
-5
.github/workflows/import-medusa-source.yml
+9
-5
@@ -24,9 +24,10 @@ jobs:
24
python - <<'PY'
25
from pathlib import Path
26
from zipfile import ZipFile
27
- import shutil
27
+ import shutil, json, base64
28
root=Path.cwd().resolve()
29
with ZipFile('/tmp/medusa-develop.zip') as z:
30
+ workflows = {}
31
files=[i for i in z.infolist() if not i.is_dir()]
32
assert len(files)==24261, f'Unexpected file count: {len(files)}'
33
assert z.testzip() is None
@@ -35,18 +36,21 @@ jobs:
36
assert path.parts[0]=='medusa-develop' and len(path.parts)>1
37
relative=Path(*path.parts[1:])
38
assert not relative.is_absolute() and '..' not in relative.parts
39
+ if relative.parts[:2] == ('.github', 'workflows'):
40
+ workflows[str(relative)] = base64.b64encode(z.read(info)).decode('ascii')
41
+ continue
42
dest=(root/relative).resolve()
43
assert dest.is_relative_to(root)
44
dest.parent.mkdir(parents=True,exist_ok=True)
45
with z.open(info) as src, dest.open('wb') as dst:
46
shutil.copyfileobj(src,dst)
43
- print('Extracted',len(files),'files')
47
+ (root/'medusa-workflows-import.json').write_text(json.dumps(workflows),encoding='utf-8')
48
+ print('Prepared',len(files),'files including',len(workflows),'workflow files')
49
PY
45
- - name: Commit imported source and remove temporary workflow
50
+ - name: Commit source files and stage workflow import data
51
run: |
47
- rm .github/workflows/import-medusa-source.yml
52
git config user.name "github-actions[bot]"
53
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
50
- git add -A
54
+ git add -f -A
55
git commit -m "Import original Medusa source archive without modifications"
56
git push origin HEAD:main