Commit 034d1d02 authored by Balasankar "Balu" C's avatar Balasankar "Balu" C

Add API endpoint to get a commit's GPG signature

parent c6016ac8
......@@ -323,6 +323,22 @@ module API
present paginate(commit.merge_requests), with: Entities::MergeRequestBasic
end
desc "Get a commit's GPG signature" do
success Entities::CommitSignature
end
params do
requires :sha, type: String, desc: 'A commit sha, or the name of a branch or tag'
end
get ':id/repository/commits/:sha/signature', requirements: API::COMMIT_ENDPOINT_REQUIREMENTS do
commit = user_project.commit(params[:sha])
not_found! 'Commit' unless commit
signature = commit.signature
not_found! 'GPG Signature' unless signature
present signature, with: Entities::CommitSignature
end
end
end
end
......@@ -392,6 +392,13 @@ module API
expose :project_id
end
class CommitSignature < Grape::Entity
expose :gpg_key_id
expose :gpg_key_primary_keyid, :gpg_key_user_name, :gpg_key_user_email
expose :verification_status
expose :gpg_key_subkey_id
end
class BasicRef < Grape::Entity
expose :type, :name
end
......
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