Minor performance improvement
This commit is contained in:
parent
8ddcfee6aa
commit
2efe7e508c
|
@ -82,6 +82,10 @@ async function _getProjectCardForIssue (github, columnId, issueUrl) {
|
||||||
}
|
}
|
||||||
|
|
||||||
async function _getOrgProjectByName (github, robot, orgName, projectName, botName) {
|
async function _getOrgProjectByName (github, robot, orgName, projectName, botName) {
|
||||||
|
if (!projectName) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Fetch org projects
|
// Fetch org projects
|
||||||
// TODO: The org project and project column info should be cached
|
// 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) {
|
async function _getRepoProjectByName (github, robot, repoInfo, projectName, botName) {
|
||||||
|
if (!projectName) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const ghprojectsPayload = await github.projects.getRepoProjects({ ...repoInfo, state: 'open' })
|
const ghprojectsPayload = await github.projects.getRepoProjects({ ...repoInfo, state: 'open' })
|
||||||
const project = ghprojectsPayload.data.find(p => p.name === projectName)
|
const project = ghprojectsPayload.data.find(p => p.name === projectName)
|
||||||
|
@ -128,6 +136,9 @@ async function _getProjectColumnByName (github, robot, project, columnName, botN
|
||||||
if (!project) {
|
if (!project) {
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
if (!columnName) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const ghcolumnsPayload = await github.projects.getProjectColumns({ project_id: project.id })
|
const ghcolumnsPayload = await github.projects.getProjectColumns({ project_id: project.id })
|
||||||
|
|
Loading…
Reference in New Issue