// Repository name
RepositoryId repoId = RepositoryId.create(repoOwner, repoName);
map.put("repositoryName", repoId.generateId());
// Display user info
ForceServiceConnector forceConnector = new ForceServiceConnector(ForceServiceConnector.getThreadLocalConnectorConfig());
map.put("userContext", forceConnector.getConnection().getUserInfo());
// Display repo info
GitHubClientOAuthServer client =
new GitHubClientOAuthServer(System.getenv(GITHUB_CLIENT_ID), System.getenv(GITHUB_CLIENT_SECRET) );
map.put("repo", null);
map.put("githubcontents", null);
RepositoryService service = new RepositoryService(client);
map.put("repo", service.getRepository(repoId));
// Prepare Salesforce metadata metadata for repository scan
RepositoryScanResult repositoryScanResult = new RepositoryScanResult();
RepositoryItem repositoryContainer = new RepositoryItem();
repositoryContainer.repositoryItems = new ArrayList<RepositoryItem>();
repositoryScanResult.metadataFolderBySuffix = new HashMap<String, DescribeMetadataObject>();
DescribeMetadataResult metadataDescribeResult = forceConnector.getMetadataConnection().describeMetadata(29.0); // TODO: Make version configurable / auto
for(DescribeMetadataObject describeObject : metadataDescribeResult.getMetadataObjects())
{
repositoryScanResult.metadataFolderBySuffix.put(describeObject.getSuffix(), describeObject);
if(describeObject.getMetaFile())
repositoryScanResult.metadataFolderBySuffix.put(describeObject.getSuffix() + "-meta.xml", describeObject);