in scripts/store-agent-creds.py [0:0]
def _get_runner_tar(version) -> str:
system, arch = _get_system_arch()
cache = os.path.abspath(".cache")
try:
os.mkdir(cache)
except FileExistsError:
pass
fname = f"actions-runner-{system}-{arch}-{version}.tar.gz"
local_file = os.path.join(cache, fname)
if os.path.exists(local_file):
return local_file
url = f"https://github.com/actions/runner/releases/download/v{version}/{fname}"
click.echo(f"Getting {url}")
resp = requests.get(url, stream=True)
resp.raise_for_status()
with open(local_file, "wb") as fh, click.progressbar(length=int(resp.headers["content-length"])) as bar:
for chunk in resp.iter_content(chunk_size=40960):
fh.write(chunk)
bar.update(len(chunk))
return local_file