Skip to content

Commit

Permalink
fix v2 to match v1, double query
Browse files Browse the repository at this point in the history
  • Loading branch information
mmeigs committed Sep 21, 2023
1 parent e2ca1d4 commit b59e573
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions api/controllers/v2/github.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,18 @@ import { markBuildArtifactsForDeletion, validateJsonWebhook } from '../../handle
import { DocsetsRepository } from '../../../src/repositories/docsetsRepository';
import { getMonorepoPaths } from '../../../src/monorepo';
import { getUpdatedFilePaths } from '../../../src/monorepo/utils/path-utils';
import { ReposBranchesDocument } from '../../../modules/persistence/src/services/metadata/associated_products';

async function prepGithubPushPayload(
githubEvent: PushEvent,
repoBranchesRepository: RepoBranchesRepository,
docsetsRepository: DocsetsRepository,
prefix: string
prefix: string,
repoInfo: ReposBranchesDocument
): Promise<Omit<EnhancedJob, '_id'>> {
const branch_name = githubEvent.ref.split('/')[2];
const branch_info = await repoBranchesRepository.getRepoBranchAliases(githubEvent.repository.name, branch_name);
const urlSlug = branch_info.aliasObject?.urlSlug ?? branch_name;
const repo_info = await docsetsRepository.getRepo(githubEvent.repository.name);
const project = repo_info?.project ?? githubEvent.repository.name;
const project = repoInfo?.project ?? githubEvent.repository.name;

return {
title: githubEvent.repository.full_name,
Expand Down Expand Up @@ -104,7 +104,7 @@ export const TriggerBuild = async (event: APIGatewayEvent): Promise<APIGatewayPr
const repoInfo = await docsetsRepository.getRepo(body.repository.name);
const jobPrefix = repoInfo?.prefix ? repoInfo['prefix'][env] : '';

const job = await prepGithubPushPayload(body, repoBranchesRepository, docsetsRepository, jobPrefix);
const job = await prepGithubPushPayload(body, repoBranchesRepository, jobPrefix, repoInfo);

if (process.env.MONOREPO_PATH_FEATURE === 'true') {
try {
Expand Down

0 comments on commit b59e573

Please sign in to comment.