Skip to content

Commit

Permalink
[DOP-3911]: Add feature
Browse files Browse the repository at this point in the history
  • Loading branch information
branberry committed Aug 31, 2023
1 parent d829955 commit 3859aca
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion api/controllers/v2/github.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { RepoBranchesRepository } from '../../../src/repositories/repoBranchesRe
import { EnhancedJob, JobStatus } from '../../../src/entities/job';
import { markBuildArtifactsForDeletion, validateJsonWebhook } from '../../handlers/github';
import { getMonorepoPaths } from '../../../src/monorepo';
import { getUpdatedFilePaths } from '../../../src/monorepo/utils/path-utils';

async function prepGithubPushPayload(
githubEvent: PushEvent,
Expand Down Expand Up @@ -102,12 +103,13 @@ export const TriggerBuild = async (event: APIGatewayEvent): Promise<APIGatewayPr

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

if (process.env.MONOREPO_PATH_FEATURE === 'true') {
if (process.env.MONOREPO_PATH_FEATURE === 'true' && body.head_commit && body.repository.owner.name) {
try {
getMonorepoPaths({
commitSha: body.head_commit.id,
repoName: body.repository.name,
ownerName: body.repository.owner.name,
updatedFilePaths: getUpdatedFilePaths(body.head_commit),
});
} catch (error) {
console.warn('Warning, attempting to get repo paths caused an error', error);
Expand Down

0 comments on commit 3859aca

Please sign in to comment.