class Dependabot::PullRequestCreator::PrNamePrefixer

Public Instance Methods

gitea_client_for_source() click to toggle source
# File lib/hack/dependabot-core/common/lib/dependabot/pull_request_creator/pr_name_prefixer.rb, line 56
def gitea_client_for_source
  @gitea_client_for_source ||=
    Dependabot::Clients::Gitea.for_source(
      source: source,
      credentials: credentials
    )
end
last_dependabot_commit_message() click to toggle source
# File lib/hack/dependabot-core/common/lib/dependabot/pull_request_creator/pr_name_prefixer.rb, line 30
def last_dependabot_commit_message
  @last_dependabot_commit_message ||=
    case source.provider
    when "github" then last_github_dependabot_commit_message
    when "gitlab" then last_gitlab_dependabot_commit_message
    when "azure" then last_azure_dependabot_commit_message
    when "gitea" then last_gitea_dependabot_commit_message
    when "codecommit" then last_codecommit_dependabot_commit_message
    else raise "Unsupported provider: #{source.provider}"
    end
end
last_gitea_dependabot_commit_message() click to toggle source
# File lib/hack/dependabot-core/common/lib/dependabot/pull_request_creator/pr_name_prefixer.rb, line 42
def last_gitea_dependabot_commit_message
  recent_gitea_commits.
    reject { |c| c.commit&.message&.start_with?("Merge") }.
    find { |c| c.commit.author&.name&.include?("dependabot") }&.
    commit&.
    message&.
    strip
end
recent_commit_messages() click to toggle source

override

# File lib/hack/dependabot-core/common/lib/dependabot/pull_request_creator/pr_name_prefixer.rb, line 9
def recent_commit_messages
  case source.provider
  when "github" then recent_github_commit_messages
  when "gitlab" then recent_gitlab_commit_messages
  when "azure" then recent_azure_commit_messages
  when "gitea" then recent_gitea_commit_messages
  when "codecommit" then recent_codecommit_commit_messages
  else raise "Unsupported provider: #{source.provider}"
  end
end
recent_gitea_commit_messages() click to toggle source
# File lib/hack/dependabot-core/common/lib/dependabot/pull_request_creator/pr_name_prefixer.rb, line 20
def recent_gitea_commit_messages
  recent_gitea_commits.
    reject { |c| c.author&.type == "Bot" }.
    reject { |c| c.commit&.message&.start_with?("Merge") }.
    map(&:commit).
    map(&:message).
    compact.
    map(&:strip)
end
recent_gitea_commits() click to toggle source
# File lib/hack/dependabot-core/common/lib/dependabot/pull_request_creator/pr_name_prefixer.rb, line 51
def recent_gitea_commits
  @recent_gitea_commits ||=
    gitea_client_for_source.commits
end