You've already forked PythonLib
mirror of
https://github.com/lifebottle/PythonLib.git
synced 2026-02-13 15:25:50 -08:00
Merge pull request #46 from lifebottle/feature/get-pull-requests
Add features to PRs in Dev
This commit is contained in:
@@ -31,15 +31,10 @@ def get_credentials(): # Gets valid user credentials from disk.
|
||||
return credentials
|
||||
|
||||
|
||||
def send_message(sender, to, commiter_name, subject, xdelta_link):
|
||||
def send_message(sender, to, subject, xdelta_link, message_text):
|
||||
|
||||
|
||||
message_text = """
|
||||
Hi {},
|
||||
|
||||
here is your xdelta patch :
|
||||
{}
|
||||
""".format(commiter_name, xdelta_link)
|
||||
|
||||
credentials = get_credentials()
|
||||
#print (credentials)
|
||||
|
||||
@@ -2,6 +2,7 @@ import os
|
||||
import requests
|
||||
import json
|
||||
import subprocess
|
||||
import pandas as pd
|
||||
|
||||
def get_Releases(org, repo_name, latest=False):
|
||||
|
||||
@@ -29,3 +30,38 @@ def refresh_repo(repo_name):
|
||||
["git", "pull"],
|
||||
cwd=base_path
|
||||
)
|
||||
|
||||
def get_pull_requests(org, repo_name):
|
||||
api_url = "https://api.github.com/repos/{}/{}/pulls?state=all".format(org, repo_name)
|
||||
|
||||
header = {
|
||||
"Accept":"application/vnd.github.v3+json"
|
||||
}
|
||||
|
||||
res = requests.get(api_url)
|
||||
json_res = json.loads(res.text)
|
||||
|
||||
#Taking Top 5 PR
|
||||
top5 = json_res[0:5]
|
||||
|
||||
return top5
|
||||
|
||||
def get_pull_requests_message(org, repo_name):
|
||||
|
||||
#Get Datas
|
||||
top5_prs = get_pull_requests(org, repo_name)
|
||||
|
||||
message ='Here are the PRs recently : '
|
||||
|
||||
for pr in top5_prs:
|
||||
|
||||
message = message + "<br>"
|
||||
message += '{} - {} by {} ... {}'.format(pr['created_at'], pr['title'], pr['user']['login'], pr['_links']['html']['href'])
|
||||
|
||||
return message
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -186,6 +186,10 @@ if __name__ == "__main__":
|
||||
game_name = args.game
|
||||
tales_instance = getTalesInstance(game_name)
|
||||
|
||||
org = 'SymphoniaLauren'
|
||||
repo_name = 'Tales-of-Rebirth'
|
||||
|
||||
|
||||
#Utility function
|
||||
if args.action == "utility":
|
||||
|
||||
@@ -199,24 +203,32 @@ if __name__ == "__main__":
|
||||
if args.action == "pack":
|
||||
|
||||
#RepoFunctions.refresh_repo("PythonLib")
|
||||
RepoFunctions.refresh_repo("Tales-Of-Rebirth")
|
||||
RepoFunctions.refresh_repo(repo_name)
|
||||
|
||||
if args.file == "SLPS":
|
||||
|
||||
#SLPS
|
||||
tales_instance.pack_Menu_File("../Data/Tales-Of-Rebirth/Disc/Original/SLPS_254.50")
|
||||
|
||||
ApacheAutomate.apache_job(['SLPS_254.50'], "Tales-Of-Rebirth")
|
||||
ApacheAutomate.apache_job(['SLPS_254.50'], repo_name)
|
||||
|
||||
|
||||
|
||||
|
||||
xdelta_name = "../Data/Tales-Of-Rebirth/Disc/New/Tales-Of-Rebirth_patch.xdelta"
|
||||
generate_xdelta_patch("Tales-Of-Rebirth", xdelta_name)
|
||||
generate_xdelta_patch(repo_name, xdelta_name)
|
||||
|
||||
file_link = GoogleAPI.upload_xdelta(xdelta_name, "Stewie") #Need to add user for the folder
|
||||
|
||||
GoogleAPI.send_message('fortiersteven1@gmail.com', 'fortiersteven1@gmail.com', "Stewie", game_name + " Patch", file_link)
|
||||
message_text = """
|
||||
Hi {},
|
||||
|
||||
here is your xdelta patch :
|
||||
{}
|
||||
""".format('fortiersteven1@gmail.com', file_link)
|
||||
|
||||
message_text = message_text + "<br>" + RepoFunctions.get_pull_requests_message(org, repo_name)
|
||||
GoogleAPI.send_message('fortiersteven1@gmail.com', 'fortiersteven1@gmail.com', game_name + " Patch", file_link, message_text)
|
||||
|
||||
|
||||
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user