Skip to content

Fix GitLab MR Not Updated Issue on Forked Repository #1892

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

Merged
merged 1 commit into from
Jan 22, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions pkg/provider/gitlab/gitlab.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,15 @@ func (v *Provider) SetClient(_ context.Context, run *params.Run, runevent *info.
}
v.Token = &runevent.Provider.Token

// In a scenario where the source repository is forked and a merge request (MR) is created on the upstream
// repository, runevent.SourceProjectID will not be 0 when SetClient is called from the pac-watcher code.
// This is because, in the controller, SourceProjectID is set in the annotation of the pull request,
// and runevent.SourceProjectID is set before SetClient is called. Therefore, we need to take
// the ID from runevent.SourceProjectID.
if runevent.SourceProjectID > 0 {
v.sourceProjectID = runevent.SourceProjectID
}

// if we don't have sourceProjectID (ie: incoming-webhook) then try to set
// it ASAP if we can.
if v.sourceProjectID == 0 && runevent.Organization != "" && runevent.Repository != "" {
Expand Down
Loading