Added git automation to repo (#171)

Added gitAutomation to README.md

refactoring
This commit is contained in:
loge1998 2020-10-05 13:37:25 +05:30 committed by GitHub
parent cef99f37d3
commit 27f2a0e8b6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 60 additions and 0 deletions

View File

@ -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
View 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
View 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>'
```

View File

@ -0,0 +1,3 @@
USERNAME="User"
PASSWORD="Pass"
FILEPATH="/path/to/your/project/"

24
git_automation/create.py Executable file
View 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()

View File

@ -0,0 +1,3 @@
selenium
PyGithub
python-dotenv