#!/usr/bin/env python import os import sys import base64 # for key, value in os.environ.items(): # print(f"{key}={value}") ACTIONS_RUNTIME_TOKEN = os.getenv('ACTIONS_RUNTIME_TOKEN') INPUT_TOKEN = os.getenv('INPUT_TOKEN') GITHUB_SERVER_URL = os.getenv('GITHUB_SERVER_URL') GITHUB_REPOSITORY = os.getenv('GITHUB_REPOSITORY') sample_string = "x-access-token:" + ACTIONS_RUNTIME_TOKEN sample_string = "x-access-token:" + INPUT_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") key = 'http.'+GITHUB_SERVER_URL+'/.extraheader' value = '"'+base64_string+'"' cmd = 'git config --global ' + key + ' ' + value result = os.popen(cmd) key = 'url.'+GITHUB_SERVER_URL+'/.insteadOf' value = '"git@'+'codex.r10x.net'+'"' cmd = 'git config --global ' + key + ' ' + GITHUB_SERVER_URL # result = os.popen(cmd) cmd = 'git config list ' print(cmd) result = os.popen(cmd) print(result.read()) cmd = 'git config list --global' print(cmd) result = os.popen(cmd) print(result.read()) cmd = 'git clone ' + \ GITHUB_SERVER_URL + '/' + \ GITHUB_REPOSITORY + ' ' + os.getcwd() result = os.popen(cmd) # cmd = 'git clone ' + \ # 'https://' + sample_string + '@codex.r10x.net' + '/' + \ # GITHUB_REPOSITORY # result = os.popen(cmd)