Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
fix: pass GITHUB_TOKEN to httpx calls + fix E501 lint in test
  • Loading branch information
OpenClaw Subagent committed Mar 8, 2026
commit 40c8e117fae676c2aab80e0926d4305724b53bee
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ jobs:
python-version: ${{ matrix.python-version }}
- run: pip install -e ".[dev]"
- run: pytest -v
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

docker-test:
runs-on: ubuntu-latest
Expand Down
16 changes: 14 additions & 2 deletions src/skills.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,14 @@ def save_skill_file(skill_name: str, raw_content: str) -> Path:
# ---------------------------------------------------------------------------


def _github_headers() -> dict:
"""Return auth headers if GITHUB_TOKEN is set, else empty dict."""
import os

token = os.environ.get("GITHUB_TOKEN")
return {"Authorization": f"Bearer {token}"} if token else {}


def list_skills_in_repo(repo: str, branch: str = DEFAULT_BRANCH) -> List[str]:
"""Return names of all skills available in a GitHub repo.

Expand All @@ -76,7 +84,9 @@ def list_skills_in_repo(repo: str, branch: str = DEFAULT_BRANCH) -> List[str]:
"""
url = _GITHUB_TREE_API.format(repo=repo, branch=branch)
try:
resp = httpx.get(url, follow_redirects=True, timeout=15)
resp = httpx.get(
url, follow_redirects=False, timeout=15, headers=_github_headers()
)
if resp.status_code != 200:
return []
tree = resp.json().get("tree", [])
Expand Down Expand Up @@ -104,7 +114,9 @@ def fetch_skill_from_repo(
"""
url = _GITHUB_RAW.format(repo=repo, branch=branch, skill=skill_name)
try:
resp = httpx.get(url, follow_redirects=True, timeout=15)
resp = httpx.get(
url, follow_redirects=False, timeout=15, headers=_github_headers()
)
if resp.status_code != 200:
return None
except httpx.HTTPError:
Expand Down
3 changes: 2 additions & 1 deletion tests/test_docker_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -1098,7 +1098,8 @@ def test_install_all_then_sync_dry_run(self, runner, cli, tmp_path, monkeypatch)
skills_dir = tmp_path / ".apc" / "skills"
installed_count = len(list(skills_dir.iterdir())) if skills_dir.exists() else 0
assert installed_count > 5, (
f"Expected >5 skills installed, got {installed_count}. Install output:\n{r_install.output}"
f"Expected >5 skills installed, got {installed_count}.\n"
f"Install output:\n{r_install.output}"
)

r_sync = runner.invoke(cli, ["sync", "--tools", "cursor", "--dry-run"])
Expand Down
Loading