Commit f0655d15 authored by Francois Merlin's avatar Francois Merlin
Browse files

Modify call to github search api for using token

parent ae9d43ff
......@@ -120,7 +120,8 @@ public class ConstanteUtils
/** The Constant PROPERTY_GITHUB_SEARCH_REPO_API. */
public static final String PROPERTY_GITHUB_SEARCH_REPO_API = "releaser.githubSearchRepoApi";
/** The Constant PROPERTY_NB_SEARCH_ITEM_PER_PAGE_LOAD. */
public static final String PROPERTY_GITHUB_SEARCH_REPO_API_TOKEN= "releaser.githubSearchRepoApiToken";
/** The Constant PROPERTY_MAVEN_LOCAL_REPOSITORY. */
public static final String PROPERTY_MAVEN_LOCAL_REPOSITORY = "releaser.mavenLocalRepository";
......@@ -159,6 +160,9 @@ public class ConstanteUtils
/** The Constant PROPERTY_NB_SEARCH_ITEM_PER_PAGE_LOAD. */
public static final String PROPERTY_NB_SEARCH_ITEM_PER_PAGE_LOAD = "releaser.nbSearchItemPerPageLoad";
/** The Constant PROPERTY_URL_JIRA_SERVICE. */
public static final String PROPERTY_URL_JIRA_SERVICE = "releaser.urlJiraService";
......
......@@ -7,9 +7,12 @@ import java.net.URLEncoder;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang.StringUtils;
import org.eclipse.jgit.api.CloneCommand;
import org.eclipse.jgit.api.CreateBranchCommand.SetupUpstreamMode;
......@@ -444,7 +447,11 @@ public class GitUtils
try
{
strResponse = httpAccess.doGet( strUrl, new BasicAuthorizationAuthenticator( strUserName, strPassword ), null );
String strApiToken=AppPropertiesService.getProperty( ConstanteUtils.PROPERTY_GITHUB_SEARCH_REPO_API_TOKEN );
Map<String,String> mapHeaderToken=new HashMap<String, String>();
mapHeaderToken.put("Authorization", "token "+strApiToken );
strResponse = httpAccess.doGet(strUrl, null, null,mapHeaderToken );
if ( !StringUtils.isEmpty( strResponse ) )
{
......
......@@ -39,6 +39,7 @@ releaser.gitlabReleaseAccount.password=
releaser.localComponentBasePath=
releaser.githubSearchRepoApi=https://api.github.com/search/repositories?q={0}+org:{1}
releaser.githubSearchRepoApiToken=
releaser.nbSearchItemPerPageLoad=10
releaser.urlJiraService=https://dev.lutece.paris.fr/jira/
releaser.component.jiraSearchQuery=project = {0} AND fixVersion in ({1}) AND status in (Open,Reopened, \"In Progress\", \"To Do\")
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment