Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(gitlab): ensure getPrList() runtime integrity #32291

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

RahulGautamSingh
Copy link
Collaborator

Changes

Update the runtime pr list when a pr is updated

Context

Ref: #32040

Documentation (please check one with an [x])

  • I have updated the documentation, or
  • No documentation update is required

How I've tested my work (please select one)

I have verified these changes via:

  • Code inspection only, or
  • Newly added/modified unit tests, or
  • No unit tests but ran on a real repository, or
  • Both unit tests + ran on a real repository (locally)

@RahulGautamSingh RahulGautamSingh marked this pull request as ready for review November 7, 2024 14:19
lib/modules/platform/gitlab/index.ts Outdated Show resolved Hide resolved
Comment on lines 868 to 874
const updatedPr: Pr = massagePr({
number: updatedPrInfo.iid,
state: updatedPrInfo.state === 'opened' ? 'open' : updatedPrInfo.state,
title: updatedPrInfo.title,
createdAt: updatedPrInfo.created_at,
sourceBranch: updatedPrInfo.source_branch,
});
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar code to this seems duplicated throughout this gitlab module. Can any of it be consolidated?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment on lines 859 to 865
await gitlabApi.putJson<{
iid: number;
source_branch: string;
title: string;
state: string;
created_at: string;
}>(`projects/${config.repository}/merge_requests/${iid}`, { body })
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Create a type for that generic.

Can we use Zod here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I think this is necessary can we can start with Gitlab as the types are messy here. A task for another PR though as we need to also handle the other functions like createPr, getPrList, getPr, getBranchPr, and findPr.

Copy link
Member

@viceice viceice left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see open conversations

@RahulGautamSingh
Copy link
Collaborator Author

Blocked by: #32428

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants