Skip to content

Instantly share code, notes, and snippets.

@rascode
Created July 30, 2013 12:56
Show Gist options
  • Save rascode/6112652 to your computer and use it in GitHub Desktop.
Save rascode/6112652 to your computer and use it in GitHub Desktop.
Pull Github issues from the specified repository and add them to the spreadsheet.
//Fetch Github Issues Using the YouTube API
function getGdlEvents(){
var channelID = "UC_x5XG1OV2P6uZZ5FSM9Ttw";
var yt = "https://www.googleapis.com/youtube/v3/activities";
var part = "snippet";
var maxResults = "50";
var key = "Your Google API Key";
var url = yt + "?part=" + part + "&channelId=" + channelID + "&maxResults=" + maxResults + "&key=" + key;
var data = JSON.parse(UrlFetchApp.fetch(url).getContentText());
return data;
}
//Loop through each event adding to Calendar
function createCalendarEvents(data){
var cal = CalendarApp.createCalendar("GDL");
events = data.items;
for (i in events){
var event = events[i].snippet;
var title = event.title;
var published = event.publishedAt;
var description = event.description;
cal.createEvent(title, new Date(published), new Date(published));
}
}
//Fetch GDL's and add them to the GDL Calendar
function addEventsToCalendar(){
var data = getGdlEvents();
createCalendarEvents(data);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment