mirror of
https://github.com/hastagAB/Awesome-Python-Scripts.git
synced 2024-11-23 20:11:07 +00:00
Added git automation to repo (#171)
Added gitAutomation to README.md refactoring
This commit is contained in:
parent
cef99f37d3
commit
27f2a0e8b6
|
@ -37,6 +37,7 @@ So far, the following projects have been integrated to this repo:
|
||||||
|[File Sharing Bot](https://github.com/hastagAB/Awesome-Python-Scripts/tree/master/File-Sharing-Bot) | [Darshan Patel](https://github.com/DarshanPatel11)|
|
|[File Sharing Bot](https://github.com/hastagAB/Awesome-Python-Scripts/tree/master/File-Sharing-Bot) | [Darshan Patel](https://github.com/DarshanPatel11)|
|
||||||
|[Flash card quizzer](https://github.com/hastagAB/Awesome-Python-Scripts/tree/master/Flash-card-Challenge) |[Utkarsh Sharma](https://github.com/Utkarsh1308) |
|
|[Flash card quizzer](https://github.com/hastagAB/Awesome-Python-Scripts/tree/master/Flash-card-Challenge) |[Utkarsh Sharma](https://github.com/Utkarsh1308) |
|
||||||
|[Frammed text generator](https://github.com/hastagAB/Awesome-Python-Scripts/tree/master/FramedText) | [jcdwalle](https://github.com/jcdwalle)|
|
|[Frammed text generator](https://github.com/hastagAB/Awesome-Python-Scripts/tree/master/FramedText) | [jcdwalle](https://github.com/jcdwalle)|
|
||||||
|
|[git_automation](https://github.com/hastagAB/Awesome-Python-Scripts/tree/master/git_automation)| [loge1998](https://github.com/loge1998)|
|
||||||
|[Gmail Mailing Script](https://github.com/hastagAB/Awesome-Python-Scripts/tree/master/mailing) |[mayank-kapur](https://github.com/kapurm17) |
|
|[Gmail Mailing Script](https://github.com/hastagAB/Awesome-Python-Scripts/tree/master/mailing) |[mayank-kapur](https://github.com/kapurm17) |
|
||||||
|[Handwrting DNN recognizer](https://github.com/hastagAB/Awesome-Python-Scripts/tree/master/Handwriting_Recognizer) |[Chris]() |
|
|[Handwrting DNN recognizer](https://github.com/hastagAB/Awesome-Python-Scripts/tree/master/Handwriting_Recognizer) |[Chris]() |
|
||||||
|[HTML Table to List](https://github.com/hastagAB/Awesome-Python-Scripts/tree/master/HTML_Table_to_List) | [Nitish Srivastava](https://github.com/nitish-iiitd)|
|
|[HTML Table to List](https://github.com/hastagAB/Awesome-Python-Scripts/tree/master/HTML_Table_to_List) | [Nitish Srivastava](https://github.com/nitish-iiitd)|
|
||||||
|
|
17
git_automation/.my_commands.sh
Executable file
17
git_automation/.my_commands.sh
Executable file
|
@ -0,0 +1,17 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
function create() {
|
||||||
|
cd
|
||||||
|
source .env
|
||||||
|
python create.py $1
|
||||||
|
cd $FILEPATH$1
|
||||||
|
git init
|
||||||
|
git remote add origin git@github.com:$USERNAME/$1.git
|
||||||
|
touch README.md
|
||||||
|
git add .
|
||||||
|
git commit -m "Initial commit"
|
||||||
|
git push -u origin main
|
||||||
|
code .
|
||||||
|
}
|
||||||
|
|
||||||
|
|
12
git_automation/README.md
Executable file
12
git_automation/README.md
Executable file
|
@ -0,0 +1,12 @@
|
||||||
|
### Install:
|
||||||
|
```bash
|
||||||
|
pip install -r requirements.txt
|
||||||
|
touch .env
|
||||||
|
Then open the .env file and store your username, password, and desired file destination. Use the provided format at the bottom of this README.
|
||||||
|
source ~/.my_commands.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
### Usage:
|
||||||
|
```bash
|
||||||
|
To run the script type in 'create <name of your folder>'
|
||||||
|
```
|
3
git_automation/config.env
Normal file
3
git_automation/config.env
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
USERNAME="User"
|
||||||
|
PASSWORD="Pass"
|
||||||
|
FILEPATH="/path/to/your/project/"
|
24
git_automation/create.py
Executable file
24
git_automation/create.py
Executable file
|
@ -0,0 +1,24 @@
|
||||||
|
import sys
|
||||||
|
import os
|
||||||
|
from github import Github
|
||||||
|
from dotenv import load_dotenv
|
||||||
|
|
||||||
|
load_dotenv()
|
||||||
|
|
||||||
|
path = os.getenv("FILEPATH")
|
||||||
|
username = os.getenv("USERNAME")
|
||||||
|
password = os.getenv("PASSWORD")
|
||||||
|
|
||||||
|
def create():
|
||||||
|
folderName = str(sys.argv[1])
|
||||||
|
folderpath = os.path.join(path,folderName)
|
||||||
|
if os.path.exists(folderpath):
|
||||||
|
print("Folder already exists.. Link to the path - "+ folderpath)
|
||||||
|
os.makedirs(folderpath)
|
||||||
|
user = Github(username, password).get_user()
|
||||||
|
repo = user.create_repo(sys.argv[1])
|
||||||
|
print("Succesfully created repository {}".format(sys.argv[1]))
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
create()
|
3
git_automation/requirements.txt
Executable file
3
git_automation/requirements.txt
Executable file
|
@ -0,0 +1,3 @@
|
||||||
|
selenium
|
||||||
|
PyGithub
|
||||||
|
python-dotenv
|
Loading…
Reference in New Issue
Block a user