Skip to content

Commit

Permalink
Merge branch 'master' into fix-error-on-closing-pr
Browse files Browse the repository at this point in the history
  • Loading branch information
pwntester authored Nov 28, 2024
2 parents c264a33 + 4be5acc commit 4706a52
Show file tree
Hide file tree
Showing 21 changed files with 437 additions and 306 deletions.
9 changes: 9 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
labels:
- "CI/CD"
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: JohnnyMorganz/stylua-action@v1
- uses: JohnnyMorganz/stylua-action@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --check lua/
4 changes: 2 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ jobs:
manager: sudo apt-get
packages: -y fd-find
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- run: date +%F > todays-date
- name: Restore from todays cache
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: _neovim
key: ${{ runner.os }}-${{ matrix.url }}-${{ hashFiles('todays-date') }}
Expand Down
4 changes: 4 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
---
ci:
autofix_prs: false

repos:
- repo: https://github.com/JohnnyMorganz/StyLua
rev: v0.20.0
Expand Down
148 changes: 74 additions & 74 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -168,89 +168,89 @@ require"octo".setup({
mappings_disable_default = false, -- disable default mappings if true, but will still adapt user mappings
mappings = {
issue = {
close_issue = { lhs = "<leader>ic", desc = "close issue" },
reopen_issue = { lhs = "<leader>io", desc = "reopen issue" },
list_issues = { lhs = "<leader>il", desc = "list open issues on same repo" },
close_issue = { lhs = "<localleader>ic", desc = "close issue" },
reopen_issue = { lhs = "<localleader>io", desc = "reopen issue" },
list_issues = { lhs = "<localleader>il", desc = "list open issues on same repo" },
reload = { lhs = "<C-r>", desc = "reload issue" },
open_in_browser = { lhs = "<C-b>", desc = "open issue in browser" },
copy_url = { lhs = "<C-y>", desc = "copy url to system clipboard" },
add_assignee = { lhs = "<leader>aa", desc = "add assignee" },
remove_assignee = { lhs = "<leader>ad", desc = "remove assignee" },
create_label = { lhs = "<leader>lc", desc = "create label" },
add_label = { lhs = "<leader>la", desc = "add label" },
remove_label = { lhs = "<leader>ld", desc = "remove label" },
goto_issue = { lhs = "<leader>gi", desc = "navigate to a local repo issue" },
add_comment = { lhs = "<leader>ca", desc = "add comment" },
delete_comment = { lhs = "<leader>cd", desc = "delete comment" },
add_assignee = { lhs = "<localleader>aa", desc = "add assignee" },
remove_assignee = { lhs = "<localleader>ad", desc = "remove assignee" },
create_label = { lhs = "<localleader>lc", desc = "create label" },
add_label = { lhs = "<localleader>la", desc = "add label" },
remove_label = { lhs = "<localleader>ld", desc = "remove label" },
goto_issue = { lhs = "<localleader>gi", desc = "navigate to a local repo issue" },
add_comment = { lhs = "<localleader>ca", desc = "add comment" },
delete_comment = { lhs = "<localleader>cd", desc = "delete comment" },
next_comment = { lhs = "]c", desc = "go to next comment" },
prev_comment = { lhs = "[c", desc = "go to previous comment" },
react_hooray = { lhs = "<leader>rp", desc = "add/remove 🎉 reaction" },
react_heart = { lhs = "<leader>rh", desc = "add/remove ❤️ reaction" },
react_eyes = { lhs = "<leader>re", desc = "add/remove 👀 reaction" },
react_thumbs_up = { lhs = "<leader>r+", desc = "add/remove 👍 reaction" },
react_thumbs_down = { lhs = "<leader>r-", desc = "add/remove 👎 reaction" },
react_rocket = { lhs = "<leader>rr", desc = "add/remove 🚀 reaction" },
react_laugh = { lhs = "<leader>rl", desc = "add/remove 😄 reaction" },
react_confused = { lhs = "<leader>rc", desc = "add/remove 😕 reaction" },
react_hooray = { lhs = "<localleader>rp", desc = "add/remove 🎉 reaction" },
react_heart = { lhs = "<localleader>rh", desc = "add/remove ❤️ reaction" },
react_eyes = { lhs = "<localleader>re", desc = "add/remove 👀 reaction" },
react_thumbs_up = { lhs = "<localleader>r+", desc = "add/remove 👍 reaction" },
react_thumbs_down = { lhs = "<localleader>r-", desc = "add/remove 👎 reaction" },
react_rocket = { lhs = "<localleader>rr", desc = "add/remove 🚀 reaction" },
react_laugh = { lhs = "<localleader>rl", desc = "add/remove 😄 reaction" },
react_confused = { lhs = "<localleader>rc", desc = "add/remove 😕 reaction" },
},
pull_request = {
checkout_pr = { lhs = "<leader>po", desc = "checkout PR" },
merge_pr = { lhs = "<leader>pm", desc = "merge commit PR" },
squash_and_merge_pr = { lhs = "<leader>psm", desc = "squash and merge PR" },
rebase_and_merge_pr = { lhs = "<leader>prm", desc = "rebase and merge PR" },
list_commits = { lhs = "<leader>pc", desc = "list PR commits" },
list_changed_files = { lhs = "<leader>pf", desc = "list PR changed files" },
show_pr_diff = { lhs = "<leader>pd", desc = "show PR diff" },
add_reviewer = { lhs = "<leader>va", desc = "add reviewer" },
remove_reviewer = { lhs = "<leader>vd", desc = "remove reviewer request" },
close_issue = { lhs = "<leader>ic", desc = "close PR" },
reopen_issue = { lhs = "<leader>io", desc = "reopen PR" },
list_issues = { lhs = "<leader>il", desc = "list open issues on same repo" },
checkout_pr = { lhs = "<localleader>po", desc = "checkout PR" },
merge_pr = { lhs = "<localleader>pm", desc = "merge commit PR" },
squash_and_merge_pr = { lhs = "<localleader>psm", desc = "squash and merge PR" },
rebase_and_merge_pr = { lhs = "<localleader>prm", desc = "rebase and merge PR" },
list_commits = { lhs = "<localleader>pc", desc = "list PR commits" },
list_changed_files = { lhs = "<localleader>pf", desc = "list PR changed files" },
show_pr_diff = { lhs = "<localleader>pd", desc = "show PR diff" },
add_reviewer = { lhs = "<localleader>va", desc = "add reviewer" },
remove_reviewer = { lhs = "<localleader>vd", desc = "remove reviewer request" },
close_issue = { lhs = "<localleader>ic", desc = "close PR" },
reopen_issue = { lhs = "<localleader>io", desc = "reopen PR" },
list_issues = { lhs = "<localleader>il", desc = "list open issues on same repo" },
reload = { lhs = "<C-r>", desc = "reload PR" },
open_in_browser = { lhs = "<C-b>", desc = "open PR in browser" },
copy_url = { lhs = "<C-y>", desc = "copy url to system clipboard" },
goto_file = { lhs = "gf", desc = "go to file" },
add_assignee = { lhs = "<leader>aa", desc = "add assignee" },
remove_assignee = { lhs = "<leader>ad", desc = "remove assignee" },
create_label = { lhs = "<leader>lc", desc = "create label" },
add_label = { lhs = "<leader>la", desc = "add label" },
remove_label = { lhs = "<leader>ld", desc = "remove label" },
goto_issue = { lhs = "<leader>gi", desc = "navigate to a local repo issue" },
add_comment = { lhs = "<leader>ca", desc = "add comment" },
delete_comment = { lhs = "<leader>cd", desc = "delete comment" },
add_assignee = { lhs = "<localleader>aa", desc = "add assignee" },
remove_assignee = { lhs = "<localleader>ad", desc = "remove assignee" },
create_label = { lhs = "<localleader>lc", desc = "create label" },
add_label = { lhs = "<localleader>la", desc = "add label" },
remove_label = { lhs = "<localleader>ld", desc = "remove label" },
goto_issue = { lhs = "<localleader>gi", desc = "navigate to a local repo issue" },
add_comment = { lhs = "<localleader>ca", desc = "add comment" },
delete_comment = { lhs = "<localleader>cd", desc = "delete comment" },
next_comment = { lhs = "]c", desc = "go to next comment" },
prev_comment = { lhs = "[c", desc = "go to previous comment" },
react_hooray = { lhs = "<leader>rp", desc = "add/remove 🎉 reaction" },
react_heart = { lhs = "<leader>rh", desc = "add/remove ❤️ reaction" },
react_eyes = { lhs = "<leader>re", desc = "add/remove 👀 reaction" },
react_thumbs_up = { lhs = "<leader>r+", desc = "add/remove 👍 reaction" },
react_thumbs_down = { lhs = "<leader>r-", desc = "add/remove 👎 reaction" },
react_rocket = { lhs = "<leader>rr", desc = "add/remove 🚀 reaction" },
react_laugh = { lhs = "<leader>rl", desc = "add/remove 😄 reaction" },
react_confused = { lhs = "<leader>rc", desc = "add/remove 😕 reaction" },
review_start = { lhs = "<leader>vs", desc = "start a review for the current PR" },
review_resume = { lhs = "<leader>vr", desc = "resume a pending review for the current PR" },
react_hooray = { lhs = "<localleader>rp", desc = "add/remove 🎉 reaction" },
react_heart = { lhs = "<localleader>rh", desc = "add/remove ❤️ reaction" },
react_eyes = { lhs = "<localleader>re", desc = "add/remove 👀 reaction" },
react_thumbs_up = { lhs = "<localleader>r+", desc = "add/remove 👍 reaction" },
react_thumbs_down = { lhs = "<localleader>r-", desc = "add/remove 👎 reaction" },
react_rocket = { lhs = "<localleader>rr", desc = "add/remove 🚀 reaction" },
react_laugh = { lhs = "<localleader>rl", desc = "add/remove 😄 reaction" },
react_confused = { lhs = "<localleader>rc", desc = "add/remove 😕 reaction" },
review_start = { lhs = "<localleader>vs", desc = "start a review for the current PR" },
review_resume = { lhs = "<localleader>vr", desc = "resume a pending review for the current PR" },
},
review_thread = {
goto_issue = { lhs = "<leader>gi", desc = "navigate to a local repo issue" },
add_comment = { lhs = "<leader>ca", desc = "add comment" },
add_suggestion = { lhs = "<leader>sa", desc = "add suggestion" },
delete_comment = { lhs = "<leader>cd", desc = "delete comment" },
goto_issue = { lhs = "<localleader>gi", desc = "navigate to a local repo issue" },
add_comment = { lhs = "<localleader>ca", desc = "add comment" },
add_suggestion = { lhs = "<localleader>sa", desc = "add suggestion" },
delete_comment = { lhs = "<localleader>cd", desc = "delete comment" },
next_comment = { lhs = "]c", desc = "go to next comment" },
prev_comment = { lhs = "[c", desc = "go to previous comment" },
select_next_entry = { lhs = "]q", desc = "move to next changed file" },
select_prev_entry = { lhs = "[q", desc = "move to previous changed file" },
select_first_entry = { lhs = "[Q", desc = "move to first changed file" },
select_last_entry = { lhs = "]Q", desc = "move to last changed file" },
close_review_tab = { lhs = "<C-c>", desc = "close review tab" },
react_hooray = { lhs = "<leader>rp", desc = "add/remove 🎉 reaction" },
react_heart = { lhs = "<leader>rh", desc = "add/remove ❤️ reaction" },
react_eyes = { lhs = "<leader>re", desc = "add/remove 👀 reaction" },
react_thumbs_up = { lhs = "<leader>r+", desc = "add/remove 👍 reaction" },
react_thumbs_down = { lhs = "<leader>r-", desc = "add/remove 👎 reaction" },
react_rocket = { lhs = "<leader>rr", desc = "add/remove 🚀 reaction" },
react_laugh = { lhs = "<leader>rl", desc = "add/remove 😄 reaction" },
react_confused = { lhs = "<leader>rc", desc = "add/remove 😕 reaction" },
react_hooray = { lhs = "<localleader>rp", desc = "add/remove 🎉 reaction" },
react_heart = { lhs = "<localleader>rh", desc = "add/remove ❤️ reaction" },
react_eyes = { lhs = "<localleader>re", desc = "add/remove 👀 reaction" },
react_thumbs_up = { lhs = "<localleader>r+", desc = "add/remove 👍 reaction" },
react_thumbs_down = { lhs = "<localleader>r-", desc = "add/remove 👎 reaction" },
react_rocket = { lhs = "<localleader>rr", desc = "add/remove 🚀 reaction" },
react_laugh = { lhs = "<localleader>rl", desc = "add/remove 😄 reaction" },
react_confused = { lhs = "<localleader>rc", desc = "add/remove 😕 reaction" },
},
submit_win = {
approve_review = { lhs = "<C-a>", desc = "approve review" },
Expand All @@ -259,37 +259,37 @@ require"octo".setup({
close_review_tab = { lhs = "<C-c>", desc = "close review tab" },
},
review_diff = {
submit_review = { lhs = "<leader>vs", desc = "submit review" },
discard_review = { lhs = "<leader>vd", desc = "discard review" },
add_review_comment = { lhs = "<leader>ca", desc = "add a new review comment" },
add_review_suggestion = { lhs = "<leader>sa", desc = "add a new review suggestion" },
focus_files = { lhs = "<leader>e", desc = "move focus to changed file panel" },
toggle_files = { lhs = "<leader>b", desc = "hide/show changed files panel" },
submit_review = { lhs = "<localleader>vs", desc = "submit review" },
discard_review = { lhs = "<localleader>vd", desc = "discard review" },
add_review_comment = { lhs = "<localleader>ca", desc = "add a new review comment" },
add_review_suggestion = { lhs = "<localleader>sa", desc = "add a new review suggestion" },
focus_files = { lhs = "<localleader>e", desc = "move focus to changed file panel" },
toggle_files = { lhs = "<localleader>b", desc = "hide/show changed files panel" },
next_thread = { lhs = "]t", desc = "move to next thread" },
prev_thread = { lhs = "[t", desc = "move to previous thread" },
select_next_entry = { lhs = "]q", desc = "move to next changed file" },
select_prev_entry = { lhs = "[q", desc = "move to previous changed file" },
select_first_entry = { lhs = "[Q", desc = "move to first changed file" },
select_last_entry = { lhs = "]Q", desc = "move to last changed file" },
close_review_tab = { lhs = "<C-c>", desc = "close review tab" },
toggle_viewed = { lhs = "<leader><space>", desc = "toggle viewer viewed state" },
toggle_viewed = { lhs = "<localleader><space>", desc = "toggle viewer viewed state" },
goto_file = { lhs = "gf", desc = "go to file" },
},
file_panel = {
submit_review = { lhs = "<leader>vs", desc = "submit review" },
discard_review = { lhs = "<leader>vd", desc = "discard review" },
submit_review = { lhs = "<localleader>vs", desc = "submit review" },
discard_review = { lhs = "<localleader>vd", desc = "discard review" },
next_entry = { lhs = "j", desc = "move to next changed file" },
prev_entry = { lhs = "k", desc = "move to previous changed file" },
select_entry = { lhs = "<cr>", desc = "show selected changed file diffs" },
refresh_files = { lhs = "R", desc = "refresh changed files panel" },
focus_files = { lhs = "<leader>e", desc = "move focus to changed file panel" },
toggle_files = { lhs = "<leader>b", desc = "hide/show changed files panel" },
focus_files = { lhs = "<localleader>e", desc = "move focus to changed file panel" },
toggle_files = { lhs = "<localleader>b", desc = "hide/show changed files panel" },
select_next_entry = { lhs = "]q", desc = "move to next changed file" },
select_prev_entry = { lhs = "[q", desc = "move to previous changed file" },
select_first_entry = { lhs = "[Q", desc = "move to first changed file" },
select_last_entry = { lhs = "]Q", desc = "move to last changed file" },
close_review_tab = { lhs = "<C-c>", desc = "close review tab" },
toggle_viewed = { lhs = "<leader><space>", desc = "toggle viewer viewed state" },
toggle_viewed = { lhs = "<localleader><space>", desc = "toggle viewer viewed state" },
},
},
})
Expand Down Expand Up @@ -443,7 +443,7 @@ Octo search assignee:pwntester is:pr
- Enter review mode for the current branch with `Octo review`. Alternatively open the PR (e.g. `Octo <PR url>` or `Octo pr list` or `Octo pr edit <PR number>`) then use `Octo review` in the PR buffer to enter review mode for a specific PR.
- A new tab will show a panel with changed files and two windows showing the diff on any of them.
- Change panel entries with `]q` and `[q` or by selecting an entry in the window
- Add comments with `<leader>ca` or suggestions with `<leader>sa` on single or multiple visual-selected lines
- Add comments with `<localleader>ca` or suggestions with `<localleader>sa` on single or multiple visual-selected lines
- A new buffer will appear in the alternate diff window. The cursor will be positioned in the new buffer
- When ready, save the buffer to commit changes to GitHub
- Move back to the diff window and move the cursor, the thread buffer will hide
Expand Down
2 changes: 1 addition & 1 deletion doc/octo.txt
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ PR REVIEW *octo-pr-review*
* Start a review with `Octo review start` or resume a pending review with `Octo review resume`
A new tab will show a panel with changed files and two windows showing the diff on any of them.
Change panel entries with `]q` and `[q` or by selecting an entry in the window.
* Add comments with `<leader>ca` or suggestions with `<leader>sa` on single or
* Add comments with `<localleader>ca` or suggestions with `<localleader>sa` on single or
multiple visual-selected lines
* A new buffer will appear in the alternate diff window. Cursor will be
positioned in the new buffer
Expand Down
12 changes: 7 additions & 5 deletions lua/octo/commands.lua
Original file line number Diff line number Diff line change
Expand Up @@ -607,8 +607,10 @@ function M.delete_comment()
local split = string.match(bufname, "octo://.+/review/[^/]+/threads/([^/]+)/.*")
if split then
local layout = reviews.get_current_review().layout
local file = layout:cur_file()
local diff_win = file:get_win(split)
local file = layout:get_current_file()
if not file then
return
end
local thread_win = file:get_alternative_win(split)
local original_buf = file:get_alternative_buf(split)
-- move focus to the split containing the diff buffer
Expand Down Expand Up @@ -1437,7 +1439,7 @@ function M.reload(opts)
require("octo").load_buffer(opts)
end

function random_hex_color()
function M.random_hex_color()
local chars = { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F" }
math.randomseed(os.time())
local color = {}
Expand All @@ -1459,7 +1461,7 @@ function M.create_label(label)
local name, color, description
if label then
name = label
color = random_hex_color()
color = M.random_hex_color()
description = ""
else
vim.fn.inputsave()
Expand All @@ -1468,7 +1470,7 @@ function M.create_label(label)
description = vim.fn.input "Enter description: "
vim.fn.inputrestore()
if color == "" then
color = random_hex_color()
color = M.random_hex_color()
end
color = string.gsub(color, "#", "")
end
Expand Down
Loading

0 comments on commit 4706a52

Please sign in to comment.