Minor performance improvement

This commit is contained in:
Pedro Pombeiro 2018-02-22 16:59:09 +01:00
parent 8ddcfee6aa
commit 2efe7e508c
No known key found for this signature in database
GPG Key ID: A65DEB11E4BBC647
1 changed files with 11 additions and 0 deletions

View File

@ -82,6 +82,10 @@ async function _getProjectCardForIssue (github, columnId, issueUrl) {
}
async function _getOrgProjectByName (github, robot, orgName, projectName, botName) {
if (!projectName) {
return null
}
try {
// Fetch org projects
// TODO: The org project and project column info should be cached
@ -107,6 +111,10 @@ async function _getOrgProjectByName (github, robot, orgName, projectName, botNam
}
async function _getRepoProjectByName (github, robot, repoInfo, projectName, botName) {
if (!projectName) {
return null
}
try {
const ghprojectsPayload = await github.projects.getRepoProjects({ ...repoInfo, state: 'open' })
const project = ghprojectsPayload.data.find(p => p.name === projectName)
@ -128,6 +136,9 @@ async function _getProjectColumnByName (github, robot, project, columnName, botN
if (!project) {
return null
}
if (!columnName) {
return null
}
try {
const ghcolumnsPayload = await github.projects.getProjectColumns({ project_id: project.id })