Fix
GitHub Actions IP blocked on a sports data cron: fix
Short answer: a hosted CI runner sends requests from a shared cloud address range, and many sites limit or refuse that range, so a script that works on your laptop fails with 403 or 429 in a scheduled workflow. Do not fight the block. Call a licensed API that authenticates by key, not by address.
The symptoms
The pattern is almost always the same. You write a script that pulls standings, a schedule or a box score from a stats site. It runs perfectly on your machine, so you wrap it in a scheduled workflow and push. The first run fails. The log shows one of these:
- An HTTP 403 with a short body about access being denied.
- An HTTP 429 on the very first request, even though the job made only one call.
- An HTTP 200 whose body is not the table you expected, but a page asking the visitor to prove they are human.
- A connection that hangs until the step times out, with no response at all.
- A job that passes on Monday, fails on Tuesday and passes again on Thursday, with no code change.
The last one is the most confusing, and it points at the cause. Nothing in your code changed. What changed is which machine in which address range handled the run.
Why it happens
A hosted runner is a short-lived virtual machine in a cloud datacenter. Each run starts on a fresh machine, and the outbound address comes from a large pool shared with every other workflow on the platform. The platform publishes those ranges, and so do the other big cloud providers, which means anyone running a website can look up whether a request came from a datacenter or from a home connection. For GitHub-hosted runners the ranges are exposed through the platform's meta API under the actions key, and the documentation warns that its example values are not current.
Site operators care about this because most automated traffic comes from cloud ranges, not from homes. A site that serves a few thousand fans a day can be knocked over by one badly written loop running on a rented machine, and some of that traffic is hostile. So operators often score a datacenter address as higher risk, apply a lower rate limit to it, or ask it for a challenge before serving content. That is a policy decision, and it is theirs to make. A stats site owes you nothing, and its terms of use may forbid automated collection altogether.
There are three separate effects, and it helps to tell them apart:
- Reputation. The range itself is treated as automated traffic, so you are limited before you send anything.
- Shared budget. Thousands of other jobs leave the same range, so a per-address rate limit is spent by strangers before your request arrives.
- Instability. The address is different on each run, so nobody can allowlist it, and a block that clears today returns tomorrow.
None of this is a bug in your workflow. It is a mismatch between a free web page built for people and a job that wants the same data every hour from a machine nobody can identify.
What you can legitimately do
Before you change anything, read the site's terms of use and its robots file. If they forbid automated access, stop there. The data is not yours to take, and no technical trick changes that.
If the site allows automation, a few honest steps reduce load and failures:
- Cache. Store each response and reuse it until it is stale. A standings table that updates once a night does not need an hourly fetch.
- Back off. On a 429 or a 5xx, wait and retry with a growing delay, and honor any Retry-After header. Never loop tightly.
- Fetch less. Ask for one date or one team, not a season.
- Ask. Many operators will give a key, a feed or an allowlist entry to a project that writes to them and explains what it needs.
What we will not recommend is the arms race: rotating addresses through proxy pools, disguising the client or defeating a challenge page. It breaks a site's rules, it is fragile, and it turns a data task into a permanent maintenance job. If a site has decided that automated traffic from a cloud range is unwelcome, the answer is to get the data from someone who is licensed to provide it.
The fix: call a licensed API
An API authenticates the caller with a key. The address you come from does not matter, so a hosted runner, a laptop and a production server are treated the same. The data is served under terms that allow automated use and let you store it and build products on what you derive from it.
SportsDataHQ serves hockey, football, basketball, baseball and soccer through one key family. Here is a cron-safe client in Python with no third-party packages. It caches responses on disk for 15 minutes, backs off on 429 and 5xx, and reads the key from an environment variable.
import hashlib, json, os, pathlib, time, urllib.error, urllib.request
BASE = "https://mcp.puckapi.com/v1"
CACHE = pathlib.Path(".cache")
CACHE.mkdir(exist_ok=True)
def call(tool, body, ttl=900, retries=4):
"""POST one tool call. Serve a fresh cache hit; back off on 429 and 5xx."""
name = hashlib.sha1(json.dumps([tool, body], sort_keys=True).encode()).hexdigest()[:16]
path = CACHE / f"{name}.json"
if path.exists() and time.time() - path.stat().st_mtime < ttl:
return json.loads(path.read_text())
req = urllib.request.Request(
f"{BASE}/{tool}", data=json.dumps(body).encode(),
headers={"Content-Type": "application/json", "x-api-key": os.environ["SDHQ_KEY"]})
for attempt in range(retries):
try:
with urllib.request.urlopen(req, timeout=30) as resp:
data = json.load(resp)["data"]
path.write_text(json.dumps(data))
return data
except urllib.error.HTTPError as err:
if err.code not in (429, 500, 502, 503, 504) or attempt == retries - 1:
raise
time.sleep(float(err.headers.get("Retry-After", 2 ** attempt)))
if __name__ == "__main__":
table = call("get_standings", {})
top = table["standings"][:3]
print(len(table["standings"]), "teams;", [(t["teamAbbrev"], t["points"]) for t in top])
again = call("get_standings", {}) # served from .cache, no credits
print("second call from cache:", again == table)On the verified run this printed 32 teams; [('MIN', 48), ('CAR', 47), ('NJD', 44)] and then second call from cache: True. The first call cost 2 credits and the second cost nothing, because it never left the machine.
The workflow file
The scheduled workflow is plain. Store the key as a repository secret, restore the cache between runs, and run the script on a timer. Note that the schedule is in UTC and that the platform may delay scheduled runs at busy times, so do not build anything that needs a to-the-minute start.
name: nightly-standings
on:
schedule:
- cron: "15 9 * * *"
workflow_dispatch:
jobs:
pull:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: .cache
key: standings-${{ github.run_id }}
restore-keys: standings-
- run: python3 pull.py
env:
SDHQ_KEY: ${{ secrets.SDHQ_KEY }}The YAML above was not run on a hosted runner for this page, only checked for shape. The Python it calls was run, and the same request works from any address because it carries a key.
Other sports, same pattern
The call shape is identical across brands. Swap the host and the tool name and keep the key header. Football standings for season 2026 return 32 teams from mcp.endzoneapi.com, basketball standings for season 2027 return 30 teams from mcp.dunkapi.com, and soccer standings for the Premier League return 20 clubs from mcp.strikerapi.com. Remember that season labels differ by sport, so read the season note on each tool before you schedule a job that spans more than one.
When not to use this
- You need a page that is not data. Articles, photos and commentary are not in the API.
- The site gave you a feed or an allowlist. If the operator has given you a supported route, use it and keep your own cache.
- You need odds as a raw feed to resell. The terms let you store data and build products on what you derive, but not redistribute the data or odds as a dataset or API of your own.
- You want a pick. Prices come back as information about the market. No tool recommends a wager.
Try it
- Get a free key: 1,000 credits a month, no card.
- Skip the cron and download a data package if you want a full season in a file.
FAQ
Why does my sports data script work locally but fail in GitHub Actions?
Your laptop uses a home or office address. A hosted runner uses a shared cloud address range that is published and well known. Many sites limit or refuse traffic from those ranges because most automated load comes from them, and the runner's address also changes between runs.
Can I allowlist GitHub Actions runner IPs on the data side?
Only if you control the server. Hosted runners come from large shared ranges that change, so an allowlist is brittle and lets in every other job on the platform. With an API key you authenticate the caller instead of the address, which works from any runner.
Does the SportsDataHQ API care which IP my workflow runs from?
No. Requests are authenticated with an x-api-key header, so a hosted runner, a laptop and a server all behave the same. Usage is limited by credits, not by address. A call to get_standings costs 2 credits and returned 200 on the verification run.
Checked against the live API on 2026-12-06. Questions: hello@sportsdatahq.com.