From 3a5cd4c3deb5c00cc6dc6c494f7d3f85e9345782 Mon Sep 17 00:00:00 2001 From: Erik Scheffers Date: Fri, 24 Feb 2023 20:38:41 +0100 Subject: [PATCH] add no-cache headers and cache buster query parameter --- .github/download_distribution.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/download_distribution.py b/.github/download_distribution.py index 875f98240..aae5c8d00 100755 --- a/.github/download_distribution.py +++ b/.github/download_distribution.py @@ -718,7 +718,8 @@ def is_valid_uri(x: str) -> bool: # network utilities def fetch_text(url: str) -> str: - return run_stdout(f'curl --fail --location --silent {url}') + cache_bust = int(time.time_ns() / 1000) + return run_stdout(f'curl -H "Cache-Control: no-cache, no-store" -H "Pragma: no-cache" --fail --location --silent {url}?_={cache_bust}') def download_repository(path: str, url: str, branch: str) -> None: if Path(path).exists(): @@ -729,8 +730,9 @@ def download_repository(path: str, url: str, branch: str) -> None: run(f'git -c protocol.version=2 clone -q --no-tags --no-recurse-submodules --depth=1 {minus_b} {url} {path}') def download_file(url: str, target: str) -> None: + cache_bust = int(time.time_ns() / 1000) Path(target).parent.mkdir(parents=True, exist_ok=True) - run(f'curl --show-error --fail --location -o "{target}" "{url}"') + run(f'curl -H "Cache-Control: no-cache, no-store" -H "Pragma: no-cache" --show-error --fail --location -o "{target}" "{url}?_={cache_bust}"') # execution utilities