diff --git a/src/server/services/__tests__/github.test.ts b/src/server/services/__tests__/github.test.ts index f0db616..72563a4 100644 --- a/src/server/services/__tests__/github.test.ts +++ b/src/server/services/__tests__/github.test.ts @@ -326,33 +326,6 @@ describe('Github Service - handlePullRequestHook', () => { expect(mockDb.services.LabelService.labelQueue.add).not.toHaveBeenCalled(); }); - test('queues a build when an open deployed PR receives a synchronize event', async () => { - mockHasDeployLabel.mockResolvedValue(true); - mockEnableKillSwitch.mockResolvedValue(false); - - const mockPullRequest = createMockPullRequest({ - deployOnUpdate: true, - latestCommit: 'previous-commit', - }); - mockDb.services.PullRequest.findOrCreatePullRequest.mockResolvedValue(mockPullRequest); - - await githubService.handlePullRequestHook( - createMockPullRequestEvent({ - action: 'synchronize', - labels: [{ name: 'lifecycle-deploy!' }], - branchSha: 'latest-commit', - }) - ); - - expect(mockGetYamlFileContent).not.toHaveBeenCalled(); - expect(mockDb.services.BuildService.createBuildAndDeploys).not.toHaveBeenCalled(); - expect(mockPullRequest.__patch).toHaveBeenCalledWith({ latestCommit: 'latest-commit' }); - expect(mockDb.models.Build.findOne).toHaveBeenCalledWith({ pullRequestId: 1 }); - expect(mockDb.services.BuildService.resolveAndDeployBuildQueue.add).toHaveBeenCalledWith('resolve-deploy', { - buildId: 10, - }); - }); - test('keeps the existing label sync flow for unlabeled autoDeploy PRs', async () => { mockGetYamlFileContent.mockResolvedValue({ environment: { autoDeploy: true } }); mockHasDeployLabel.mockResolvedValue(false); diff --git a/src/server/services/github.ts b/src/server/services/github.ts index 2de6de1..1265bbb 100644 --- a/src/server/services/github.ts +++ b/src/server/services/github.ts @@ -155,7 +155,6 @@ export default class GithubService extends Service { action as GithubPullRequestActions ); const isClosed = action === GithubPullRequestActions.CLOSED; - const isSynchronized = action === GithubPullRequestActions.SYNCHRONIZE; let lifecycleConfig = {} as LifecycleYamlConfigOptions; let pullRequest: PullRequest, repository: Repository | undefined, build: Build; @@ -279,33 +278,6 @@ export default class GithubService extends Service { labels: labels.map((l) => l.name), ...extractContextForQueue(), }); - } else if (isSynchronized) { - if (branchSha && latestCommit !== branchSha) { - await pullRequest.$query().patch({ latestCommit: branchSha }); - } - - if (status !== PullRequestStatus.OPEN || pullRequestState?.deployOnUpdate !== true) { - getLogger({}).info( - `PR sync decision: repo=${fullName} branch=${branch} pullRequestId=${pullRequestId} decision=no-deploy deployOnUpdate=${pullRequestState?.deployOnUpdate}` - ); - return; - } - - build = await this.db.models.Build.findOne({ - pullRequestId, - }); - if (!build) { - getLogger({}).warn(`Build: not found for synchronized PR repo=${fullName}/${branch}`); - return; - } - - getLogger({}).info( - `PR sync decision: repo=${fullName} branch=${branch} pullRequestId=${pullRequestId} decision=queue-build` - ); - await this.db.services.BuildService.enqueueResolveAndDeployBuild({ - buildId: build.id, - ...extractContextForQueue(), - }); } } catch (error) { getLogger().fatal({ error }, `Github: PR event handling failed repo=${fullName} branch=${branch}`);