Skip to content

Commit fa28033

Browse files
authored
Merge pull request #365 from ansforge/fix/converter-test-rate-limit
Fix converter test rate limit
2 parents 1b05b2d + 3adaef0 commit fa28033

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

.github/workflows/converter-tests.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ on:
1515
jobs:
1616
test:
1717
runs-on: ubuntu-latest
18+
permissions:
19+
# Needed to run tests
20+
contents: read
21+
# Needed to create/update comments on PR
22+
pull-requests: write
1823
defaults:
1924
run:
2025
working-directory: converter
@@ -48,6 +53,8 @@ jobs:
4853
- name: Run tests with HTML and XML coverage reports
4954
run: |
5055
uv run pytest --cov=converter --cov-report=html --cov-report=xml --cov-config=pyproject.toml -rP
56+
env:
57+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5158

5259
- name: Upload HTML coverage report
5360
uses: actions/upload-artifact@v4

converter/tests/test_helpers.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import json
2+
import os
23
from pathlib import Path
34
from typing import Dict, Any, Optional
45
from jsonschema import validate
@@ -80,7 +81,13 @@ def get_json_files_online(directory: str, tag: str) -> list:
8081
base_url = f"https://raw.githubusercontent.com/ansforge/SAMU-Hub-Modeles/{tag}/src/main/resources/sample/examples"
8182
api_url = f"https://api.github.com/repos/ansforge/SAMU-Hub-Modeles/contents/src/main/resources/sample/examples/{directory}?ref={tag}"
8283

83-
response = session.get(api_url)
84+
token = os.getenv("GITHUB_TOKEN")
85+
86+
if token:
87+
headers = {"Authorization": f"Bearer {token}"}
88+
response = session.get(api_url, headers=headers)
89+
else:
90+
response = session.get(api_url)
8491
response.raise_for_status()
8592

8693
files = []

0 commit comments

Comments
 (0)