diff --git a/lua/telescope/_extensions/gh_actions.lua b/lua/telescope/_extensions/gh_actions.lua index 964f72c..311ced6 100644 --- a/lua/telescope/_extensions/gh_actions.lua +++ b/lua/telescope/_extensions/gh_actions.lua @@ -16,13 +16,13 @@ local function close_telescope_prompt(prompt_bufnr) end return tmp_table[1] end -local function gh_qf_action(pr_number, action, msg) - if pr_number == nil then +local function gh_qf_action(number, action, msg) + if number == nil then return end local qf_entry = { { - text = msg .. pr_number .. ", please wait ...", + text = msg .. number .. ", please wait ...", } } local on_output = function(_, line) @@ -36,7 +36,7 @@ local function gh_qf_action(pr_number, action, msg) local job = Job:new { enable_recording = true, command = "gh", - args = flatten { "pr", action, pr_number }, + args = flatten { action, number }, on_stdout = on_output, on_stderr = on_output, @@ -45,7 +45,7 @@ local function gh_qf_action(pr_number, action, msg) pcall(vim.schedule_wrap(function() vim.cmd [[cclose]] end)) - print "Pull request completed" + print "GH action completed" end end, } @@ -92,9 +92,14 @@ A.gh_issue_insert_markdown_link = function(prompt_bufnr) end end +A.gh_issue_develop = function(prompt_bufnr) + local issue_number = close_telescope_prompt(prompt_bufnr) + gh_qf_action(issue_number, { "issue", "develop", "--checkout" }, "Checking out issue #") +end + A.gh_pr_checkout = function(prompt_bufnr) local pr_number = close_telescope_prompt(prompt_bufnr) - gh_qf_action(pr_number, "checkout", "Checking out pull request #") + gh_qf_action(pr_number, { "pr", "checkout" }, "Checking out pull request #") end A.gh_web_view = function(type) @@ -227,13 +232,13 @@ A.gh_pr_merge = function(prompt_bufnr) action = "-s" end if action ~= nil then - gh_qf_action(pr_number, { "merge", action }, "Merge pull request #") + gh_qf_action(pr_number, { "pr", "merge", action }, "Merge pull request #") end end A.gh_pr_approve = function(prompt_bufnr) local pr_number = close_telescope_prompt(prompt_bufnr) - gh_qf_action(pr_number, { "review", "--approve" }, "Approve pull request #") + gh_qf_action(pr_number, { "pr", "review", "--approve" }, "Approve pull request #") end A.gh_run_web_view = function(prompt_bufnr) diff --git a/lua/telescope/_extensions/gh_builtin.lua b/lua/telescope/_extensions/gh_builtin.lua index f29fd8d..e076684 100644 --- a/lua/telescope/_extensions/gh_builtin.lua +++ b/lua/telescope/_extensions/gh_builtin.lua @@ -111,6 +111,7 @@ B.gh_issues = function(opts) actions.select_default:replace(gh_a.gh_issue_insert) map("i", "", gh_a.gh_web_view "issue") map("i", "", gh_a.gh_issue_insert_markdown_link) + map("i", "", gh_a.gh_issue_develop) return true end, }):find()