-
-
Notifications
You must be signed in to change notification settings - Fork 551
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ef0beca
commit 52c4f86
Showing
1 changed file
with
22 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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"]) |