Skip to content
This repository has been archived by the owner on Jul 2, 2024. It is now read-only.

Commit

Permalink
Update git-commit.py
Browse files Browse the repository at this point in the history
  • Loading branch information
SanmerDev committed Jun 22, 2024
1 parent 0886649 commit 945886a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 9 deletions.
1 change: 0 additions & 1 deletion .github/workflows/core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ jobs:
- name: Sync
run: |
mrepo update --ssh-key='${{ secrets.SSH_PRIVATE_KEY }}'
mrepo upgrade --pretty
- name: Push
run: |
Expand Down
24 changes: 16 additions & 8 deletions scripts/git-commit.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/env python3

import json
import shutil
import subprocess
from argparse import ArgumentParser
from datetime import datetime, UTC
Expand All @@ -20,17 +21,22 @@ def __init__(self, working_dir: Path):

self._modules_json = self._json_dir.joinpath(MODULES_JSON)

def add_all(self):
self.add(f"{JSON_DIR}/{MODULES_JSON}")
def remove(self):
for module_dir in sorted(self._modules_dir.glob("[!.]*/")):
if self.skip_it(module_dir):
continue
else:
self.add(f"{MODULES_DIR}/{module_dir.name}")
print(f"remove: {module_dir.name}")
shutil.rmtree(module_dir, ignore_errors=True)

def add(self, path: str):
def upgrade(self):
subprocess.run(
args=["git", "add", path],
args=["mrepo", "upgrade", "--pretty"],
check=True,
cwd=self._cwd_dir
)

def add(self):
subprocess.run(
args=["git", "add", '--all'],
check=True,
cwd=self._cwd_dir
)
Expand Down Expand Up @@ -84,7 +90,9 @@ def exec(cls):
working_dir = Path(args.working_dir)

git = Git(working_dir)
git.add_all()
git.remove()
git.upgrade()
git.add()
git.commit()


Expand Down

0 comments on commit 945886a

Please sign in to comment.