Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: poc octo run list #638

Draft
wants to merge 24 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions lua/octo/commands.lua
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,16 @@ function M.setup()

-- supported commands
M.commands = {
run = {
list = function()
local function co_wrapper()
require("octo.workflow_runs").list()
end

local co = coroutine.create(co_wrapper)
coroutine.resume(co)
end,
},
actions = function()
M.actions()
end,
Expand Down
28 changes: 27 additions & 1 deletion lua/octo/config.lua
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
local vim = vim
local M = {}

---@alias OctoMappingsWindow "issue" | "pull_request" | "review_thread" | "submit_win" | "review_diff" | "file_panel" | "repo"
---@alias OctoMappingsWindow "issue" | "pull_request" | "review_thread" | "submit_win" | "review_diff" | "file_panel" | "repo" | "runs"
---@alias OctoMappingsList { [string]: table}
---@alias OctoPickers "telescope" | "fzf-lua"
---@alias OctoFocus "right" | "left"
Expand Down Expand Up @@ -40,6 +40,17 @@ local M = {}
---@field auto_show_threads boolean
---@field focus OctoFocus

---@class OctoConfigWorkflowIcons
---@field pending string
---@field skipped string
---@field in_progress string
---@field failed string
---@field succeeded string

---@class OctoConfigRuns
---@field icons OctoConfigWorkflowIcons
---@field refresh_interval_list number

---@class OctoConfigPR
---@field order_by OctoConfigOrderBy
---@field always_select_remote_on_create boolean
Expand Down Expand Up @@ -80,6 +91,7 @@ local M = {}
---@field ui OctoConfigUi
---@field issues OctoConfigIssues
---@field reviews OctoConfigReviews
---@field runs OctoConfigRuns
---@field pull_requests OctoConfigPR
---@field file_panel OctoConfigFilePanel
---@field colors OctoConfigColors
Expand Down Expand Up @@ -140,6 +152,16 @@ function M.get_default_values()
auto_show_threads = true,
focus = "right",
},
runs = {
refresh_interval_list = 30000,
icons = {
pending = "🕖",
in_progress = "🔄",
failed = "❌",
succeeded = "✅",
skipped = "⏩",
},
},
pull_requests = {
order_by = {
field = "CREATED_AT",
Expand Down Expand Up @@ -167,6 +189,10 @@ function M.get_default_values()
},
mappings_disable_default = false,
mappings = {
runs = {
open = { lhs = "<leader>o", desc = "view workflow run" },
refresh = { lhs = "<leader>r", desc = "refresh workflow runs list" },
},
issue = {
close_issue = { lhs = "<localleader>ic", desc = "close issue" },
reopen_issue = { lhs = "<localleader>io", desc = "reopen issue" },
Expand Down
2 changes: 2 additions & 0 deletions lua/octo/constants.lua
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ M.OCTO_EMPTY_MSG_VT_NS = vim.api.nvim_create_namespace "octo_empty_msg_vt"
M.OCTO_THREAD_HEADER_VT_NS = vim.api.nvim_create_namespace "octo_thread_header_vt"
M.OCTO_EVENT_VT_NS = vim.api.nvim_create_namespace "octo_event_vt"

M.OCTO_WORKFLOW_NS = vim.api.nvim_create_namespace "octo_workflow"

M.NO_BODY_MSG = "No description provided."

M.LONG_ISSUE_PATTERN = "([A-Za-z0-9_.-]+/[A-Za-z0-9_.-]+)#(%d+)"
Expand Down
Loading