-
Notifications
You must be signed in to change notification settings - Fork 1.4k
[Projects] Fix prebuild association #5054
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
Conversation
|
/approve no-issue |
e4f5b78 to
d721e40
Compare
| if (project) { | ||
| project.cloneUrl = repository.clone_url; | ||
| await this.projectDB.storeProject(project); | ||
| const oldName = (ctx.payload as any)?.changes?.repository?.name?.from; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is undocumented stuff, I'm afraid. The event payload contains:
"changes": { "repository": { "name": { "from": "test-repo-123" } } }
To implement this in a robust way, we'd need to store repository.id to the project. next to the cloneUrl.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
makes sense. maybe put this as a TODO into the code
|
@AlexTugarev This will probably resolve #5065, right? |
| if (project) { | ||
| project.cloneUrl = repository.clone_url; | ||
| await this.projectDB.storeProject(project); | ||
| const oldName = (ctx.payload as any)?.changes?.repository?.name?.from; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
makes sense. maybe put this as a TODO into the code
| } | ||
|
|
||
| protected async findInstallationOwner(installationId: number): Promise<{user: User, project?: Project} | undefined> { | ||
| protected async findInstallationOwner(installationId: number, cloneURL: string): Promise<{user: User, project?: Project} | undefined> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this rather be two methods? (findUser(installationId) and findPRoject(cloneUrl))
Maybe at least name the method findInstallationOwnerAndProject
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
both make sense. will do!
|
/hold |
d721e40 to
e4d4917
Compare
|
LGTM label has been added. DetailsGit tree hash: c635928c608ca7b8e977fd7c129cd12805dc860c |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: AlexTugarev, svenefftinge Associated issue requirement bypassed by: AlexTugarev The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
/hold cancel |
This fixes a serious bug in the association of projects to prebuilds which are triggered on push events. Replacing all
findProjectByInstallationIdbyfindProjectByCloneUrl, because an installation can be used to create multiple projects this cannot be unambiguous.