-
Notifications
You must be signed in to change notification settings - Fork 39
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
Ability to fetch gitlab info (e.g. pipeline status) #231
Comments
Hello @agscala I've created an MR (see above) that will allow you to query the underlying data behind this plugin. This includes the pipeline data that is used to build the pipeline popup, the currently authenticated user, etc. The data you're looking for will be available in the response data under require("gitlab").data({ { type = "info", refresh = true } }, function(data)
vim.print(data.info.pipeline)
end) If you'd like more data please see the |
I've gotten this working for my own Lualine, which I also use, it works like this. In my own personal configuration I have some helpers to tell whether I'm in a Gitlab project and whether I'm looking at a feature branch: local pipeline_info = ""
local outbound = false
local get_mr_info = {
function()
if outbound then
return pipeline_info
end
outbound = true
require("git-helpers").is_gitlab_project(function()
require("gitlab").data({ { type = "pipeline", refresh = true } },
function(data)
-- At this point you can reference the pipeline information in the callback function
-- at data.pipeline.latest_pipeline.status, or you can use some of the
-- utility functions I've added to the pipeline package to make this easier, like the one below:
pipeline_info = "Gitlab Pipeline: " .. (require("gitlab.actions.pipeline").get_pipeline_icon(true) or "")
outbound = false
end)
end)
return pipeline_info
end,
padding = { left = 0, right = 0 }, -- Adjust padding as needed
}
return {
'nvim-lualine/lualine.nvim',
dependencies = { 'nvim-tree/nvim-web-devicons' },
config = function()
require("lualine").setup({
sections = {
lualine_a = {},
lualine_b = {},
lualine_c = { get_mr_info },
},
})
end
} |
Feature Description
I'd like to be able to integrate the pipeline status into my lualine config, but there doesn't seem to be any way to simply return the data.
It would be great if there was an API to give me information about the current MR for use programmatically.
The text was updated successfully, but these errors were encountered: