-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.yml
104 lines (89 loc) · 4.05 KB
/
config.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
version: "1"
git_protocol: ssh
aliases:
co: pr checkout
ship: pr create --fill-first
pcomment: pr comment --editor
icomment: issue comment --editor
review: |
!gh pr view --comments $1 && gh pr diff $1 && gh pr review $1;
if [ $? -ne 0 ]; then
read -r -p "Open PR in [b]rowser or [v]im? [b/v/N] " REPLY
case $REPLY in
[yYbB]*) gh pr diff --web $1 ;;
[vV]*) nvim +"Octo issue edit $1" ;;
esac
fi
dl: '!GH_REPO="${3:-$GH_REPO}" gh api -H "accept: application/vnd.github.v3.raw" "repos/{owner}/{repo}/contents/$1" > "${2:-$1}"'
# https://github.com/benelan/gh-fzf
w: fzf workflow
v: fzf release
R: fzf repo
g: fzf gist
s: fzf search
code: |
!repo="$(gh repo view --json nameWithOwner --jq .nameWithOwner 2>/dev/null)"
[ -n "$repo" ] && [ "$repo" != "benelan/dotfiles" ] && filter="repo:$repo "
gh fzf search code "$filter" $@
commits: |
!repo="$(gh repo view --json nameWithOwner --jq .nameWithOwner 2>/dev/null)"
[ -n "$repo" ] && [ "$repo" != "benelan/dotfiles" ] && filter="repo:$repo "
SHELL="bash" FZF_DEFAULT_OPTS="$FZF_DEFAULT_OPS
--bind='alt-y:execute-silent:cb<<<{2}'
" gh fzf search commits "$filter" $@
r: |
!FZF_DEFAULT_OPTS="$FZF_DEFAULT_OPTS
--bind='alt-e:execute(gh run view --log-failed {-1})'
" gh fzf run $*
# m: |
# !FZF_DEFAULT_OPTS="$FZF_DEFAULT_OPTS
# --bind='alt-bspace:execute(
# gh api --silent --method DELETE /repos/{owner}/{repo}/milestones/{-1}
# )+reload(eval \"\$FZF_DEFAULT_COMMAND\")'
# " gh fzf milestone
i: |
!FZF_DEFAULT_OPTS="$FZF_DEFAULT_OPTS
--bind='alt-+:execute(gh issue edit --add-assignee @me {1})+refresh-preview'
--bind='alt--:execute(gh issue edit --remove-assignee @me {1})+refresh-preview'
--bind='alt-N:execute<nvim +\"Octo issue edit \$(echo {1} | cut -c 2-)\">+refresh-preview'
--bind='alt-D:execute(gh issue edit {1} --add-label \"2 - in development\" --remove-label \"1 - assigned\")+refresh-preview'
--bind='alt-I:execute(gh issue edit {1} --add-label \"3 - installed\")+refresh-preview'
--bind='alt-@:execute(
selected=\"\$(gh fzf milestone)\"
[ -n \"\$selected\" ] && gh issue edit --milestone \"\$selected\" {1}
)'
--bind='alt-.:reload(
current=\$(
gh api --paginate --jq \"map(select(.due_on != null)) | .[].number\" \
\"/repos/{owner}/{repo}/milestones?sort=due_on&state=open&direction=asc\" |
head -n1
)
eval \"\$FZF_DEFAULT_COMMAND \${current:+--milestone \$current}\"
)'
" gh fzf issue $*
p: |
!FZF_DEFAULT_OPTS="$FZF_DEFAULT_OPTS
--bind='alt-N:execute<nvim +\"Octo pr edit \$(echo {1} | cut -c 2-)\">+refresh-preview'
--bind='alt-m:execute(gh pr merge --delete-branch --squash {1})+refresh-preview'
--bind='alt-v:execute(gh pr edit {1} --remove-label \"pr ready for visual snapshots\" --add-label \"pr ready for visual snapshots\")+refresh-preview'
--bind='alt-V:execute(gh pr edit --add-label \"skip visual snapshots\" {1})+refresh-preview'
--bind='alt-R:execute(gh review {1})+refresh-preview'
--bind='alt-+:execute(echo \"Press ctrl-c to cancel pr approval...\" && sleep 1 && gh pr review --body \":+1:\" --approve {1})+refresh-preview'
" gh fzf pr $*
itruncated: "!GH_FZF_TRUNCATE_FIELDS=true gh i $*"
ptruncated: "!GH_FZF_TRUNCATE_FIELDS=true gh p $*"
ime: "i --assignee @me"
pme: "p --author @me"
toreview: '!gh p -S\"-review:approved -is:draft\"'
todo: |
!gh i --assignee @me --milestone \'$(
gh api '/repos/{owner}/{repo}/milestones?sort=due_on&state=open&direction=asc' \
--paginate --jq '(try ("'$1'" | tonumber) catch 0) as $index | map(select(
.due_on != null
and (.due_on | fromdateiso8601 | strftime("%Y-%m-%d")) >= (now | strftime("%Y-%m-%d"))
)) | .[$index].title'
)\'
# https://github.com/meiji163/gh-notify
n: '!FZF_DEFAULT_OPTS="$FZF_DEFAULT_OPTS --no-hscroll" gh notify "$@"'
# https://github.com/benelan/gh-notify-desktop
nd: notify-desktop