Skip to content

Commit

Permalink
Merge pull request #669 from macovsky/display-auto-merge
Browse files Browse the repository at this point in the history
display auto-merge in pr view
  • Loading branch information
pwntester authored Nov 7, 2024
2 parents 650f33a + ab85598 commit 44060b7
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lua/octo/gh/graphql.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1873,6 +1873,10 @@ query($endCursor: String) {
}
mergeStateStatus
mergeable
autoMergeRequest {
enabledBy { login }
mergeMethod
}
}
}
}
Expand Down
11 changes: 11 additions & 0 deletions lua/octo/ui/writers.lua
Original file line number Diff line number Diff line change
Expand Up @@ -491,6 +491,17 @@ function M.write_details(bufnr, issue, update)
table.insert(details, merge_state_vt)
end

if not issue.merged and issue.autoMergeRequest ~= vim.NIL then
local auto_merge_vt = {
{ "Auto-merge: ", "OctoDetailsLabel" },
{ "ENABLED", "OctoStateApproved" },
{ " by " },
{ issue.autoMergeRequest.enabledBy.login, "OctoUser" },
{ " (" .. utils.auto_merge_method_map[issue.autoMergeRequest.mergeMethod] .. ")" },
}
table.insert(details, auto_merge_vt)
end

-- changes
local changes_vt = {
{ "Commits: ", "OctoDetailsLabel" },
Expand Down
6 changes: 6 additions & 0 deletions lua/octo/utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,12 @@ M.merge_state_message_map = {
UNSTABLE = "! UNSTABLE",
}

M.auto_merge_method_map = {
MERGE = "commit",
REBASE = "rebase",
SQUASH = "squash",
}

function M.trim(str)
if type(vim.fn.trim) == "function" then
return vim.fn.trim(str)
Expand Down

0 comments on commit 44060b7

Please sign in to comment.