Open Biswa96 opened 1 year ago
I use a python script to shallow clone the git submodules manually. I wonder if it is possible to use GitHub Actions for that.
:warning: Seek medical advice after seeing the python code.
What I can not do yet
What I can try to do but need some guidance
The plan
git diff --exit-code vendor
Please share your ideas and thoughts about this.
I use a python script to shallow clone the git submodules manually. I wonder if it is possible to use GitHub Actions for that.
Click here to see the python script
```python #!/usr/bin/env python # https://github.com/KuYaki/gitmodules/blob/master/gitmodules/gitmodules.py """ Clone a specific tag of git submodules with .gitmodules file """ import base64 import os import sys import subprocess import requests cwd = sys.path[0] git_modules_file_path = os.path.join(cwd, ".gitmodules") git_tag = "platform-tools-34.0.1" if os.path.exists(git_modules_file_path): with open(git_modules_file_path) as f: path = None url = None for line in f.readlines(): if "path = " in line: path = line.split("path = ")[-1][:-1] if "url = " in line: url = line.split("url = ")[-1][:-1] if path and url: if "boringssl" in path: boring_url = f'https://android.googlesource.com/platform/external/boringssl/+/refs/tags/{git_tag}/BORINGSSL_REVISION?format=TEXT' boring_sha = str(base64.b64decode(requests.get(boring_url, timeout=30).text), 'UTF-8').strip("\n") print(f'git clone --filter=blob:none https://boringssl.googlesource.com/boringssl.git {path}') subprocess.run(f'git clone --filter=blob:none https://boringssl.googlesource.com/boringssl.git {path}'.split(), check=True) previous_dir = os.getcwd() os.chdir(path) print(f'git checkout {boring_sha}') subprocess.run(f'git checkout {boring_sha}'.split(), check=True) os.chdir(previous_dir) else: print(f'git clone --depth=1 {url} {path} -b {git_tag}') subprocess.run(f'git clone --depth=1 {url} {path} -b {git_tag}'.split(), check=True) path = None url = None ```:warning: Seek medical advice after seeing the python code.
What I can not do yet
What I can try to do but need some guidance
The plan
git diff --exit-code vendor
command will check if there is any change.Please share your ideas and thoughts about this.