From a6751d0253e8615bca842ce8a6d67dc2e4b485f7 Mon Sep 17 00:00:00 2001 From: Noor Syed Date: Thu, 29 Aug 2024 10:33:38 -0400 Subject: [PATCH] commit to pages --- .github/workflows/run.yml | 10 ++++++++++ backend/gmaps_driver.py | 2 ++ 2 files changed, 12 insertions(+) diff --git a/.github/workflows/run.yml b/.github/workflows/run.yml index f73aaa6..ed0ebc5 100644 --- a/.github/workflows/run.yml +++ b/.github/workflows/run.yml @@ -26,3 +26,13 @@ jobs: GMAPS_CACHE_FILEPATH: ${{ secrets.GMAPS_CACHE_FILEPATH }} GMAPS_API_KEY: ${{ secrets.GMAPS_API_KEY }} run: python backend/main.py + - name: Commit and push if content changed + run: |- + git config user.name "Automated" + git config user.email "actions@users.noreply.github.com" + git add -A + timestamp=$(date -u) + git commit -m "Latest data: ${timestamp}" || exit 0 + git checkout pages + git checkout main -- locations.json + git push diff --git a/backend/gmaps_driver.py b/backend/gmaps_driver.py index ceaa187..54717b5 100644 --- a/backend/gmaps_driver.py +++ b/backend/gmaps_driver.py @@ -14,6 +14,8 @@ def format_key(self, name, address): return re.sub(r'\(.*?\)', '', f"{name} {address}").strip() def geocode(self, name, address): + if address.startswith("www."): + raise Exception(f"invalid address:{address}") key = self.format_key(name, address) if key in self.gmaps_cache: print("geocode cache hit: ", key)