Commit d8151892 authored by Kamil Trzciński's avatar Kamil Trzciński

Merge branch...

Merge branch '32801-pipeline-by-external-pr-from-github-mirror-on-12-3-has-no-user-permissions-to-use-include' into 'master'

Ensure pipeline by External PR from GitHub Mirror starts with a user

See merge request gitlab-org/gitlab!19072
parents f80dd77c 8572eee7
---
title: Default current user to mirror user when creating pipelines for GitHub pull requests
merge_request: 19072
author:
type: fixed
...@@ -20,7 +20,7 @@ module API ...@@ -20,7 +20,7 @@ module API
def valid_github_signature? def valid_github_signature?
request.body.rewind request.body.rewind
token = project.external_webhook_token token = project.external_webhook_token.to_s
payload_body = request.body.read payload_body = request.body.read
signature = 'sha1=' + OpenSSL::HMAC.hexdigest(OpenSSL::Digest.new('sha1'), token, payload_body) signature = 'sha1=' + OpenSSL::HMAC.hexdigest(OpenSSL::Digest.new('sha1'), token, payload_body)
...@@ -43,7 +43,7 @@ module API ...@@ -43,7 +43,7 @@ module API
end end
def process_pull_request def process_pull_request
external_pull_request = ProcessGithubPullRequestEventService.new(project, current_user).execute(params) external_pull_request = ProcessGithubPullRequestEventService.new(project, mirror_user).execute(params)
if external_pull_request if external_pull_request
render_validation_error!(external_pull_request) render_validation_error!(external_pull_request)
...@@ -53,10 +53,14 @@ module API ...@@ -53,10 +53,14 @@ module API
end end
def start_pull_mirroring def start_pull_mirroring
result = StartPullMirroringService.new(project, current_user).execute result = StartPullMirroringService.new(project, mirror_user).execute
render_api_error!(result[:message], result[:http_status]) if result[:status] == :error render_api_error!(result[:message], result[:http_status]) if result[:status] == :error
end end
def mirror_user
current_user || project.mirror_user
end
end end
params do params do
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment