-
Notifications
You must be signed in to change notification settings - Fork 0
51 lines (42 loc) · 1.44 KB
/
Copy pathgit-extension.yml
File metadata and controls
51 lines (42 loc) · 1.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
name: Check Git Dependencies
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
check-git-deps:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
- name: Run Git dependency check
run: |
import tomllib
from pathlib import Path
import sys
pyproject_path = Path("pyproject.toml")
if not pyproject_path.exists():
print("Error: pyproject.toml not found in the current directory.")
sys.exit(1)
with open(pyproject_path, "rb") as f:
config = tomllib.load(f)
issues = []
for section in ["project", "project.optional-dependencies"]:
if section in config and "dependencies" in config[section]:
deps = config[section]["dependencies"]
for dep in deps:
if "git+https://" in dep and not dep.endswith(".git"):
issues.append(dep)
if issues:
print("The following git dependencies are missing the .git extension:")
for issue in issues:
print(f" - {issue}")
sys.exit(1)
else:
print("All git dependencies are correctly formatted.")
shell: python