Обновить execute.py
This commit is contained in:
18
execute.py
18
execute.py
@@ -4,22 +4,26 @@ import os
|
|||||||
import sys
|
import sys
|
||||||
|
|
||||||
print('EXECUTE')
|
print('EXECUTE')
|
||||||
print(os.getenv('ACTIONS_RUNTIME_TOKEN'))
|
ACTIONS_RUNTIME_TOKEN = os.getenv('ACTIONS_RUNTIME_TOKEN')
|
||||||
token = os.getenv('ACTIONS_RUNTIME_TOKEN')
|
GITHUB_SERVER_URL = os.getenv('GITHUB_SERVER_URL')
|
||||||
print(len(os.getenv('ACTIONS_RUNTIME_TOKEN')))
|
GITHUB_REPOSITORY = os.getenv('GITHUB_REPOSITORY')
|
||||||
|
print('GITHUB_SERVER_URL:', GITHUB_SERVER_URL)
|
||||||
|
print('GITHUB_REPOSITORY:', GITHUB_REPOSITORY)
|
||||||
|
print(ACTIONS_RUNTIME_TOKEN)
|
||||||
|
print(len(ACTIONS_RUNTIME_TOKEN))
|
||||||
print('#'*80)
|
print('#'*80)
|
||||||
print(sys.argv)
|
print(sys.argv)
|
||||||
import base64
|
import base64
|
||||||
|
|
||||||
sample_string = "x-access-token:" + token
|
sample_string = "x-access-token:" + ACTIONS_RUNTIME_TOKEN
|
||||||
sample_string_bytes = sample_string.encode("utf-8")
|
sample_string_bytes = sample_string.encode("utf-8")
|
||||||
|
|
||||||
base64_bytes = base64.b64encode(sample_string_bytes)
|
base64_bytes = base64.b64encode(sample_string_bytes)
|
||||||
base64_string = 'AUTHORIZATION: basic ' + base64_bytes.decode("utf-8")
|
base64_string = 'AUTHORIZATION: basic ' + base64_bytes.decode("utf-8")
|
||||||
|
|
||||||
cmd = 'git -c http.extraheader="'+base64_string+'" clone ' + \
|
cmd = 'git -c http.'+GITHUB_SERVER_URL+'extraheader="'+base64_string+'" clone ' + \
|
||||||
os.getenv('GITHUB_SERVER_URL') + '/' + \
|
GITHUB_SERVER_URL + '/' + \
|
||||||
os.getenv('GITHUB_REPOSITORY')
|
GITHUB_REPOSITORY
|
||||||
os.system(cmd)
|
os.system(cmd)
|
||||||
|
|
||||||
print(f"Encoded string: {base64_string}")
|
print(f"Encoded string: {base64_string}")
|
||||||
|
|||||||
Reference in New Issue
Block a user