Enhancing Data Sync with GitHub Contributions in Laravel

The devlog-ist/landing project surfaces developer activity. We've enhanced the synchronization of data by integrating a GitHub contribution calendar. This provides a more accurate and real-time view of user contributions. Instead of relying solely on local commit data, the system now uses GitHub's public contributions page as a primary source.

The system employs a three-tiered approach: it first checks a cached contribution calendar from the user's profile for instant access. If that's unavailable, it fetches data directly from GitHub's public contributions page. As a last resort, it falls back to the local commits table. A 5-minute cache is implemented to prevent excessive HTTP calls. Failures during fetching or caching are logged for monitoring.

Translations have been updated to reflect "contributions" instead of "commits" across multiple languages. Unit tests have been added to validate the profile cache, live data fetching, date filtering, and cache TTL functionality. This ensures the reliability and accuracy of the displayed data.

Check the full article for more details on how we optimized the synchronization process!

Gerardo Ruiz

Gerardo Ruiz

Author

Share: