diff --git a/.github/workflows/tag-and-release.yaml b/.github/workflows/tag-and-release.yaml index 0f6755c..9b90269 100644 --- a/.github/workflows/tag-and-release.yaml +++ b/.github/workflows/tag-and-release.yaml @@ -39,3 +39,4 @@ jobs: with: token: ${{ secrets.GITHUB_TOKEN }} tag: ${{ needs.tag.outputs.tag }} + body: ${{ github.event.head_commit.message }} diff --git a/README.md b/README.md index 7ffad59..cf57f8c 100644 --- a/README.md +++ b/README.md @@ -87,19 +87,22 @@ use { This plugin requires an auth token to connect to Gitlab. The token can be set in the root directory of the project in a `.gitlab.nvim` environment file, or can be set via a shell environment variable called `GITLAB_TOKEN` instead. If both are present, the `.gitlab.nvim` file will take precedence. -Optionally provide a GITLAB_URL environment variable (or gitlab_url value in the `.gitlab.nvim` file) to connect to a self-hosted Gitlab instance. This is optional, use ONLY for self-hosted instances. +Optionally provide a GITLAB_URL environment variable (or gitlab_url value in the `.gitlab.nvim` file) to connect to a self-hosted Gitlab instance. This is optional, use ONLY for self-hosted instances. Here's what they'd look like as environment variables: + +```bash +export GITLAB_TOKEN="your_gitlab_token" +export GITLAB_URL="https://my-personal-gitlab-instance.com/" +``` + +And as a `.gitlab.nvim` file: ``` auth_token=your_gitlab_token gitlab_url=https://my-personal-gitlab-instance.com/ ``` -If you don't want to write these into a dotfile, you may provide them via shell variables. These will be overridden by the dotfile if it is present: +The plugin will look for the `.gitlab.nvim` file in the root of the current project by default. However, you may provide a custom path to the configuration file via the `config_path` option. This must be an absolute path to the directory that holds your `.gitlab.nvim` file. -```bash -export GITLAB_TOKEN="your_gitlab_token" -export GITLAB_URL="https://my-personal-gitlab-instance.com/" -``` ## Configuring the Plugin @@ -109,6 +112,7 @@ Here is the default setup function. All of these values are optional, and if you require("gitlab").setup({ port = nil, -- The port of the Go server, which runs in the background, if omitted or `nil` the port will be chosen automatically log_path = vim.fn.stdpath("cache") .. "/gitlab.nvim.log", -- Log path for the Go server + config_path = nil, -- Custom path for `.gitlab.nvim` file, please read the "Connecting to Gitlab" section debug = { go_request = false, go_response = false }, -- Which values to log attachment_dir = nil, -- The local directory for files (see the "summary" section) popup = { -- The popup for comment creation, editing, and replying diff --git a/lua/gitlab/state.lua b/lua/gitlab/state.lua index 2560773..cf32594 100644 --- a/lua/gitlab/state.lua +++ b/lua/gitlab/state.lua @@ -11,6 +11,7 @@ M.settings = { port = nil, -- choose random port debug = { go_request = false, go_response = false }, log_path = (vim.fn.stdpath("cache") .. "/gitlab.nvim.log"), + config_path = nil, reviewer = "diffview", attachment_dir = "", popup = { @@ -133,14 +134,18 @@ M.setPluginConfiguration = function() return true end - local base_path = vim.fn.trim(vim.fn.system({ "git", "rev-parse", "--show-toplevel" })) - if vim.v.shell_error ~= 0 then - u.notify(string.format("Could not get base directory: %s", base_path), vim.log.levels.ERROR) - return false + local base_path + if M.settings.config_path ~= nil then + base_path = M.settings.config_path + else + base_path = vim.fn.trim(vim.fn.system({ "git", "rev-parse", "--show-toplevel" })) + if vim.v.shell_error ~= 0 then + u.notify(string.format("Could not get base directory: %s", base_path), vim.log.levels.ERROR) + return false + end end local config_file_path = base_path .. M.settings.file_separator .. ".gitlab.nvim" - local config_file_content = u.read_file(config_file_path) local file_properties = {}