{"size": 67315, "ext": "js", "max_stars_repo_path": "Code/github.js", "max_stars_repo_name": "bcgov/issue-aggregator", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "Code/github.js", "max_issues_repo_name": "bcgov/issue-aggregator", "max_issues_repo_issues_event_min_datetime": "2016-06-09T22:51:29.000Z", "max_issues_repo_issues_event_max_datetime": "2022-01-10T20:59:00.000Z", "max_forks_repo_path": "Code/github.js", "max_forks_repo_name": "bcgov/issue-aggregator", "max_forks_repo_forks_event_min_datetime": "2016-04-19T23:19:50.000Z", "max_forks_repo_forks_event_max_datetime": "2016-04-19T23:19:50.000Z"}
{"max_stars_count": null, "max_issues_count": 7, "max_forks_count": 1, "avg_line_length": 400.6845238095, "max_line_length": 51415, "alphanum_fraction": 0.6604025849}
var Q = require("q");
var https = require("https");

var kanboard = null;
var testing = true;

var github = {
	kanboardImport: function(owner, repo, openIssues, sprintIssues, blockedIssues, closedIssues) {
		console.log("kanboardImport")

		kanboard.createProject(owner + "/" + repo)
			.then((res) => {
				var projectID = res.result;
				kanboard.removeAllColumns(projectID)
					.then(() => {
						//kanboard.addColumns(projectID, board.lists.map(column => column.name));
						var columns = [
							{
								name: "Open",
								issues: openIssues
							}, {
								name: "In Progress",
								issues: sprintIssues
							}, {
								name: "Blocked",
								issues: blockedIssues
							}, {
								name: "Closed",
								issues: closedIssues
							}
						];

						var resolvedDeferred = Q.defer();
						var lastPromise = resolvedDeferred.promise;
						resolvedDeferred.resolve();

						columns.forEach(function (column) {
							var deferred = Q.defer();

							lastPromise.then(() => {
								kanboard.addColumn(projectID, column.name).then((res) => {
									var columnID = res.result;
									column.issues.forEach((issue) => kanboard.createTask(projectID, columnID, issue.title));
								});

								setTimeout(() => deferred.resolve(), 5000);
							});

							lastPromise = deferred.promise;
						});
					});
			});
	},

	getMilestones: function(owner, repo) {
		console.log("getMilestones: " + owner + " " + repo)
		var deferred = Q.defer();

		var options = {
			hostname: "api.github.com",
			path: `/repos/${owner}/${repo}/milestones`,
			method: "GET",
			headers: {
				"User-Agent": "Filoni"
			}
		};

		if (!testing) {
			var req = https.request(options, (response) => {
				response.setEncoding("utf8");

				var body = "";
				response.on("data", (d) => {
					body += d;
				});
				response.on("end", () => {
					var milestones = JSON.parse(body);
					//getCards(board);
					deferred.resolve(milestones);
				})
			});

			req.on('error', function(err) {
				//if an error occurs reject the deferred
				deferred.reject(err);
			});

			req.end();
		} else {
			deferred.resolve([  {    "url": "https://api.github.com/repos/BCDevExchange/BCDevExchange-app/milestones/7",    "html_url": "https://github.com/BCDevExchange/BCDevExchange-app/milestones/Sprint%2014",    "labels_url": "https://api.github.com/repos/BCDevExchange/BCDevExchange-app/milestones/7/labels",    "id": 1353555,    "number": 7,    "title": "Sprint 14",    "description": "",    "creator": {      "login": "kelpisland",      "id": 9368818,      "avatar_url": "https://avatars.githubusercontent.com/u/9368818?v=3",      "gravatar_id": "",      "url": "https://api.github.com/users/kelpisland",      "html_url": "https://github.com/kelpisland",      "followers_url": "https://api.github.com/users/kelpisland/followers",      "following_url": "https://api.github.com/users/kelpisland/following{/other_user}",      "gists_url": "https://api.github.com/users/kelpisland/gists{/gist_id}",      "starred_url": "https://api.github.com/users/kelpisland/starred{/owner}{/repo}",      "subscriptions_url": "https://api.github.com/users/kelpisland/subscriptions",      "organizations_url": "https://api.github.com/users/kelpisland/orgs",      "repos_url": "https://api.github.com/users/kelpisland/repos",      "events_url": "https://api.github.com/users/kelpisland/events{/privacy}",      "received_events_url": "https://api.github.com/users/kelpisland/received_events",      "type": "User",      "site_admin": false    },    "open_issues": 0,    "closed_issues": 8,    "state": "open",    "created_at": "2015-10-13T16:41:22Z",    "updated_at": "2016-01-06T17:58:42Z",    "due_on": null,    "closed_at": null  },  {    "url": "https://api.github.com/repos/BCDevExchange/BCDevExchange-app/milestones/5",    "html_url": "https://github.com/BCDevExchange/BCDevExchange-app/milestones/Sprint%2013",    "labels_url": "https://api.github.com/repos/BCDevExchange/BCDevExchange-app/milestones/5/labels",    "id": 1318835,    "number": 5,    "title": "Sprint 13",    "description": "",    "creator": {      "login": "kelpisland",      "id": 9368818,      "avatar_url": "https://avatars.githubusercontent.com/u/9368818?v=3",      "gravatar_id": "",      "url": "https://api.github.com/users/kelpisland",      "html_url": "https://github.com/kelpisland",      "followers_url": "https://api.github.com/users/kelpisland/followers",      "following_url": "https://api.github.com/users/kelpisland/following{/other_user}",      "gists_url": "https://api.github.com/users/kelpisland/gists{/gist_id}",      "starred_url": "https://api.github.com/users/kelpisland/starred{/owner}{/repo}",      "subscriptions_url": "https://api.github.com/users/kelpisland/subscriptions",      "organizations_url": "https://api.github.com/users/kelpisland/orgs",      "repos_url": "https://api.github.com/users/kelpisland/repos",      "events_url": "https://api.github.com/users/kelpisland/events{/privacy}",      "received_events_url": "https://api.github.com/users/kelpisland/received_events",      "type": "User",      "site_admin": false    },    "open_issues": 0,    "closed_issues": 0,    "state": "open",    "created_at": "2015-09-22T17:15:12Z",    "updated_at": "2015-09-22T17:15:12Z",    "due_on": null,    "closed_at": null  },  {    "url": "https://api.github.com/repos/BCDevExchange/BCDevExchange-app/milestones/8",    "html_url": "https://github.com/BCDevExchange/BCDevExchange-app/milestones/Sprint%2015",    "labels_url": "https://api.github.com/repos/BCDevExchange/BCDevExchange-app/milestones/8/labels",    "id": 1392544,    "number": 8,    "title": "Sprint 15",    "description": "",    "creator": {      "login": "paulroberts68",      "id": 11237533,      "avatar_url": "https://avatars.githubusercontent.com/u/11237533?v=3",      "gravatar_id": "",      "url": "https://api.github.com/users/paulroberts68",      "html_url": "https://github.com/paulroberts68",      "followers_url": "https://api.github.com/users/paulroberts68/followers",      "following_url": "https://api.github.com/users/paulroberts68/following{/other_user}",      "gists_url": "https://api.github.com/users/paulroberts68/gists{/gist_id}",      "starred_url": "https://api.github.com/users/paulroberts68/starred{/owner}{/repo}",      "subscriptions_url": "https://api.github.com/users/paulroberts68/subscriptions",      "organizations_url": "https://api.github.com/users/paulroberts68/orgs",      "repos_url": "https://api.github.com/users/paulroberts68/repos",      "events_url": "https://api.github.com/users/paulroberts68/events{/privacy}",      "received_events_url": "https://api.github.com/users/paulroberts68/received_events",      "type": "User",      "site_admin": false    },    "open_issues": 1,    "closed_issues": 3,    "state": "open",    "created_at": "2015-11-03T23:20:46Z",    "updated_at": "2016-02-10T21:53:51Z",    "due_on": "2015-11-25T08:00:00Z",    "closed_at": null  },  {    "url": "https://api.github.com/repos/BCDevExchange/BCDevExchange-app/milestones/9",    "html_url": "https://github.com/BCDevExchange/BCDevExchange-app/milestones/Sprint%2016",    "labels_url": "https://api.github.com/repos/BCDevExchange/BCDevExchange-app/milestones/9/labels",    "id": 1432730,    "number": 9,    "title": "Sprint 16",    "description": "",    "creator": {      "login": "karsmith",      "id": 15617404,      "avatar_url": "https://avatars.githubusercontent.com/u/15617404?v=3",      "gravatar_id": "",      "url": "https://api.github.com/users/karsmith",      "html_url": "https://github.com/karsmith",      "followers_url": "https://api.github.com/users/karsmith/followers",      "following_url": "https://api.github.com/users/karsmith/following{/other_user}",      "gists_url": "https://api.github.com/users/karsmith/gists{/gist_id}",      "starred_url": "https://api.github.com/users/karsmith/starred{/owner}{/repo}",      "subscriptions_url": "https://api.github.com/users/karsmith/subscriptions",      "organizations_url": "https://api.github.com/users/karsmith/orgs",      "repos_url": "https://api.github.com/users/karsmith/repos",      "events_url": "https://api.github.com/users/karsmith/events{/privacy}",      "received_events_url": "https://api.github.com/users/karsmith/received_events",      "type": "User",      "site_admin": false    },    "open_issues": 1,    "closed_issues": 14,    "state": "open",    "created_at": "2015-11-27T17:06:06Z",    "updated_at": "2016-02-10T22:52:14Z",    "due_on": "2015-12-18T08:00:00Z",    "closed_at": null  },  {    "url": "https://api.github.com/repos/BCDevExchange/BCDevExchange-app/milestones/10",    "html_url": "https://github.com/BCDevExchange/BCDevExchange-app/milestones/Sprint%2017",    "labels_url": "https://api.github.com/repos/BCDevExchange/BCDevExchange-app/milestones/10/labels",    "id": 1490161,    "number": 10,    "title": "Sprint 17",    "description": "",    "creator": {      "login": "karsmith",      "id": 15617404,      "avatar_url": "https://avatars.githubusercontent.com/u/15617404?v=3",      "gravatar_id": "",      "url": "https://api.github.com/users/karsmith",      "html_url": "https://github.com/karsmith",      "followers_url": "https://api.github.com/users/karsmith/followers",      "following_url": "https://api.github.com/users/karsmith/following{/other_user}",      "gists_url": "https://api.github.com/users/karsmith/gists{/gist_id}",      "starred_url": "https://api.github.com/users/karsmith/starred{/owner}{/repo}",      "subscriptions_url": "https://api.github.com/users/karsmith/subscriptions",      "organizations_url": "https://api.github.com/users/karsmith/orgs",      "repos_url": "https://api.github.com/users/karsmith/repos",      "events_url": "https://api.github.com/users/karsmith/events{/privacy}",      "received_events_url": "https://api.github.com/users/karsmith/received_events",      "type": "User",      "site_admin": false    },    "open_issues": 0,    "closed_issues": 25,    "state": "open",    "created_at": "2016-01-07T19:05:10Z",    "updated_at": "2016-02-10T22:12:51Z",    "due_on": "2016-01-17T08:00:00Z",    "closed_at": null  },  {    "url": "https://api.github.com/repos/BCDevExchange/BCDevExchange-app/milestones/19",    "html_url": "https://github.com/BCDevExchange/BCDevExchange-app/milestones/Sprint%2020",    "labels_url": "https://api.github.com/repos/BCDevExchange/BCDevExchange-app/milestones/19/labels",    "id": 1612530,    "number": 19,    "title": "Sprint 20",    "description": "",    "creator": {      "login": "paulroberts68",      "id": 11237533,      "avatar_url": "https://avatars.githubusercontent.com/u/11237533?v=3",      "gravatar_id": "",      "url": "https://api.github.com/users/paulroberts68",      "html_url": "https://github.com/paulroberts68",      "followers_url": "https://api.github.com/users/paulroberts68/followers",      "following_url": "https://api.github.com/users/paulroberts68/following{/other_user}",      "gists_url": "https://api.github.com/users/paulroberts68/gists{/gist_id}",      "starred_url": "https://api.github.com/users/paulroberts68/starred{/owner}{/repo}",      "subscriptions_url": "https://api.github.com/users/paulroberts68/subscriptions",      "organizations_url": "https://api.github.com/users/paulroberts68/orgs",      "repos_url": "https://api.github.com/users/paulroberts68/repos",      "events_url": "https://api.github.com/users/paulroberts68/events{/privacy}",      "received_events_url": "https://api.github.com/users/paulroberts68/received_events",      "type": "User",      "site_admin": false    },    "open_issues": 5,    "closed_issues": 1,    "state": "open",    "created_at": "2016-02-29T16:24:14Z",    "updated_at": "2016-03-09T19:05:00Z",    "due_on": "2016-03-16T07:00:00Z",    "closed_at": null  },  {    "url": "https://api.github.com/repos/BCDevExchange/BCDevExchange-app/milestones/20",    "html_url": "https://github.com/BCDevExchange/BCDevExchange-app/milestones/Sprint%2021",    "labels_url": "https://api.github.com/repos/BCDevExchange/BCDevExchange-app/milestones/20/labels",    "id": 1648609,    "number": 20,    "title": "Sprint 21",    "description": "End of fiscal sprint",    "creator": {      "login": "paulroberts68",      "id": 11237533,      "avatar_url": "https://avatars.githubusercontent.com/u/11237533?v=3",      "gravatar_id": "",      "url": "https://api.github.com/users/paulroberts68",      "html_url": "https://github.com/paulroberts68",      "followers_url": "https://api.github.com/users/paulroberts68/followers",      "following_url": "https://api.github.com/users/paulroberts68/following{/other_user}",      "gists_url": "https://api.github.com/users/paulroberts68/gists{/gist_id}",      "starred_url": "https://api.github.com/users/paulroberts68/starred{/owner}{/repo}",      "subscriptions_url": "https://api.github.com/users/paulroberts68/subscriptions",      "organizations_url": "https://api.github.com/users/paulroberts68/orgs",      "repos_url": "https://api.github.com/users/paulroberts68/repos",      "events_url": "https://api.github.com/users/paulroberts68/events{/privacy}",      "received_events_url": "https://api.github.com/users/paulroberts68/received_events",      "type": "User",      "site_admin": false    },    "open_issues": 0,    "closed_issues": 0,    "state": "open",    "created_at": "2016-03-16T17:58:12Z",    "updated_at": "2016-03-16T17:58:12Z",    "due_on": "2016-04-05T07:00:00Z",    "closed_at": null  }]);
		}

		return deferred.promise;
	},

	getIssues: function(owner, repo) {
		console.log("getIssues: " + owner + " " + repo)
		var deferred = Q.defer();

		var options = {
			hostname: "api.github.com",
			path: `/repos/${owner}/${repo}/issues?state=all`,
			method: "GET",
			headers: {
				"User-Agent": "Filoni"
			}
		};

		if (!testing) {
			var req = https.request(options, (response) => {
				response.setEncoding("utf8");

				var body = "";
				response.on("data", (d) => {
					body += d;
				});
				response.on("end", () => {
					var issues = JSON.parse(body);
					deferred.resolve(issues);
				})
			});

			req.on('error', function(err) {
				//if an error occurs reject the deferred
				deferred.reject(err);
			});

			req.end();
		} else {
			var issues = [{
				"url": "https://api.github.com/repos/BCDevExchange/BCDevExchange-app/issues/276",
				"repository_url": "https://api.github.com/repos/BCDevExchange/BCDevExchange-app",
				"labels_url": "https://api.github.com/repos/BCDevExchange/BCDevExchange-app/issues/276/labels{/name}",
				"comments_url": "https://api.github.com/repos/BCDevExchange/BCDevExchange-app/issues/276/comments",
				"events_url": "https://api.github.com/repos/BCDevExchange/BCDevExchange-app/issues/276/events",
				"html_url": "https://github.com/BCDevExchange/BCDevExchange-app/issues/276",
				"id": 137667692,
				"number": 276,    "title": "Open source decision matrix",    "user": {      "login": "DavidR8",      "id": 4622563,      "avatar_url": "https://avatars.githubusercontent.com/u/4622563?v=3",      "gravatar_id": "",      "url": "https://api.github.com/users/DavidR8",      "html_url": "https://github.com/DavidR8",      "followers_url": "https://api.github.com/users/DavidR8/followers",      "following_url": "https://api.github.com/users/DavidR8/following{/other_user}",      "gists_url": "https://api.github.com/users/DavidR8/gists{/gist_id}",      "starred_url": "https://api.github.com/users/DavidR8/starred{/owner}{/repo}",      "subscriptions_url": "https://api.github.com/users/DavidR8/subscriptions",      "organizations_url": "https://api.github.com/users/DavidR8/orgs",      "repos_url": "https://api.github.com/users/DavidR8/repos",      "events_url": "https://api.github.com/users/DavidR8/events{/privacy}",      "received_events_url": "https://api.github.com/users/DavidR8/received_events",      "type": "User",      "site_admin": false    },    "labels": [      {        "url": "https://api.github.com/repos/BCDevExchange/BCDevExchange-app/labels/Bulls%20Eye%20Center",        "name": "Bulls Eye Center",        "color": "fef2c0"      },      {        "url": "https://api.github.com/repos/BCDevExchange/BCDevExchange-app/labels/ready",        "name": "ready",        "color": "ededed"      },      {        "url": "https://api.github.com/repos/BCDevExchange/BCDevExchange-app/labels/Terms%20&%20Guides",        "name": "Terms & Guides",        "color": "fad8c7"      }    ],    "state": "open",    "locked": false,    "assignee": {      "login": "DavidR8",      "id": 4622563,      "avatar_url": "https://avatars.githubusercontent.com/u/4622563?v=3",      "gravatar_id": "",      "url": "https://api.github.com/users/DavidR8",      "html_url": "https://github.com/DavidR8",      "followers_url": "https://api.github.com/users/DavidR8/followers",      "following_url": "https://api.github.com/users/DavidR8/following{/other_user}",      "gists_url": "https://api.github.com/users/DavidR8/gists{/gist_id}",      "starred_url": "https://api.github.com/users/DavidR8/starred{/owner}{/repo}",      "subscriptions_url": "https://api.github.com/users/DavidR8/subscriptions",      "organizations_url": "https://api.github.com/users/DavidR8/orgs",      "repos_url": "https://api.github.com/users/DavidR8/repos",      "events_url": "https://api.github.com/users/DavidR8/events{/privacy}",      "received_events_url": "https://api.github.com/users/DavidR8/received_events",      "type": "User",      "site_admin": false    },    "milestone": null,    "comments": 0,    "created_at": "2016-03-01T19:45:01Z",    "updated_at": "2016-03-01T19:45:19Z",    "closed_at": null,    "body": "Create a decision matrix to guide the release of open source code."  },  {    "url": "https://api.github.com/repos/BCDevExchange/BCDevExchange-app/issues/275",    "repository_url": "https://api.github.com/repos/BCDevExchange/BCDevExchange-app",    "labels_url": "https://api.github.com/repos/BCDevExchange/BCDevExchange-app/issues/275/labels{/name}",    "comments_url": "https://api.github.com/repos/BCDevExchange/BCDevExchange-app/issues/275/comments",    "events_url": "https://api.github.com/repos/BCDevExchange/BCDevExchange-app/issues/275/events",    "html_url": "https://github.com/BCDevExchange/BCDevExchange-app/issues/275",    "id": 137667572,    "number": 275,    "title": "P4P CEWT",    "user": {      "login": "lmullane",      "id": 12040839,      "avatar_url": "https://avatars.githubusercontent.com/u/12040839?v=3",      "gravatar_id": "",      "url": "https://api.github.com/users/lmullane",      "html_url": "https://github.com/lmullane",      "followers_url": "https://api.github.com/users/lmullane/followers",      "following_url": "https://api.github.com/users/lmullane/following{/other_user}",      "gists_url": "https://api.github.com/users/lmullane/gists{/gist_id}",      "starred_url": "https://api.github.com/users/lmullane/starred{/owner}{/repo}",      "subscriptions_url": "https://api.github.com/users/lmullane/subscriptions",      "organizations_url": "https://api.github.com/users/lmullane/orgs",      "repos_url": "https://api.github.com/users/lmullane/repos",      "events_url": "https://api.github.com/users/lmullane/events{/privacy}",      "received_events_url": "https://api.github.com/users/lmullane/received_events",      "type": "User",      "site_admin": false    },    "labels": [      {        "url": "https://api.github.com/repos/BCDevExchange/BCDevExchange-app/labels/Account",        "name": "Account",        "color": "5319e7"      },      {        "url": "https://api.github.com/repos/BCDevExchange/BCDevExchange-app/labels/Blocked",        "name": "Blocked",        "color": "FF0000"      },      {        "url": "https://api.github.com/repos/BCDevExchange/BCDevExchange-app/labels/Bulls%20Eye%20Center",        "name": "Bulls Eye Center",        "color": "fef2c0"      },      {        "url": "https://api.github.com/repos/BCDevExchange/BCDevExchange-app/labels/P4P",        "name": "P4P",        "color": "fad8c7"      }    ],    "state": "open",    "locked": false,    "assignee": {      "login": "lmullane",      "id": 12040839,      "avatar_url": "https://avatars.githubusercontent.com/u/12040839?v=3",      "gravatar_id": "",      "url": "https://api.github.com/users/lmullane",      "html_url": "https://github.com/lmullane",      "followers_url": "https://api.github.com/users/lmullane/followers",      "following_url": "https://api.github.com/users/lmullane/following{/other_user}",      "gists_url": "https://api.github.com/users/lmullane/gists{/gist_id}",      "starred_url": "https://api.github.com/users/lmullane/starred{/owner}{/repo}",      "subscriptions_url": "https://api.github.com/users/lmullane/subscriptions",      "organizations_url": "https://api.github.com/users/lmullane/orgs",      "repos_url": "https://api.github.com/users/lmullane/repos",      "events_url": "https://api.github.com/users/lmullane/events{/privacy}",      "received_events_url": "https://api.github.com/users/lmullane/received_events",      "type": "User",      "site_admin": false    },    "milestone": {      "url": "https://api.github.com/repos/BCDevExchange/BCDevExchange-app/milestones/19",      "html_url": "https://github.com/BCDevExchange/BCDevExchange-app/milestones/Sprint%2020",      "labels_url": "https://api.github.com/repos/BCDevExchange/BCDevExchange-app/milestones/19/labels",      "id": 1612530,      "number": 19,      "title": "Sprint 20",      "description": "",      "creator": {        "login": "paulroberts68",        "id": 11237533,        "avatar_url": "https://avatars.githubusercontent.com/u/11237533?v=3",        "gravatar_id": "",        "url": "https://api.github.com/users/paulroberts68",        "html_url": "https://github.com/paulroberts68",        "followers_url": "https://api.github.com/users/paulroberts68/followers",        "following_url": "https://api.github.com/users/paulroberts68/following{/other_user}",        "gists_url": "https://api.github.com/users/paulroberts68/gists{/gist_id}",        "starred_url": "https://api.github.com/users/paulroberts68/starred{/owner}{/repo}",        "subscriptions_url": "https://api.github.com/users/paulroberts68/subscriptions",        "organizations_url": "https://api.github.com/users/paulroberts68/orgs",        "repos_url": "https://api.github.com/users/paulroberts68/repos",        "events_url": "https://api.github.com/users/paulroberts68/events{/privacy}",        "received_events_url": "https://api.github.com/users/paulroberts68/received_events",        "type": "User",        "site_admin": false      },      "open_issues": 5,      "closed_issues": 1,      "state": "open",      "created_at": "2016-02-29T16:24:14Z",      "updated_at": "2016-03-09T19:05:00Z",      "due_on": "2016-03-16T07:00:00Z",      "closed_at": null    },    "comments": 0,    "created_at": "2016-03-01T19:44:29Z",    "updated_at": "2016-03-15T16:53:51Z",    "closed_at": null,    "body": "As a the CEWT program area, I want to post P4P issues so I can get help to complete work in my backlog.\n\nDOD:\nPost issues"  },  {    "url": "https://api.github.com/repos/BCDevExchange/BCDevExchange-app/issues/273",    "repository_url": "https://api.github.com/repos/BCDevExchange/BCDevExchange-app",    "labels_url": "https://api.github.com/repos/BCDevExchange/BCDevExchange-app/issues/273/labels{/name}",    "comments_url": "https://api.github.com/repos/BCDevExchange/BCDevExchange-app/issues/273/comments",    "events_url": "https://api.github.com/repos/BCDevExchange/BCDevExchange-app/issues/273/events",    "html_url": "https://github.com/BCDevExchange/BCDevExchange-app/issues/273",    "id": 137667230,    "number": 273,    "title": "Design - Labs Partner",    "user": {      "login": "ragbay",      "id": 14844339,      "avatar_url": "https://avatars.githubusercontent.com/u/14844339?v=3",      "gravatar_id": "",      "url": "https://api.github.com/users/ragbay",      "html_url": "https://github.com/ragbay",      "followers_url": "https://api.github.com/users/ragbay/followers",      "following_url": "https://api.github.com/users/ragbay/following{/other_user}",      "gists_url": "https://api.github.com/users/ragbay/gists{/gist_id}",      "starred_url": "https://api.github.com/users/ragbay/starred{/owner}{/repo}",      "subscriptions_url": "https://api.github.com/users/ragbay/subscriptions",      "organizations_url": "https://api.github.com/users/ragbay/orgs",      "repos_url": "https://api.github.com/users/ragbay/repos",      "events_url": "https://api.github.com/users/ragbay/events{/privacy}",      "received_events_url": "https://api.github.com/users/ragbay/received_events",      "type": "User",      "site_admin": false    },    "labels": [      {        "url": "https://api.github.com/repos/BCDevExchange/BCDevExchange-app/labels/Bulls%20Eye%20Ring%202",        "name": "Bulls Eye Ring 2",        "color": "fef2c0"      },      {        "url": "https://api.github.com/repos/BCDevExchange/BCDevExchange-app/labels/in%20sprint",        "name": "in sprint",        "color": "ededed"      }    ],    "state": "open",    "locked": false,    "assignee": {      "login": "ragbay",      "id": 14844339,      "avatar_url": "https://avatars.githubusercontent.com/u/14844339?v=3",      "gravatar_id": "",      "url": "https://api.github.com/users/ragbay",      "html_url": "https://github.com/ragbay",      "followers_url": "https://api.github.com/users/ragbay/followers",      "following_url": "https://api.github.com/users/ragbay/following{/other_user}",      "gists_url": "https://api.github.com/users/ragbay/gists{/gist_id}",      "starred_url": "https://api.github.com/users/ragbay/starred{/owner}{/repo}",      "subscriptions_url": "https://api.github.com/users/ragbay/subscriptions",      "organizations_url": "https://api.github.com/users/ragbay/orgs",      "repos_url": "https://api.github.com/users/ragbay/repos",      "events_url": "https://api.github.com/users/ragbay/events{/privacy}",      "received_events_url": "https://api.github.com/users/ragbay/received_events",      "type": "User",      "site_admin": false    },    "milestone": {      "url": "https://api.github.com/repos/BCDevExchange/BCDevExchange-app/milestones/19",      "html_url": "https://github.com/BCDevExchange/BCDevExchange-app/milestones/Sprint%2020",      "labels_url": "https://api.github.com/repos/BCDevExchange/BCDevExchange-app/milestones/19/labels",      "id": 1612530,      "number": 19,      "title": "Sprint 20",      "description": "",      "creator": {        "login": "paulroberts68",        "id": 11237533,        "avatar_url": "https://avatars.githubusercontent.com/u/11237533?v=3",        "gravatar_id": "",        "url": "https://api.github.com/users/paulroberts68",        "html_url": "https://github.com/paulroberts68",        "followers_url": "https://api.github.com/users/paulroberts68/followers",        "following_url": "https://api.github.com/users/paulroberts68/following{/other_user}",        "gists_url": "https://api.github.com/users/paulroberts68/gists{/gist_id}",        "starred_url": "https://api.github.com/users/paulroberts68/starred{/owner}{/repo}",        "subscriptions_url": "https://api.github.com/users/paulroberts68/subscriptions",        "organizations_url": "https://api.github.com/users/paulroberts68/orgs",        "repos_url": "https://api.github.com/users/paulroberts68/repos",        "events_url": "https://api.github.com/users/paulroberts68/events{/privacy}",        "received_events_url": "https://api.github.com/users/paulroberts68/received_events",        "type": "User",        "site_admin": false      },      "open_issues": 5,      "closed_issues": 1,      "state": "open",      "created_at": "2016-02-29T16:24:14Z",      "updated_at": "2016-03-09T19:05:00Z",      "due_on": "2016-03-16T07:00:00Z",      "closed_at": null    },    "comments": 1,    "created_at": "2016-03-01T19:43:17Z",    "updated_at": "2016-03-01T19:44:12Z",    "closed_at": null,    "body": "Determine where and how the Labs Partner information/content will be integrated into the design"  },  {    "url": "https://api.github.com/repos/BCDevExchange/BCDevExchange-app/issues/272",    "repository_url": "https://api.github.com/repos/BCDevExchange/BCDevExchange-app",    "labels_url": "https://api.github.com/repos/BCDevExchange/BCDevExchange-app/issues/272/labels{/name}",    "comments_url": "https://api.github.com/repos/BCDevExchange/BCDevExchange-app/issues/272/comments",    "events_url": "https://api.github.com/repos/BCDevExchange/BCDevExchange-app/issues/272/events",    "html_url": "https://github.com/BCDevExchange/BCDevExchange-app/issues/272",    "id": 137667222,    "number": 272,    "title": "P4P BCDC",    "user": {      "login": "lmullane",      "id": 12040839,      "avatar_url": "https://avatars.githubusercontent.com/u/12040839?v=3",      "gravatar_id": "",      "url": "https://api.github.com/users/lmullane",      "html_url": "https://github.com/lmullane",      "followers_url": "https://api.github.com/users/lmullane/followers",      "following_url": "https://api.github.com/users/lmullane/following{/other_user}",      "gists_url": "https://api.github.com/users/lmullane/gists{/gist_id}",      "starred_url": "https://api.github.com/users/lmullane/starred{/owner}{/repo}",      "subscriptions_url": "https://api.github.com/users/lmullane/subscriptions",      "organizations_url": "https://api.github.com/users/lmullane/orgs",      "repos_url": "https://api.github.com/users/lmullane/repos",      "events_url": "https://api.github.com/users/lmullane/events{/privacy}",      "received_events_url": "https://api.github.com/users/lmullane/received_events",      "type": "User",      "site_admin": false    },    "labels": [      {        "url": "https://api.github.com/repos/BCDevExchange/BCDevExchange-app/labels/Account",        "name": "Account",        "color": "5319e7"      },      {        "url": "https://api.github.com/repos/BCDevExchange/BCDevExchange-app/labels/Bulls%20Eye%20Center",        "name": "Bulls Eye Center",        "color": "fef2c0"      },      {        "url": "https://api.github.com/repos/BCDevExchange/BCDevExchange-app/labels/P4P",        "name": "P4P",        "color": "fad8c7"      },      {        "url": "https://api.github.com/repos/BCDevExchange/BCDevExchange-app/labels/ready",        "name": "ready",        "color": "ededed"      }    ],    "state": "open",    "locked": false,    "assignee": {      "login": "lmullane",      "id": 12040839,      "avatar_url": "https://avatars.githubusercontent.com/u/12040839?v=3",      "gravatar_id": "",      "url": "https://api.github.com/users/lmullane",      "html_url": "https://github.com/lmullane",      "followers_url": "https://api.github.com/users/lmullane/followers",      "following_url": "https://api.github.com/users/lmullane/following{/other_user}",      "gists_url": "https://api.github.com/users/lmullane/gists{/gist_id}",      "starred_url": "https://api.github.com/users/lmullane/starred{/owner}{/repo}",      "subscriptions_url": "https://api.github.com/users/lmullane/subscriptions",      "organizations_url": "https://api.github.com/users/lmullane/orgs",      "repos_url": "https://api.github.com/users/lmullane/repos",      "events_url": "https://api.github.com/users/lmullane/events{/privacy}",      "received_events_url": "https://api.github.com/users/lmullane/received_events",      "type": "User",      "site_admin": false    },    "milestone": {      "url": "https://api.github.com/repos/BCDevExchange/BCDevExchange-app/milestones/19",      "html_url": "https://github.com/BCDevExchange/BCDevExchange-app/milestones/Sprint%2020",      "labels_url": "https://api.github.com/repos/BCDevExchange/BCDevExchange-app/milestones/19/labels",      "id": 1612530,      "number": 19,      "title": "Sprint 20",      "description": "",      "creator": {        "login": "paulroberts68",        "id": 11237533,        "avatar_url": "https://avatars.githubusercontent.com/u/11237533?v=3",        "gravatar_id": "",        "url": "https://api.github.com/users/paulroberts68",        "html_url": "https://github.com/paulroberts68",        "followers_url": "https://api.github.com/users/paulroberts68/followers",        "following_url": "https://api.github.com/users/paulroberts68/following{/other_user}",        "gists_url": "https://api.github.com/users/paulroberts68/gists{/gist_id}",        "starred_url": "https://api.github.com/users/paulroberts68/starred{/owner}{/repo}",        "subscriptions_url": "https://api.github.com/users/paulroberts68/subscriptions",        "organizations_url": "https://api.github.com/users/paulroberts68/orgs",        "repos_url": "https://api.github.com/users/paulroberts68/repos",        "events_url": "https://api.github.com/users/paulroberts68/events{/privacy}",        "received_events_url": "https://api.github.com/users/paulroberts68/received_events",        "type": "User",        "site_admin": false      },      "open_issues": 5,      "closed_issues": 1,      "state": "open",      "created_at": "2016-02-29T16:24:14Z",      "updated_at": "2016-03-09T19:05:00Z",      "due_on": "2016-03-16T07:00:00Z",      "closed_at": null    },    "comments": 0,    "created_at": "2016-03-01T19:43:16Z",    "updated_at": "2016-03-15T16:54:48Z",    "closed_at": null,    "body": "As a the BCDC program area, I want to post P4P issues so I can get help to complete work in my backlog.\n\nDOD:\nPost issues"  },  {    "url": "https://api.github.com/repos/BCDevExchange/BCDevExchange-app/issues/270",    "repository_url": "https://api.github.com/repos/BCDevExchange/BCDevExchange-app",    "labels_url": "https://api.github.com/repos/BCDevExchange/BCDevExchange-app/issues/270/labels{/name}",    "comments_url": "https://api.github.com/repos/BCDevExchange/BCDevExchange-app/issues/270/comments",    "events_url": "https://api.github.com/repos/BCDevExchange/BCDevExchange-app/issues/270/events",    "html_url": "https://github.com/BCDevExchange/BCDevExchange-app/issues/270",    "id": 137666546,    "number": 270,    "title": "Code with Us page - link terms and p4p process",    "user": {      "login": "ragbay",      "id": 14844339,      "avatar_url": "https://avatars.githubusercontent.com/u/14844339?v=3",      "gravatar_id": "",      "url": "https://api.github.com/users/ragbay",      "html_url": "https://github.com/ragbay",      "followers_url": "https://api.github.com/users/ragbay/followers",      "following_url": "https://api.github.com/users/ragbay/following{/other_user}",      "gists_url": "https://api.github.com/users/ragbay/gists{/gist_id}",      "starred_url": "https://api.github.com/users/ragbay/starred{/owner}{/repo}",      "subscriptions_url": "https://api.github.com/users/ragbay/subscriptions",      "organizations_url": "https://api.github.com/users/ragbay/orgs",      "repos_url": "https://api.github.com/users/ragbay/repos",      "events_url": "https://api.github.com/users/ragbay/events{/privacy}",      "received_events_url": "https://api.github.com/users/ragbay/received_events",      "type": "User",      "site_admin": false    },    "labels": [      {        "url": "https://api.github.com/repos/BCDevExchange/BCDevExchange-app/labels/Bulls%20Eye%20Ring%202",        "name": "Bulls Eye Ring 2",        "color": "fef2c0"      },      {        "url": "https://api.github.com/repos/BCDevExchange/BCDevExchange-app/labels/in%20sprint",        "name": "in sprint",        "color": "ededed"      }    ],    "state": "open",    "locked": false,    "assignee": {      "login": "ragbay",      "id": 14844339,      "avatar_url": "https://avatars.githubusercontent.com/u/14844339?v=3",      "gravatar_id": "",      "url": "https://api.github.com/users/ragbay",      "html_url": "https://github.com/ragbay",      "followers_url": "https://api.github.com/users/ragbay/followers",      "following_url": "https://api.github.com/users/ragbay/following{/other_user}",      "gists_url": "https://api.github.com/users/ragbay/gists{/gist_id}",      "starred_url": "https://api.github.com/users/ragbay/starred{/owner}{/repo}",      "subscriptions_url": "https://api.github.com/users/ragbay/subscriptions",      "organizations_url": "https://api.github.com/users/ragbay/orgs",      "repos_url": "https://api.github.com/users/ragbay/repos",      "events_url": "https://api.github.com/users/ragbay/events{/privacy}",      "received_events_url": "https://api.github.com/users/ragbay/received_events",      "type": "User",      "site_admin": false    },    "milestone": {      "url": "https://api.github.com/repos/BCDevExchange/BCDevExchange-app/milestones/19",      "html_url": "https://github.com/BCDevExchange/BCDevExchange-app/milestones/Sprint%2020",      "labels_url": "https://api.github.com/repos/BCDevExchange/BCDevExchange-app/milestones/19/labels",      "id": 1612530,      "number": 19,      "title": "Sprint 20",      "description": "",      "creator": {        "login": "paulroberts68",        "id": 11237533,        "avatar_url": "https://avatars.githubusercontent.com/u/11237533?v=3",        "gravatar_id": "",        "url": "https://api.github.com/users/paulroberts68",        "html_url": "https://github.com/paulroberts68",        "followers_url": "https://api.github.com/users/paulroberts68/followers",        "following_url": "https://api.github.com/users/paulroberts68/following{/other_user}",        "gists_url": "https://api.github.com/users/paulroberts68/gists{/gist_id}",        "starred_url": "https://api.github.com/users/paulroberts68/starred{/owner}{/repo}",        "subscriptions_url": "https://api.github.com/users/paulroberts68/subscriptions",        "organizations_url": "https://api.github.com/users/paulroberts68/orgs",        "repos_url": "https://api.github.com/users/paulroberts68/repos",        "events_url": "https://api.github.com/users/paulroberts68/events{/privacy}",        "received_events_url": "https://api.github.com/users/paulroberts68/received_events",        "type": "User",        "site_admin": false      },      "open_issues": 5,      "closed_issues": 1,      "state": "open",      "created_at": "2016-02-29T16:24:14Z",      "updated_at": "2016-03-09T19:05:00Z",      "due_on": "2016-03-16T07:00:00Z",      "closed_at": null    },    "comments": 1,    "created_at": "2016-03-01T19:40:46Z",    "updated_at": "2016-03-01T19:41:51Z",    "closed_at": null,    "body": "Add a link to the terms and p4p process on the code with us page to give developers this information before exploring opportunities in GitHub."  },  {    "url": "https://api.github.com/repos/BCDevExchange/BCDevExchange-app/issues/269",    "repository_url": "https://api.github.com/repos/BCDevExchange/BCDevExchange-app",    "labels_url": "https://api.github.com/repos/BCDevExchange/BCDevExchange-app/issues/269/labels{/name}",    "comments_url": "https://api.github.com/repos/BCDevExchange/BCDevExchange-app/issues/269/comments",    "events_url": "https://api.github.com/repos/BCDevExchange/BCDevExchange-app/issues/269/events",    "html_url": "https://github.com/BCDevExchange/BCDevExchange-app/issues/269",    "id": 137665323,    "number": 269,    "title": "Code with Us page updates",    "user": {      "login": "ragbay",      "id": 14844339,      "avatar_url": "https://avatars.githubusercontent.com/u/14844339?v=3",      "gravatar_id": "",      "url": "https://api.github.com/users/ragbay",      "html_url": "https://github.com/ragbay",      "followers_url": "https://api.github.com/users/ragbay/followers",      "following_url": "https://api.github.com/users/ragbay/following{/other_user}",      "gists_url": "https://api.github.com/users/ragbay/gists{/gist_id}",      "starred_url": "https://api.github.com/users/ragbay/starred{/owner}{/repo}",      "subscriptions_url": "https://api.github.com/users/ragbay/subscriptions",      "organizations_url": "https://api.github.com/users/ragbay/orgs",      "repos_url": "https://api.github.com/users/ragbay/repos",      "events_url": "https://api.github.com/users/ragbay/events{/privacy}",      "received_events_url": "https://api.github.com/users/ragbay/received_events",      "type": "User",      "site_admin": false    },    "labels": [      {        "url": "https://api.github.com/repos/BCDevExchange/BCDevExchange-app/labels/Bulls%20Eye%20Ring%202",        "name": "Bulls Eye Ring 2",        "color": "fef2c0"      },      {        "url": "https://api.github.com/repos/BCDevExchange/BCDevExchange-app/labels/in%20sprint",        "name": "in sprint",        "color": "ededed"      }    ],    "state": "open",    "locked": false,    "assignee": {      "login": "ragbay",      "id": 14844339,      "avatar_url": "https://avatars.githubusercontent.com/u/14844339?v=3",      "gravatar_id": "",      "url": "https://api.github.com/users/ragbay",      "html_url": "https://github.com/ragbay",      "followers_url": "https://api.github.com/users/ragbay/followers",      "following_url": "https://api.github.com/users/ragbay/following{/other_user}",      "gists_url": "https://api.github.com/users/ragbay/gists{/gist_id}",      "starred_url": "https://api.github.com/users/ragbay/starred{/owner}{/repo}",      "subscriptions_url": "https://api.github.com/users/ragbay/subscriptions",      "organizations_url": "https://api.github.com/users/ragbay/orgs",      "repos_url": "https://api.github.com/users/ragbay/repos",      "events_url": "https://api.github.com/users/ragbay/events{/privacy}",      "received_events_url": "https://api.github.com/users/ragbay/received_events",      "type": "User",      "site_admin": false    },    "milestone": {      "url": "https://api.github.com/repos/BCDevExchange/BCDevExchange-app/milestones/19",      "html_url": "https://github.com/BCDevExchange/BCDevExchange-app/milestones/Sprint%2020",      "labels_url": "https://api.github.com/repos/BCDevExchange/BCDevExchange-app/milestones/19/labels",      "id": 1612530,      "number": 19,      "title": "Sprint 20",      "description": "",      "creator": {        "login": "paulroberts68",        "id": 11237533,        "avatar_url": "https://avatars.githubusercontent.com/u/11237533?v=3",        "gravatar_id": "",        "url": "https://api.github.com/users/paulroberts68",        "html_url": "https://github.com/paulroberts68",        "followers_url": "https://api.github.com/users/paulroberts68/followers",        "following_url": "https://api.github.com/users/paulroberts68/following{/other_user}",        "gists_url": "https://api.github.com/users/paulroberts68/gists{/gist_id}",        "starred_url": "https://api.github.com/users/paulroberts68/starred{/owner}{/repo}",        "subscriptions_url": "https://api.github.com/users/paulroberts68/subscriptions",        "organizations_url": "https://api.github.com/users/paulroberts68/orgs",        "repos_url": "https://api.github.com/users/paulroberts68/repos",        "events_url": "https://api.github.com/users/paulroberts68/events{/privacy}",        "received_events_url": "https://api.github.com/users/paulroberts68/received_events",        "type": "User",        "site_admin": false      },      "open_issues": 5,      "closed_issues": 1,      "state": "open",      "created_at": "2016-02-29T16:24:14Z",      "updated_at": "2016-03-09T19:05:00Z",      "due_on": "2016-03-16T07:00:00Z",      "closed_at": null    },    "comments": 1,    "created_at": "2016-03-01T19:35:26Z",    "updated_at": "2016-03-01T19:38:36Z",    "closed_at": null,    "body": "Revise page content so that the community understands both p4p and \"love\" work is available."  },  {    "url": "https://api.github.com/repos/BCDevExchange/BCDevExchange-app/issues/266",    "repository_url": "https://api.github.com/repos/BCDevExchange/BCDevExchange-app",    "labels_url": "https://api.github.com/repos/BCDevExchange/BCDevExchange-app/issues/266/labels{/name}",    "comments_url": "https://api.github.com/repos/BCDevExchange/BCDevExchange-app/issues/266/comments",    "events_url": "https://api.github.com/repos/BCDevExchange/BCDevExchange-app/issues/266/events",    "html_url": "https://github.com/BCDevExchange/BCDevExchange-app/issues/266",    "id": 134361977,    "number": 266,    "title": "Setup a lab environment with CI for BCDevExchange-app on OpenShift",    "user": {      "login": "f-w",      "id": 12823994,      "avatar_url": "https://avatars.githubusercontent.com/u/12823994?v=3",      "gravatar_id": "",      "url": "https://api.github.com/users/f-w",      "html_url": "https://github.com/f-w",      "followers_url": "https://api.github.com/users/f-w/followers",      "following_url": "https://api.github.com/users/f-w/following{/other_user}",      "gists_url": "https://api.github.com/users/f-w/gists{/gist_id}",      "starred_url": "https://api.github.com/users/f-w/starred{/owner}{/repo}",      "subscriptions_url": "https://api.github.com/users/f-w/subscriptions",      "organizations_url": "https://api.github.com/users/f-w/orgs",      "repos_url": "https://api.github.com/users/f-w/repos",      "events_url": "https://api.github.com/users/f-w/events{/privacy}",      "received_events_url": "https://api.github.com/users/f-w/received_events",      "type": "User",      "site_admin": false    },    "labels": [      {        "url": "https://api.github.com/repos/BCDevExchange/BCDevExchange-app/labels/Lab",        "name": "Lab",        "color": "006b75"      }    ],    "state": "open",    "locked": false,    "assignee": null,    "milestone": null,    "comments": 0,    "created_at": "2016-02-17T18:32:15Z",    "updated_at": "2016-03-01T18:49:54Z",    "closed_at": null,    "body": "Requirements:\r\n1. The end result should match http://uat.bcdevexchange.org, barring at most host name. Because the web app is comprised of source code on GH and instance-specific data such as database files, instance-specific config files, environment variables etc, this requirement implies a solution must be devised to merge source code with instance-specific data.\r\n2. Implement a CI solution such that whenever a push is made to GH, the site is rebuilt automatically.\r\n3. instance-specific data should be persisted across builds as build configuration, i.e. automated CI builds shouldn't require instance-specific data as input every time, nor deleting the data supplied earlier.\r\n4. The build of web application should take place inside the container/image that runs the web application, not on the node that runs CI application, nor on the host.\r\n5. The solution should be generic enough to able to apply to other web applications, at least on NodeJS platform.\r\n\r\n\r\nThis issue is related to #223, but #223 is one of the alternatives. S2I should be considered as well."  },  {    "url": "https://api.github.com/repos/BCDevExchange/BCDevExchange-app/issues/265",    "repository_url": "https://api.github.com/repos/BCDevExchange/BCDevExchange-app",    "labels_url": "https://api.github.com/repos/BCDevExchange/BCDevExchange-app/issues/265/labels{/name}",    "comments_url": "https://api.github.com/repos/BCDevExchange/BCDevExchange-app/issues/265/comments",    "events_url": "https://api.github.com/repos/BCDevExchange/BCDevExchange-app/issues/265/events",    "html_url": "https://github.com/BCDevExchange/BCDevExchange-app/issues/265",    "id": 133853058,    "number": 265,    "title": "As a developer, I want different payment options so I can choose how I get paid for a Pay for Pull.",    "user": {      "login": "lmullane",      "id": 12040839,      "avatar_url": "https://avatars.githubusercontent.com/u/12040839?v=3",      "gravatar_id": "",      "url": "https://api.github.com/users/lmullane",      "html_url": "https://github.com/lmullane",      "followers_url": "https://api.github.com/users/lmullane/followers",      "following_url": "https://api.github.com/users/lmullane/following{/other_user}",      "gists_url": "https://api.github.com/users/lmullane/gists{/gist_id}",      "starred_url": "https://api.github.com/users/lmullane/starred{/owner}{/repo}",      "subscriptions_url": "https://api.github.com/users/lmullane/subscriptions",      "organizations_url": "https://api.github.com/users/lmullane/orgs",      "repos_url": "https://api.github.com/users/lmullane/repos",      "events_url": "https://api.github.com/users/lmullane/events{/privacy}",      "received_events_url": "https://api.github.com/users/lmullane/received_events",      "type": "User",      "site_admin": false    },    "labels": [      {        "url": "https://api.github.com/repos/BCDevExchange/BCDevExchange-app/labels/in%20sprint",        "name": "in sprint",        "color": "ededed"      },      {        "url": "https://api.github.com/repos/BCDevExchange/BCDevExchange-app/labels/P4P",        "name": "P4P",        "color": "fad8c7"      }    ],    "state": "open",    "locked": false,    "assignee": {      "login": "DavidR8",      "id": 4622563,      "avatar_url": "https://avatars.githubusercontent.com/u/4622563?v=3",      "gravatar_id": "",      "url": "https://api.github.com/users/DavidR8",      "html_url": "https://github.com/DavidR8",      "followers_url": "https://api.github.com/users/DavidR8/followers",      "following_url": "https://api.github.com/users/DavidR8/following{/other_user}",      "gists_url": "https://api.github.com/users/DavidR8/gists{/gist_id}",      "starred_url": "https://api.github.com/users/DavidR8/starred{/owner}{/repo}",      "subscriptions_url": "https://api.github.com/users/DavidR8/subscriptions",      "organizations_url": "https://api.github.com/users/DavidR8/orgs",      "repos_url": "https://api.github.com/users/DavidR8/repos",      "events_url": "https://api.github.com/users/DavidR8/events{/privacy}",      "received_events_url": "https://api.github.com/users/DavidR8/received_events",      "type": "User",      "site_admin": false    },    "milestone": null,    "comments": 0,    "created_at": "2016-02-16T00:54:40Z",    "updated_at": "2016-03-15T15:55:31Z",    "closed_at": null,    "body": "As a developer, I want different payment options so I can choose how I get paid for a Pay for Pull.\n\nDOD:\nExplore alternative payment options for Pay for Pull.\nConfirm steps and approvals required to pay developers directly with a p-card"  },  {    "url": "https://api.github.com/repos/BCDevExchange/BCDevExchange-app/issues/233",    "repository_url": "https://api.github.com/repos/BCDevExchange/BCDevExchange-app",    "labels_url": "https://api.github.com/repos/BCDevExchange/BCDevExchange-app/issues/233/labels{/name}",    "comments_url": "https://api.github.com/repos/BCDevExchange/BCDevExchange-app/issues/233/comments",    "events_url": "https://api.github.com/repos/BCDevExchange/BCDevExchange-app/issues/233/events",    "html_url": "https://github.com/BCDevExchange/BCDevExchange-app/issues/233",    "id": 125997912,    "number": 233,    "title": "Use API client libraries in place of lower level code for API integrations.",    "user": {      "login": "sheaphillips",      "id": 698658,      "avatar_url": "https://avatars.githubusercontent.com/u/698658?v=3",      "gravatar_id": "",      "url": "https://api.github.com/users/sheaphillips",      "html_url": "https://github.com/sheaphillips",      "followers_url": "https://api.github.com/users/sheaphillips/followers",      "following_url": "https://api.github.com/users/sheaphillips/following{/other_user}",      "gists_url": "https://api.github.com/users/sheaphillips/gists{/gist_id}",      "starred_url": "https://api.github.com/users/sheaphillips/starred{/owner}{/repo}",      "subscriptions_url": "https://api.github.com/users/sheaphillips/subscriptions",      "organizations_url": "https://api.github.com/users/sheaphillips/orgs",      "repos_url": "https://api.github.com/users/sheaphillips/repos",      "events_url": "https://api.github.com/users/sheaphillips/events{/privacy}",      "received_events_url": "https://api.github.com/users/sheaphillips/received_events",      "type": "User",      "site_admin": false    },    "labels": [      {        "url": "https://api.github.com/repos/BCDevExchange/BCDevExchange-app/labels/enhancement",        "name": "enhancement",        "color": "d4c5f9"      },      {        "url": "https://api.github.com/repos/BCDevExchange/BCDevExchange-app/labels/P4P",        "name": "P4P",        "color": "fad8c7"      }    ],    "state": "open",    "locked": false,    "assignee": {      "login": "kelpisland",      "id": 9368818,      "avatar_url": "https://avatars.githubusercontent.com/u/9368818?v=3",      "gravatar_id": "",      "url": "https://api.github.com/users/kelpisland",      "html_url": "https://github.com/kelpisland",      "followers_url": "https://api.github.com/users/kelpisland/followers",      "following_url": "https://api.github.com/users/kelpisland/following{/other_user}",      "gists_url": "https://api.github.com/users/kelpisland/gists{/gist_id}",      "starred_url": "https://api.github.com/users/kelpisland/starred{/owner}{/repo}",      "subscriptions_url": "https://api.github.com/users/kelpisland/subscriptions",      "organizations_url": "https://api.github.com/users/kelpisland/orgs",      "repos_url": "https://api.github.com/users/kelpisland/repos",      "events_url": "https://api.github.com/users/kelpisland/events{/privacy}",      "received_events_url": "https://api.github.com/users/kelpisland/received_events",      "type": "User",      "site_admin": false    },    "milestone": null,    "comments": 1,    "created_at": "2016-01-11T17:41:21Z",    "updated_at": "2016-03-01T18:49:37Z",    "closed_at": null,    "body": "We are currently using \"raw\"/request based integrations for accessing GitHub and presumably other APIs. It would be preferable to use API providers' client libraries to reduce low-level code, and simplify implementation.  GitHub would be the obvious place to start.  There are several candidates listed here: https://developer.github.com/libraries/\n\n#payforpullcandidate."  },  {    "url": "https://api.github.com/repos/BCDevExchange/BCDevExchange-app/issues/215",    "repository_url": "https://api.github.com/repos/BCDevExchange/BCDevExchange-app",    "labels_url": "https://api.github.com/repos/BCDevExchange/BCDevExchange-app/issues/215/labels{/name}",    "comments_url": "https://api.github.com/repos/BCDevExchange/BCDevExchange-app/issues/215/comments",    "events_url": "https://api.github.com/repos/BCDevExchange/BCDevExchange-app/issues/215/events",    "html_url": "https://github.com/BCDevExchange/BCDevExchange-app/issues/215",    "id": 119615923,    "number": 215,    "title": "As a public sector dev user I need to know that Microsoft has become a DevEx lab partnership and I need to know what services are being provided",    "user": {      "login": "paulroberts68",      "id": 11237533,      "avatar_url": "https://avatars.githubusercontent.com/u/11237533?v=3",      "gravatar_id": "",      "url": "https://api.github.com/users/paulroberts68",      "html_url": "https://github.com/paulroberts68",      "followers_url": "https://api.github.com/users/paulroberts68/followers",      "following_url": "https://api.github.com/users/paulroberts68/following{/other_user}",      "gists_url": "https://api.github.com/users/paulroberts68/gists{/gist_id}",      "starred_url": "https://api.github.com/users/paulroberts68/starred{/owner}{/repo}",      "subscriptions_url": "https://api.github.com/users/paulroberts68/subscriptions",      "organizations_url": "https://api.github.com/users/paulroberts68/orgs",      "repos_url": "https://api.github.com/users/paulroberts68/repos",      "events_url": "https://api.github.com/users/paulroberts68/events{/privacy}",      "received_events_url": "https://api.github.com/users/paulroberts68/received_events",      "type": "User",      "site_admin": false    },    "labels": [      {        "url": "https://api.github.com/repos/BCDevExchange/BCDevExchange-app/labels/in%20sprint",        "name": "in sprint",        "color": "ededed"      },      {        "url": "https://api.github.com/repos/BCDevExchange/BCDevExchange-app/labels/Lab",        "name": "Lab",        "color": "006b75"      }    ],    "state": "open",    "locked": false,    "assignee": {      "login": "DavidR8",      "id": 4622563,      "avatar_url": "https://avatars.githubusercontent.com/u/4622563?v=3",      "gravatar_id": "",      "url": "https://api.github.com/users/DavidR8",      "html_url": "https://github.com/DavidR8",      "followers_url": "https://api.github.com/users/DavidR8/followers",      "following_url": "https://api.github.com/users/DavidR8/following{/other_user}",      "gists_url": "https://api.github.com/users/DavidR8/gists{/gist_id}",      "starred_url": "https://api.github.com/users/DavidR8/starred{/owner}{/repo}",      "subscriptions_url": "https://api.github.com/users/DavidR8/subscriptions",      "organizations_url": "https://api.github.com/users/DavidR8/orgs",      "repos_url": "https://api.github.com/users/DavidR8/repos",      "events_url": "https://api.github.com/users/DavidR8/events{/privacy}",      "received_events_url": "https://api.github.com/users/DavidR8/received_events",      "type": "User",      "site_admin": false    },    "milestone": null,    "comments": 0,    "created_at": "2015-12-01T00:51:37Z",    "updated_at": "2016-03-02T21:18:56Z",    "closed_at": null,    "body": "The Microsoft partnership needs to be advertised/communicated so that the public sector devs come to the exchange, sign-up and explore the opportunities. \n\nCreated by Peter\n\nDOD\n1. Comms plan\n\nConnect with Peter"  },  {    "url": "https://api.github.com/repos/BCDevExchange/BCDevExchange-app/issues/206",    "repository_url": "https://api.github.com/repos/BCDevExchange/BCDevExchange-app",    "labels_url": "https://api.github.com/repos/BCDevExchange/BCDevExchange-app/issues/206/labels{/name}",    "comments_url": "https://api.github.com/repos/BCDevExchange/BCDevExchange-app/issues/206/comments",    "events_url": "https://api.github.com/repos/BCDevExchange/BCDevExchange-app/issues/206/events",    "html_url": "https://github.com/BCDevExchange/BCDevExchange-app/issues/206",    "id": 119560529,    "number": 206,    "title": "Safari OSX IOS requires fix",    "user": {      "login": "karsmith",      "id": 15617404,      "avatar_url": "https://avatars.githubusercontent.com/u/15617404?v=3",      "gravatar_id": "",      "url": "https://api.github.com/users/karsmith",      "html_url": "https://github.com/karsmith",      "followers_url": "https://api.github.com/users/karsmith/followers",      "following_url": "https://api.github.com/users/karsmith/following{/other_user}",      "gists_url": "https://api.github.com/users/karsmith/gists{/gist_id}",      "starred_url": "https://api.github.com/users/karsmith/starred{/owner}{/repo}",      "subscriptions_url": "https://api.github.com/users/karsmith/subscriptions",      "organizations_url": "https://api.github.com/users/karsmith/orgs",      "repos_url": "https://api.github.com/users/karsmith/repos",      "events_url": "https://api.github.com/users/karsmith/events{/privacy}",      "received_events_url": "https://api.github.com/users/karsmith/received_events",      "type": "User",      "site_admin": false    },    "labels": [      {        "url": "https://api.github.com/repos/BCDevExchange/BCDevExchange-app/labels/bug",        "name": "bug",        "color": "fc2929"      }    ],    "state": "open",    "locked": false,    "assignee": null,    "milestone": {      "url": "https://api.github.com/repos/BCDevExchange/BCDevExchange-app/milestones/9",      "html_url": "https://github.com/BCDevExchange/BCDevExchange-app/milestones/Sprint%2016",      "labels_url": "https://api.github.com/repos/BCDevExchange/BCDevExchange-app/milestones/9/labels",      "id": 1432730,      "number": 9,      "title": "Sprint 16",      "description": "",      "creator": {        "login": "karsmith",        "id": 15617404,        "avatar_url": "https://avatars.githubusercontent.com/u/15617404?v=3",        "gravatar_id": "",        "url": "https://api.github.com/users/karsmith",        "html_url": "https://github.com/karsmith",        "followers_url": "https://api.github.com/users/karsmith/followers",        "following_url": "https://api.github.com/users/karsmith/following{/other_user}",        "gists_url": "https://api.github.com/users/karsmith/gists{/gist_id}",        "starred_url": "https://api.github.com/users/karsmith/starred{/owner}{/repo}",        "subscriptions_url": "https://api.github.com/users/karsmith/subscriptions",        "organizations_url": "https://api.github.com/users/karsmith/orgs",        "repos_url": "https://api.github.com/users/karsmith/repos",        "events_url": "https://api.github.com/users/karsmith/events{/privacy}",        "received_events_url": "https://api.github.com/users/karsmith/received_events",        "type": "User",        "site_admin": false      },      "open_issues": 1,      "closed_issues": 14,      "state": "open",      "created_at": "2015-11-27T17:06:06Z",      "updated_at": "2016-02-10T22:52:14Z",      "due_on": "2015-12-18T08:00:00Z",      "closed_at": null    },    "comments": 1,    "created_at": "2015-11-30T19:17:46Z",    "updated_at": "2016-02-29T16:24:59Z",    "closed_at": null,    "body": "Can we fix Safari OSX IOS on opi.BCDevExchange.org"  },  {    "url": "https://api.github.com/repos/BCDevExchange/BCDevExchange-app/issues/154",    "repository_url": "https://api.github.com/repos/BCDevExchange/BCDevExchange-app",    "labels_url": "https://api.github.com/repos/BCDevExchange/BCDevExchange-app/issues/154/labels{/name}",    "comments_url": "https://api.github.com/repos/BCDevExchange/BCDevExchange-app/issues/154/comments",    "events_url": "https://api.github.com/repos/BCDevExchange/BCDevExchange-app/issues/154/events",    "html_url": "https://github.com/BCDevExchange/BCDevExchange-app/issues/154",    "id": 110727994,    "number": 154,    "title": "Integrating web analytics onto the profile page",    "user": {      "login": "paulroberts68",      "id": 11237533,      "avatar_url": "https://avatars.githubusercontent.com/u/11237533?v=3",      "gravatar_id": "",      "url": "https://api.github.com/users/paulroberts68",      "html_url": "https://github.com/paulroberts68",      "followers_url": "https://api.github.com/users/paulroberts68/followers",      "following_url": "https://api.github.com/users/paulroberts68/following{/other_user}",      "gists_url": "https://api.github.com/users/paulroberts68/gists{/gist_id}",      "starred_url": "https://api.github.com/users/paulroberts68/starred{/owner}{/repo}",      "subscriptions_url": "https://api.github.com/users/paulroberts68/subscriptions",      "organizations_url": "https://api.github.com/users/paulroberts68/orgs",      "repos_url": "https://api.github.com/users/paulroberts68/repos",      "events_url": "https://api.github.com/users/paulroberts68/events{/privacy}",      "received_events_url": "https://api.github.com/users/paulroberts68/received_events",      "type": "User",      "site_admin": false    },    "labels": [      {        "url": "https://api.github.com/repos/BCDevExchange/BCDevExchange-app/labels/Profile%20Page",        "name": "Profile Page",        "color": "5319e7"      }    ],    "state": "open",    "locked": false,    "assignee": {      "login": "dy2288",      "id": 1534119,      "avatar_url": "https://avatars.githubusercontent.com/u/1534119?v=3",      "gravatar_id": "",      "url": "https://api.github.com/users/dy2288",      "html_url": "https://github.com/dy2288",      "followers_url": "https://api.github.com/users/dy2288/followers",      "following_url": "https://api.github.com/users/dy2288/following{/other_user}",      "gists_url": "https://api.github.com/users/dy2288/gists{/gist_id}",      "starred_url": "https://api.github.com/users/dy2288/starred{/owner}{/repo}",      "subscriptions_url": "https://api.github.com/users/dy2288/subscriptions",      "organizations_url": "https://api.github.com/users/dy2288/orgs",      "repos_url": "https://api.github.com/users/dy2288/repos",      "events_url": "https://api.github.com/users/dy2288/events{/privacy}",      "received_events_url": "https://api.github.com/users/dy2288/received_events",      "type": "User",      "site_admin": false    },    "milestone": {      "url": "https://api.github.com/repos/BCDevExchange/BCDevExchange-app/milestones/8",      "html_url": "https://github.com/BCDevExchange/BCDevExchange-app/milestones/Sprint%2015",      "labels_url": "https://api.github.com/repos/BCDevExchange/BCDevExchange-app/milestones/8/labels",      "id": 1392544,      "number": 8,      "title": "Sprint 15",      "description": "",      "creator": {        "login": "paulroberts68",        "id": 11237533,        "avatar_url": "https://avatars.githubusercontent.com/u/11237533?v=3",        "gravatar_id": "",        "url": "https://api.github.com/users/paulroberts68",        "html_url": "https://github.com/paulroberts68",        "followers_url": "https://api.github.com/users/paulroberts68/followers",        "following_url": "https://api.github.com/users/paulroberts68/following{/other_user}",        "gists_url": "https://api.github.com/users/paulroberts68/gists{/gist_id}",        "starred_url": "https://api.github.com/users/paulroberts68/starred{/owner}{/repo}",        "subscriptions_url": "https://api.github.com/users/paulroberts68/subscriptions",        "organizations_url": "https://api.github.com/users/paulroberts68/orgs",        "repos_url": "https://api.github.com/users/paulroberts68/repos",        "events_url": "https://api.github.com/users/paulroberts68/events{/privacy}",        "received_events_url": "https://api.github.com/users/paulroberts68/received_events",        "type": "User",        "site_admin": false      },      "open_issues": 1,      "closed_issues": 3,      "state": "open",      "created_at": "2015-11-03T23:20:46Z",      "updated_at": "2016-02-10T21:53:51Z",      "due_on": "2015-11-25T08:00:00Z",      "closed_at": null    },    "comments": 0,    "created_at": "2015-10-09T20:09:41Z",    "updated_at": "2016-02-29T16:24:55Z",    "closed_at": null,    "body": "As a program owner I want to see usability metrics for my services within the exchange so that I can determine/measure business goals.\n\nCreated by: Peter/Paul\n\nDOD\n1. Create mini journeys to explain the value of the metrics.\n2. Create a prototype\n2. Test with users \n\nApproach\n1. Review journeys with Peter/David H\n\nConnect with\nDaniel, Loren, Rommel"  }];

			deferred.resolve(issues);
		}

		return deferred.promise;
	},
	
	import: function (owner, repo, kanboardModule, testingFlag) {
		kanboard = kanboardModule;
		testing = testingFlag;

		github.getIssues(owner, repo).then((issues) => {
			github.getMilestones(owner, repo).then((milestones) => {
				var closedIssues = issues.filter((issue) => issue.state == "closed");
				var remaining = issues.filter((issue) => issue.state != "closed");

				var blockedIssues = remaining.filter((issue) => issue.labels.some((label) => label.name == "Blocked"));
				var remaining = remaining.filter((issue) => issue.labels.every((label) => label.name != "Blocked"));

				var latestMilestone = milestones[milestones.length - 2];
				var milestoneIssues = remaining.filter((issue) => issue.milestone && issue.milestone.id == latestMilestone.id);
				var openIssues = remaining.filter((issue) => !issue.milestone || issue.milestone.id != latestMilestone.id);

				github.kanboardImport(owner, repo, openIssues, milestoneIssues, blockedIssues, closedIssues);
			});
		});
	}
}

module.exports = github;