From 72fe1e4ed221f86886990cb624adc5b304a08af5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Rahn?= <1529364+rrahn@users.noreply.github.com> Date: Tue, 11 Nov 2025 13:09:37 +0100 Subject: [PATCH 1/3] Fix GH API rate limits. --- .github/workflows/pytest.yml | 2 ++ tests/test_datasets/test_test_datasets_utils.py | 15 +++++++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index fed3698f36..e7b43be2c3 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -101,6 +101,8 @@ jobs: - name: Test with pytest id: pytest + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | python3 -m pytest tests/${{matrix.test}} --color=yes --cov --cov-config=.coveragerc --durations=0 -n auto && exit_code=0|| exit_code=$? # don't fail if no tests were collected, e.g. for test_licence.py diff --git a/tests/test_datasets/test_test_datasets_utils.py b/tests/test_datasets/test_test_datasets_utils.py index 3a58765752..628ae67852 100644 --- a/tests/test_datasets/test_test_datasets_utils.py +++ b/tests/test_datasets/test_test_datasets_utils.py @@ -1,3 +1,4 @@ +import os import unittest import requests @@ -92,7 +93,7 @@ def test_modules_branch_name_changed(self): def test_modules_branch_exists(self): url = self.gh_urls.get_remote_tree_url_for_branch(MODULES_BRANCH_NAME) - resp = requests.get(url) + resp = self._request_with_token(url) self.assertTrue(resp.ok) self.assertTrue(len(resp.json()) != 0) @@ -143,9 +144,19 @@ def test_github_endpoints(self): self.assertTrue(url_2 is not None) self.assertTrue(url_3 is not None) - resp_1 = requests.get(url_1) + resp_1 = self._request_with_token(url_1) resp_2 = requests.get(url_2) resp_3 = requests.get(url_3) self.assertTrue(resp_1.ok) self.assertTrue(resp_2.ok) self.assertFalse(resp_3.ok) + + def _request_with_token(self, url): + """Make a request with a GitHub token if available to mitigate issues with API rate limits.""" + headers = {} + github_token = os.environ.get("GITHUB_TOKEN") + if github_token: + headers["authorization"] = f"Bearer {github_token}" + + resp = requests.get(url, headers=headers) + return resp From b13a03ca7049e5e65a3b6d288a5de42debe537f8 Mon Sep 17 00:00:00 2001 From: nf-core-bot Date: Wed, 12 Nov 2025 10:19:00 +0000 Subject: [PATCH 2/3] [automated] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a04aea7af9..d65e93264b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,7 @@ - chore(deps): update mcr.microsoft.com/devcontainers/miniconda docker digest to 19516ba ([#3890](https://github.com/nf-core/tools/pull/3890)) - Update dependency textual to v6.6.0 ([#3892](https://github.com/nf-core/tools/pull/3892)) - chore(deps): update mcr.microsoft.com/devcontainers/base:debian docker digest to 2e826a6 ([#3893](https://github.com/nf-core/tools/pull/3893)) +- Fix GH API rate limits. ([#3895](https://github.com/nf-core/tools/pull/3895)) - Update pre-commit hook astral-sh/ruff-pre-commit to v0.14.5 ([#3900](https://github.com/nf-core/tools/pull/3900)) ### Template From 0fa71ea9d6c586cc769a17065dcb6bb3720ac9af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Rahn?= <1529364+rrahn@users.noreply.github.com> Date: Wed, 12 Nov 2025 12:24:05 +0100 Subject: [PATCH 3/3] Remove GITHUB_TOKEN from pytest workflow Removed GITHUB_TOKEN from pytest environment since it is already present on workflow level. --- .github/workflows/pytest.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index e7b43be2c3..fed3698f36 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -101,8 +101,6 @@ jobs: - name: Test with pytest id: pytest - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | python3 -m pytest tests/${{matrix.test}} --color=yes --cov --cov-config=.coveragerc --durations=0 -n auto && exit_code=0|| exit_code=$? # don't fail if no tests were collected, e.g. for test_licence.py