gitlab-org--gitlab-foss/app/services/deploy_tokens/create_service.rb
Krasimir Angelov d745ff0431 Add username to deploy tokens
This new attribute is optional and used when set instead of the default
format `gitlab+deploy-token-#{id}`.

Empty usernames will be saved as null in the database.

Related to https://gitlab.com/gitlab-org/gitlab-ce/issues/50228.
2019-07-02 18:56:48 +00:00

11 lines
252 B
Ruby

# frozen_string_literal: true
module DeployTokens
class CreateService < BaseService
def execute
@project.deploy_tokens.create(params) do |deploy_token|
deploy_token.username = params[:username].presence
end
end
end
end