This commit is contained in:
@@ -5,6 +5,13 @@ __email__ = 'remizoffalex@mail.ru'
|
||||
import os
|
||||
import sys
|
||||
import base64
|
||||
import json
|
||||
|
||||
|
||||
def json_read(filename):
|
||||
with open(filename, 'r') as fd:
|
||||
data = json.load(fd)
|
||||
return data
|
||||
|
||||
|
||||
def handle_git(args):
|
||||
@@ -18,6 +25,7 @@ def handle_git(args):
|
||||
INPUT_REPOSITORY = os.getenv('INPUT_REPOSITORY')
|
||||
INPUT_PATH = os.getenv('INPUT_PATH')
|
||||
DEPTH = os.getenv('INPUT_FETCH-DEPTH')
|
||||
GITHUB_EVENT_PATH = os.getenv('GITHUB_EVENT_PATH')
|
||||
GITHUB_SERVER_URL = os.getenv('GITHUB_SERVER_URL')
|
||||
GITHUB_REPOSITORY = os.getenv('GITHUB_REPOSITORY')
|
||||
GITHUB_REF = os.getenv('GITHUB_REF')
|
||||
@@ -50,9 +58,15 @@ def handle_git(args):
|
||||
cmd = 'git config set --local ' + key + ' ' + escape(value)
|
||||
exec_cmd(cmd)
|
||||
|
||||
# key = 'url.https://'+TOKEN+':x-oauth-basic@codex.r10x.net'+'/.insteadOf'
|
||||
# value = 'git@"'+base64_string+'"'
|
||||
# cmd = 'git config set --local ' + escape(key) + ' ' + escape(GITHUB_SERVER_URL)
|
||||
# exec_cmd(cmd)
|
||||
|
||||
data = json_read(GITHUB_EVENT_PATH)
|
||||
org_id = data['repository']['owner']['id']
|
||||
key = 'url.https://'+TOKEN+':x-oauth-basic@codex.r10x.net'+'/.insteadOf'
|
||||
value = 'git@"'+base64_string+'"'
|
||||
cmd = 'git config set --local ' + escape(key) + ' ' + escape(GITHUB_SERVER_URL)
|
||||
value = 'git@codex.r10x.net:org-'+org_id+'@github.com:'
|
||||
exec_cmd(cmd)
|
||||
|
||||
cmd = 'git remote add origin ' + GITHUB_SERVER_URL + REPOSITORY
|
||||
|
||||
Reference in New Issue
Block a user