Skip to content

Commit e62110a

Browse files
authored
Merge pull request #379 from tannewt/fix_ratelimit_header
Fix update bundles
2 parents c321d22 + 03f581e commit e62110a

File tree

6 files changed

+12
-17
lines changed

6 files changed

+12
-17
lines changed

.github/workflows/bundle_cron.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ name: Update Bundles
77
on:
88
schedule:
99
- cron: 0 5 * * *
10+
workflow_dispatch:
1011

1112
jobs:
1213
check-repo-owner:
@@ -50,7 +51,6 @@ jobs:
5051
ADABOT_EMAIL: ${{ secrets.ADABOT_EMAIL }}
5152
ADABOT_GITHUB_USER: ${{ secrets.ADABOT_GITHUB_USER }}
5253
ADABOT_GITHUB_ACCESS_TOKEN: ${{ secrets.ADABOT_GITHUB_ACCESS_TOKEN }}
53-
REDIS_PORT: ${{ job.services.redis.ports[6379] }}
5454
BIGQUERY_PRIVATE_KEY: ${{ secrets.BIGQUERY_PRIVATE_KEY }}
5555
BIGQUERY_CLIENT_EMAIL: ${{ secrets.BIGQUERY_CLIENT_EMAIL }}
5656
run: |

.github/workflows/pre-commit.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ jobs:
1010
pre-commit:
1111
runs-on: ubuntu-latest
1212
steps:
13-
- name: Set up Python 3.9
13+
- name: Set up Python 3
1414
uses: actions/setup-python@v4
1515
with:
16-
python-version: 3.9
16+
python-version: 3
1717
- name: Versions
1818
run: |
1919
python3 --version

.github/workflows/test.yml

+2-9
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,11 @@ jobs:
2424
# Its necessary to do this here, since 'schedule' events cannot (currently)
2525
# be limited (they run on all forks' default branches).
2626
if: startswith(github.repository, 'adafruit/')
27-
services:
28-
redis:
29-
image: redis
30-
ports:
31-
- 6379/tcp
32-
options: --entrypoint redis-server
3327
steps:
34-
- name: Set up Python 3.9
28+
- name: Set up Python
3529
uses: actions/setup-python@v4
3630
with:
37-
python-version: 3.9
31+
python-version: 3
3832
- name: Versions
3933
run: |
4034
python3 --version
@@ -50,6 +44,5 @@ jobs:
5044
ADABOT_GITHUB_USER: ${{ secrets.ADABOT_GITHUB_USER }}
5145
ADABOT_GITHUB_ACCESS_TOKEN: ${{ secrets.ADABOT_GITHUB_ACCESS_TOKEN }}
5246
RTD_TOKEN: ${{ secrets.RTD_TOKEN }}
53-
REDIS_PORT: ${{ job.services.redis.ports[6379] }}
5447
run: |
5548
python3 -u -m pytest

adabot/arduino_libraries.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -322,8 +322,8 @@ def main(verbosity=1, output_file=None): # pylint: disable=missing-function-doc
322322
run_arduino_lib_checks()
323323
except:
324324
_, exc_val, exc_tb = sys.exc_info()
325-
logger.error("Exception Occurred!", quiet=True)
326-
logger.error(("-" * 60), quiet=True)
325+
logger.error("Exception Occurred!")
326+
logger.error(("-" * 60))
327327
logger.error("Traceback (most recent call last):")
328328
trace = traceback.format_tb(exc_tb)
329329
for line in trace:

adabot/circuitpython_bundle.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525

2626
BUNDLES = ["Adafruit_CircuitPython_Bundle", "CircuitPython_Community_Bundle"]
2727

28+
CONTRIBUTOR_CACHE = {}
29+
2830

2931
def fetch_bundle(bundle, bundle_path):
3032
"""Clones `bundle` to `bundle_path`"""
@@ -549,8 +551,6 @@ def new_release(bundle, bundle_path):
549551
contributor_cache_fn = pathlib.Path("contributors.json").resolve()
550552
if contributor_cache_fn.exists():
551553
CONTRIBUTOR_CACHE = json.loads(contributor_cache_fn.read_text())
552-
else:
553-
CONTRIBUTOR_CACHE = {}
554554

555555
bundles_dir = os.path.abspath(".bundles")
556556
if "GITHUB_WORKSPACE" in os.environ:

adabot/github_requests.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,9 @@ def request(method, url, **kwargs):
6464
_fix_url(url), timeout=TIMEOUT, **_fix_kwargs(kwargs)
6565
)
6666
from_cache = getattr(response, "from_cache", False)
67-
remaining = int(response.headers.get("X-RateLimit-Remaining", 0))
67+
# If rate limit remaining is missing, then assume we're fine. Use a million to signify this
68+
# case. GitHub will be in the single thousands.
69+
remaining = int(response.headers.get("X-RateLimit-Remaining", 1000000))
6870
logging.debug(
6971
"GET %s %s status=%s",
7072
url,

0 commit comments

Comments
 (0)