Compare commits

...
Author SHA1 Message Date
emil 91e10ddb26 docs: trigger CI with correct branch name 2026-08-03 16:37:00 +02:00
emil 56b27f3db8 fix: update Vikunja project ID to 2 2026-08-03 16:30:39 +02:00
emilandDevin <158243242+devin-ai-integration[bot]@users.noreply.github.com> 31d6c91ca6 fix: add User-Agent header to _download in install_tools
dl.gitea.com returns 403 to Python's default urllib User-Agent,
causing Docker image builds to fail when installing tea CLI.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-08-03 16:00:41 +02:00
4 changed files with 15 additions and 5 deletions
+2 -2
View File
@@ -90,7 +90,7 @@ jobs:
if: github.event_name == 'pull_request' if: github.event_name == 'pull_request'
env: env:
VIKUNJA_TOKEN: ${{ secrets.VIKUNJA_TOKEN }} VIKUNJA_TOKEN: ${{ secrets.VIKUNJA_TOKEN }}
DEVX_VIKUNJA_PROJECT_ID: "8" DEVX_VIKUNJA_PROJECT_ID: "2"
HEAD_REF: ${{ github.head_ref }} HEAD_REF: ${{ github.head_ref }}
PR_TITLE: ${{ github.event.pull_request.title }} PR_TITLE: ${{ github.event.pull_request.title }}
REPOSITORY: ${{ github.repository }} REPOSITORY: ${{ github.repository }}
@@ -173,7 +173,7 @@ jobs:
env: env:
CI_GITEA_API_TOKEN: ${{ secrets.CI_GITEA_API_TOKEN }} CI_GITEA_API_TOKEN: ${{ secrets.CI_GITEA_API_TOKEN }}
VIKUNJA_TOKEN: ${{ secrets.VIKUNJA_TOKEN }} VIKUNJA_TOKEN: ${{ secrets.VIKUNJA_TOKEN }}
DEVX_VIKUNJA_PROJECT_ID: "8" DEVX_VIKUNJA_PROJECT_ID: "2"
HEAD_REF: ${{ github.head_ref }} HEAD_REF: ${{ github.head_ref }}
PR_TITLE: ${{ github.event.pull_request.title }} PR_TITLE: ${{ github.event.pull_request.title }}
REPOSITORY: ${{ github.repository }} REPOSITORY: ${{ github.repository }}
+1 -1
View File
@@ -152,7 +152,7 @@ jobs:
if: needs.detect-and-configure.outputs.is-automated == 'false' if: needs.detect-and-configure.outputs.is-automated == 'false'
env: env:
VIKUNJA_TOKEN: ${{ secrets.VIKUNJA_TOKEN }} VIKUNJA_TOKEN: ${{ secrets.VIKUNJA_TOKEN }}
DEVX_VIKUNJA_PROJECT_ID: "8" DEVX_VIKUNJA_PROJECT_ID: "2"
run: | run: |
. .venv/bin/activate 2>/dev/null || true . .venv/bin/activate 2>/dev/null || true
python3 -m devx.ci.post_merge --git-sha "${{ github.sha }}" python3 -m devx.ci.post_merge --git-sha "${{ github.sha }}"
+7 -2
View File
@@ -65,8 +65,13 @@ def _ensure_target_dir() -> Path:
def _download(url: str, dest: Path) -> None: def _download(url: str, dest: Path) -> None:
"""Download a file from ``url`` to ``dest`` with a 60s timeout.""" """Download a file from ``url`` to ``dest`` with a 60s timeout.
with urllib.request.urlopen(url, timeout=60) as resp, open(dest, "wb") as f: # nosec B310
A User-Agent header is set because some CDNs (e.g. dl.gitea.com)
return 403 to requests with Python's default User-Agent.
"""
req = urllib.request.Request(url, headers={"User-Agent": "devx/install-tools"})
with urllib.request.urlopen(req, timeout=60) as resp, open(dest, "wb") as f: # nosec B310
shutil.copyfileobj(resp, f) shutil.copyfileobj(resp, f)
+5
View File
@@ -1,6 +1,7 @@
from __future__ import annotations from __future__ import annotations
import platform import platform
import urllib.request
from pathlib import Path from pathlib import Path
from unittest.mock import patch from unittest.mock import patch
@@ -66,6 +67,10 @@ class TestDownload:
with patch("urllib.request.urlopen", return_value=_FakeResponse()) as mock_urlopen: with patch("urllib.request.urlopen", return_value=_FakeResponse()) as mock_urlopen:
install_tools._download("https://example.com/file", dest) install_tools._download("https://example.com/file", dest)
mock_urlopen.assert_called_once() mock_urlopen.assert_called_once()
call_args = mock_urlopen.call_args
req = call_args.args[0]
assert isinstance(req, urllib.request.Request)
assert req.get_header("User-agent") == "devx/install-tools"
assert dest.read_bytes() == b"data" assert dest.read_bytes() == b"data"