From 1e8a37fdfdd10c14064511bcb92889fe53af74d6 Mon Sep 17 00:00:00 2001 From: RemiZOffAlex Date: Sun, 19 Oct 2025 05:08:12 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9E=D0=B1=D0=BD=D0=BE=D0=B2=D0=B8=D1=82?= =?UTF-8?q?=D1=8C=20executor/cli/git.py?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- executor/cli/git.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/executor/cli/git.py b/executor/cli/git.py index 15eadcc..55f71dc 100644 --- a/executor/cli/git.py +++ b/executor/cli/git.py @@ -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