2025-03-29 01:37:26 +03:00
|
|
|
#!/usr/bin/env python
|
|
|
|
|
|
2025-03-29 03:47:20 +03:00
|
|
|
import os
|
2025-03-29 01:37:26 +03:00
|
|
|
import sys
|
|
|
|
|
|
2025-03-29 01:56:51 +03:00
|
|
|
print('EXECUTE')
|
2025-03-29 14:44:34 +03:00
|
|
|
ACTIONS_RUNTIME_TOKEN = os.getenv('ACTIONS_RUNTIME_TOKEN')
|
|
|
|
|
GITHUB_SERVER_URL = os.getenv('GITHUB_SERVER_URL')
|
|
|
|
|
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))
|
2025-03-29 01:56:51 +03:00
|
|
|
print('#'*80)
|
2025-03-29 01:37:26 +03:00
|
|
|
print(sys.argv)
|
2025-03-29 03:56:34 +03:00
|
|
|
import base64
|
|
|
|
|
|
2025-03-29 14:44:34 +03:00
|
|
|
sample_string = "x-access-token:" + ACTIONS_RUNTIME_TOKEN
|
2025-03-29 03:56:34 +03:00
|
|
|
sample_string_bytes = sample_string.encode("utf-8")
|
|
|
|
|
|
|
|
|
|
base64_bytes = base64.b64encode(sample_string_bytes)
|
|
|
|
|
base64_string = 'AUTHORIZATION: basic ' + base64_bytes.decode("utf-8")
|
|
|
|
|
|
2025-03-29 14:46:54 +03:00
|
|
|
cmd = 'git -c http.'+GITHUB_SERVER_URL+'/.extraheader="'+base64_string+'" clone ' + \
|
2025-03-29 14:44:34 +03:00
|
|
|
GITHUB_SERVER_URL + '/' + \
|
|
|
|
|
GITHUB_REPOSITORY
|
2025-03-29 14:46:12 +03:00
|
|
|
print('cmd:', cmd)
|
2025-03-29 03:59:57 +03:00
|
|
|
os.system(cmd)
|
|
|
|
|
|
2025-03-29 03:56:34 +03:00
|
|
|
print(f"Encoded string: {base64_string}")
|
2025-03-29 01:56:51 +03:00
|
|
|
print('#'*80)
|