Skip to content

Commit

Permalink
feat: automatically update MR status in Summary
Browse files Browse the repository at this point in the history
  • Loading branch information
jakubbortlik committed Nov 21, 2024
1 parent 21250b8 commit 339669e
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions lua/gitlab/actions/approvals.lua
Original file line number Diff line number Diff line change
@@ -1,13 +1,26 @@
local job = require("gitlab.job")
local state = require("gitlab.state")
local u = require("gitlab.utils")

local M = {}

local refresh_status_state = function(data)
u.notify(data.message, vim.log.levels.INFO)
state.load_new_state("info", function()
require("gitlab.actions.summary").update_summary_details()
end)
end

M.approve = function()
job.run_job("/mr/approve", "POST")
job.run_job("/mr/approve", "POST", nil, function(data)
refresh_status_state(data)
end)
end

M.revoke = function()
job.run_job("/mr/revoke", "POST")
job.run_job("/mr/revoke", "POST", nil, function(data)
refresh_status_state(data)
end)
end

return M

0 comments on commit 339669e

Please sign in to comment.