Skip to content

Add Google Flights price tracking with SerpApi and GitHub Actions - #2

Merged
hoangsvit merged 18 commits into
mainfrom
agent/live-flight-prices
Aug 20, 2026
Merged

Add Google Flights price tracking with SerpApi and GitHub Actions#2
hoangsvit merged 18 commits into
mainfrom
agent/live-flight-prices

Conversation

@hoangsvit

@hoangsvit hoangsvit commented Aug 19, 2026

Copy link
Copy Markdown
Member

Summary

Adds Google Flights price tracking through SerpApi + GitHub Actions, without Cloudflare or a separate backend.

What this PR adds

  • flights.html — mobile-friendly Google Flights price dashboard
  • scripts/fetch-flights.mjs — SerpApi Google Flights search/normalisation
  • .github/workflows/update-flight-prices.yml — scheduled GitHub Actions refresh
  • data/flights.json — latest snapshot consumed by the static site
  • data/flight-history.json — saved cheapest-price history
  • PR web preview links
  • PWA cache support for the flight page

Search configuration

  • 6 adults + 1 infant under 2 on lap
  • Economy
  • Direct or maximum 1 stop
  • SGN → Shanghai on 20 Oct 2026
  • Beijing → SGN on 25 Oct 2026, evening preferred
  • Beijing → SGN on 26 Oct 2026, morning preferred
  • Currency: VND

Google Flights / SerpApi flow

SerpApi multi-city selection is sequential. For each return-date scenario the fetcher:

  1. runs the initial multi-city search,
  2. selects a first-leg result with its departure_token,
  3. runs the next-leg search with that token,
  4. normalises the complete itinerary price and flight segments.

There are two return-date scenarios, therefore one refresh uses 4 SerpApi searches.

Flight dashboard features

  • direct comparison: return 25 Oct vs 26 Oct
  • Cheapest / Fastest sorting
  • Direct only / 1 stop filtering
  • airline filter
  • current total for the selected 7 travellers
  • rough total ÷ 7 reference value
  • change from previous check
  • lowest / highest saved prices
  • saved price trend chart
  • stale/fresh data indicator
  • browser-local target price
  • manual “Check now” shortcut to GitHub Actions
  • optional GitHub Issue price alert
  • Verify link back to Google Flights

API setup

Add this repository Actions secret after merge:

SERPAPI_API_KEY=<your private SerpApi key>

The key is only read by GitHub Actions and is never written to the generated JSON or browser code.

Optional automatic price alert

Repository Actions variables:

  • FLIGHT_ALERT_AMOUNT — e.g. 30000000
  • FLIGHT_ALERT_CURRENCY — e.g. VND (optional)

When the current cheapest total is at or below the target, the workflow opens/updates a GitHub Issue named ✈️ Flight price alert · China 2026. When the price moves back above the target, that issue is closed.

Refresh schedule

Automatically at approximately 07:17 Asia/Ho_Chi_Minh once per day, plus manual workflow_dispatch.

With 4 searches per refresh, 30 scheduled days use about 120 SerpApi searches, leaving room for manual checks within the current 250-search free plan.

Preview

The PR preview workflow posts browser links for both the travel dashboard and flights.html and updates them on every commit.

Until SERPAPI_API_KEY is configured and the workflow is run from main, the preview intentionally displays the setup-required state rather than fake prices.

Price note

These are Google Flights search snapshots, not locked fares. Baggage, card or other optional fees may apply, and the final itinerary/price should be verified before payment.

@github-actions

github-actions Bot commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

🌍 Web preview

Preview is pinned to commit c35b518 and updates automatically when the PR changes.

@coderabbitai

coderabbitai Bot commented Aug 19, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 8913213a-2c9f-439d-9b23-ea664fed3089


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@hoangsvit
hoangsvit marked this pull request as ready for review August 19, 2026 23:39
@qodo-code-review

Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

Copy link
Copy Markdown
Member Author

✅ Fixed the PR merge conflict by syncing the latest main into agent/live-flight-prices while preserving the flight-price changes.

  • Branch is now 0 commits behind main.
  • GitHub reports the PR as mergeable.
  • PR Preview reran successfully on commit df24228.
  • Preview links were refreshed automatically.

No flight-price feature code was dropped during the sync.

@hoangsvit hoangsvit changed the title Add live flight price tracking with GitHub Actions Add Google Flights price tracking with SerpApi and GitHub Actions Aug 20, 2026

@hoangsvit hoangsvit left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Switched the flight-price provider from Duffel to SerpApi Google Flights.

Validation completed:

  • PR remains mergeable.
  • PR Preview passed on c35b518.
  • Secret is now SERPAPI_API_KEY.
  • Search configuration remains 6 adults + 1 infant on lap, Economy, max 1 stop, return 25/26 Oct.
  • Multi-city search follows SerpApi's departure_token flow.
  • Auto refresh is now once daily at ~07:17 Asia/Ho_Chi_Minh to keep scheduled usage around 120 searches/month (4 searches per refresh).

No live/fake price is committed before the SerpApi key is configured and the workflow is run.

@hoangsvit
hoangsvit merged commit dbbc9e2 into main Aug 20, 2026
2 checks passed
@hoangsvit
hoangsvit deleted the agent/live-flight-prices branch August 20, 2026 16:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant