mirror of
https://github.com/tgbot-collection/ytdlbot.git
synced 2025-02-23 23:04:05 +08:00
23 lines
512 B
Python
23 lines
512 B
Python
|
#!/usr/bin/env python3
|
||
|
# coding: utf-8
|
||
|
|
||
|
# ytdlbot - pre-commit.py
|
||
|
# for dependabot
|
||
|
|
||
|
import tomllib
|
||
|
import subprocess
|
||
|
|
||
|
|
||
|
with open("pyproject.toml", "rb") as file:
|
||
|
config = tomllib.load(file)
|
||
|
|
||
|
with open("requirements.txt", "w") as file:
|
||
|
for item in config["project"]["dependencies"]:
|
||
|
if " " in item:
|
||
|
item = item.split()[-1]
|
||
|
file.write(f"{item}\n")
|
||
|
|
||
|
# commit with amend
|
||
|
subprocess.run(["git", "add", "requirements.txt"])
|
||
|
subprocess.run(["git", "commit", "--amend", "--no-edit"])
|