Обновить execute.py

This commit is contained in:
2025-03-29 22:50:32 +03:00
parent 6f4769e7ff
commit 2c9450934f
+3 -16
View File
@@ -2,17 +2,15 @@
import os import os
import sys import sys
import base64
print('EXECUTE')
print(sys.argv)
# for key, value in os.environ.items(): # for key, value in os.environ.items():
# print(f"{key}={value}") # print(f"{key}={value}")
ACTIONS_RUNTIME_TOKEN = os.getenv('ACTIONS_RUNTIME_TOKEN') ACTIONS_RUNTIME_TOKEN = os.getenv('ACTIONS_RUNTIME_TOKEN')
INPUT_TOKEN = os.getenv('INPUT_TOKEN') INPUT_TOKEN = os.getenv('INPUT_TOKEN')
GITHUB_SERVER_URL = os.getenv('GITHUB_SERVER_URL') GITHUB_SERVER_URL = os.getenv('GITHUB_SERVER_URL')
GITHUB_REPOSITORY = os.getenv('GITHUB_REPOSITORY') GITHUB_REPOSITORY = os.getenv('GITHUB_REPOSITORY')
print('#'*80)
import base64
sample_string = "x-access-token:" + ACTIONS_RUNTIME_TOKEN sample_string = "x-access-token:" + ACTIONS_RUNTIME_TOKEN
sample_string = "x-access-token:" + INPUT_TOKEN sample_string = "x-access-token:" + INPUT_TOKEN
@@ -25,32 +23,21 @@ key = 'http.'+GITHUB_SERVER_URL+'/.extraheader'
value = '"'+base64_string+'"' value = '"'+base64_string+'"'
cmd = 'git config --global ' + key + ' ' + value cmd = 'git config --global ' + key + ' ' + value
result = os.popen(cmd) result = os.popen(cmd)
print('result:' , result.read())
key = 'url.'+GITHUB_SERVER_URL+'/.insteadOf' key = 'url.'+GITHUB_SERVER_URL+'/.insteadOf'
value = '"git@'+'codex.r10x.net'+'"' value = '"git@'+'codex.r10x.net'+'"'
cmd = 'git config --global ' + key + ' ' + GITHUB_SERVER_URL cmd = 'git config --global ' + key + ' ' + GITHUB_SERVER_URL
# result = os.popen(cmd) # result = os.popen(cmd)
# print('result:' , result.read())
cmd = 'git config list ' #cmd = 'git config list '
# result = os.popen(cmd) # result = os.popen(cmd)
# print('result:' , result.read())
cmd = 'git clone ' + \ cmd = 'git clone ' + \
GITHUB_SERVER_URL + '/' + \ GITHUB_SERVER_URL + '/' + \
GITHUB_REPOSITORY + ' ' + os.getcwd() GITHUB_REPOSITORY + ' ' + os.getcwd()
print('cmd:', cmd)
print('pwd', os.getcwd())
result = os.popen(cmd) result = os.popen(cmd)
print('result:' , result.read())
# cmd = 'git clone ' + \ # cmd = 'git clone ' + \
# 'https://' + sample_string + '@codex.r10x.net' + '/' + \ # 'https://' + sample_string + '@codex.r10x.net' + '/' + \
# GITHUB_REPOSITORY # GITHUB_REPOSITORY
# print('cmd:', cmd)
# result = os.popen(cmd) # result = os.popen(cmd)
# print('result:' , result.read())
print(f"Encoded string: {base64_string}")
print('#'*80)