gcal-sync
🔄 add an one way synchronization from github commits to google calendar and track your progress effortlessly.
AI Summary
gcal-sync
A Google Apps Script library that performs one-way synchronization of GitHub commits to Google Calendar.
Target Users
Beginner-to-intermediate GAS users who use GitHub and want to visualize coding time or automate internal tooling.
Problems Solved
Eliminates the manual effort and omissions involved in putting GitHub activity into a calendar.
Tags
Main Features
Automatic commit-to-event conversion
Runs every 5 minutes via a trigger, fetches commits through the GitHub API, and inserts/updates events in the designated calendar.
Serverless operation
Works entirely on Google Apps Script, allowing configuration and maintenance in the browser without any external servers or CI.
Notifications & manual sync URL
Provides daily summary and error emails plus a Web-app URL that lets you trigger sync on demand.
Usage Examples
Minimal setup to sync GitHub commits to Google Calendar
// 1. User-specific configuration
function getConfigs() {
return {
settings: {
sync_function: 'sync', // Function executed by the time-based trigger
update_frequency: 5 // Sync interval in minutes (must be 5*n)
},
github_sync: {
username: 'your-github-id', // Your GitHub user name
commits_configs: {
should_sync: true,
commits_calendar: 'gh_commits' // Target calendar ID (leave default if unsure)
}
}
};
}
// 2. Load the library and create an instance
function getGcalSync() {
const version = '2.0.0';
const code = UrlFetchApp.fetch(`https://cdn.jsdelivr.net/npm/gcal-sync@${version}`).getContentText();
eval(code); // Make GcalSync class available
return new GcalSync(getConfigs());
}
// 3. Run once to create a 5-minute trigger
function install() {
getGcalSync().install(); // Adds time-based trigger internally
}
// 4. Triggered function that performs the sync
function sync() {
const gs = getGcalSync();
try {
gs.sync(); // Add/update events for new commits
} catch (e) {
gs.handleError(e); // Optional email notification
}
}
Paste the code into a new Apps Script project, run install
once, and every 5 minutes your GitHub commits will appear as events in Google Calendar.