mirror of
https://github.com/tgbot-collection/ytdlbot.git
synced 2025-02-22 22:33:08 +08:00
pre-push
This commit is contained in:
parent
ef0becaa93
commit
f7bd4fead6
2 changed files with 22 additions and 6 deletions
|
@ -6,12 +6,6 @@
|
|||
|
||||
This Telegram bot allows you to download videos from YouTube and [other supported websites](#supported-websites).
|
||||
|
||||
# development
|
||||
install pre-commit
|
||||
```shell
|
||||
cp pre-push.py .git/hooks/pre-push
|
||||
chmod +x .git/hooks/pre-push
|
||||
```
|
||||
# Usage
|
||||
|
||||
* EU🇪🇺: [https://t.me/benny_2ytdlbot](https://t.me/benny_2ytdlbot)
|
||||
|
|
22
pre-push.py
Executable file
22
pre-push.py
Executable file
|
@ -0,0 +1,22 @@
|
|||
#!/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"])
|
Loading…
Reference in a new issue