-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGit-Commit-App.py
More file actions
81 lines (53 loc) · 2.13 KB
/
Git-Commit-App.py
File metadata and controls
81 lines (53 loc) · 2.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
import streamlit as st
from github import Github
import re
from git import Repo
import git
st.title("Git Commit App")
#TODO Insert File directory location here
repo = Repo("Insert file directiory of project here")
#TODO Insert GitHub aceess token here inside quotes
access_token = "Insert Access Token here"
# using an access token
g = Github("access_token")
# Github Enterprise with custom hostname
g = Github(base_url="https://github.com/api/v3", login_or_token="access_token")
#git add
st.write("Step 1. git add -A is a command that adds all changes to a space that behaves like a container, click button below to add your changes")
result = st.button("git add -A")
st.write(result)
if result:
# to add all the working files.
repo.git.add('--all')
#git commit
st.write("Step 2. git commit -m is the command that then takes that container and puts a message on it to create a commit(commit message would go in quotes following the command in terminal)")
st.write("(if error occurs make sure all changes in your file are saved)")
message = st.text_input("Write Commit Message here")
result = st.button("git commit -m ")
st.write(result)
if result:
repo.git.add('--all')
repo.git.commit('-m', message)
#git push
st.write("Step 3. git push is the command that sends your commit to GitHub and updates your repository with your changes")
result = st.button("git push")
st.write(result)
if result:
origin = repo.remote(name='origin')
origin.push()
#git log
st.write("click here to see your current list of commits")
result = st.button("Commit History")
st.write(result)
if result:
#TODO insert access token here
access_token = "Insert Access Token here"
# using an access token
g = Github(access_token)
#TODO insert ("Github Username/GitHub Repo title")
repo = g.get_repo("GitHub Username/GitHub Repo Title")
commits = repo.get_commits()
for commit in commits:
st.write("Commit: ", commit.commit.message)
st.write("Author: ", commit.author.login)
st.write("______________________________")