Files
tools/execute.py

27 lines
674 B
Python
Raw Normal View History

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 03:47:20 +03:00
print(os.getenv('ACTIONS_RUNTIME_TOKEN'))
2025-03-29 03:56:34 +03:00
token = os.getenv('ACTIONS_RUNTIME_TOKEN')
2025-03-29 03:48:46 +03:00
print(len(os.getenv('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
sample_string = "x-access-token:" + token
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 04:03:39 +03:00
cmd = 'git -c http.extraheader="'+base64_string+'" clone ' + \
2025-03-29 04:04:36 +03:00
os.getenv('GITHUB_SERVER_URL') + '/' + \
2025-03-29 04:03:39 +03:00
os.getenv('GITHUB_REPOSITORY')
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)