Skip to content

Commit

Permalink
Generate DB and keep it in repo
Browse files Browse the repository at this point in the history
  • Loading branch information
vincecima committed May 13, 2024
1 parent 39bc007 commit dbbc95e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .github/workflows/ingest-json-api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,6 @@ jobs:
version: '0.33.0'
- name: Install dependencies
run: rye sync --no-lock
- uses: jorgebg/[email protected]
- name: Upsert data from Formula JSON API
run: rye run ingest-json-api formula .state/feed.db 'https://formulae.brew.sh/api/formula.json'
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Github Action state location
.state/

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
Expand Down
2 changes: 1 addition & 1 deletion src/homebrew_new_bot/ingest_json_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def main() -> None:
table = typing.cast(sqlite_utils.db.Table, db["feed_items"])
# Get JSON from API endpoint
# TODO: use latest added_at from DB and HEAD to check if its even worth getting full thing?
r = requests.get("https://formulae.brew.sh/api/formula.json")
r = requests.get(args.json_api_url)
last_modified = email.utils.parsedate_to_datetime(r.headers["last-modified"])
# TODO: is there a shorter syntax to do this?
packages = list(
Expand Down

0 comments on commit dbbc95e

Please sign in to comment.