1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-02-03 00:30:05 +08:00

Update release func

This commit is contained in:
wsdjeg 2017-11-05 22:57:47 +08:00
parent 7e54d3940c
commit a91a016609

View File

@ -23,15 +23,66 @@ function! SpaceVim#dev#releases#open() abort
endfunction
function! s:get_list_of_PRs() abort
let prs = github#api#issues#List_All_for_Repo('SpaceVim', 'SpaceVim',
\ {
\ 'state' : 'closed',
\ 'since' : s:time_of_last_release(),
\ })
return filter(prs, 'has_key(v:val, "pull_request")')
endfunction
function! s:time_of_last_release() abort
let last_release = github#api#repos#releases#latest('SpaceVim', 'SpaceVim')
if has_key(last_release, 'created_at')
return last_release.created_at
else
return ''
endif
endfunction
function! s:pr_to_list(pr) abort
return '- ' . a:pr.title . ' [#' . a:pr.number . '](' . a:pr.html_url . ')'
endfunction
function! SpaceVim#dev#releases#content()
let md = [
\ '### SpaceVim release ' . g:spacevim_version
\ ]
let adds = []
let changes = []
let fixs = []
let others = []
for pr in s:get_list_of_PRs()
if pr.title =~ '^ADD:'
call add(adds, s:pr_to_list(pr))
elseif pr.title =~ '^CHANGE:'
call add(changes, s:pr_to_list(pr))
elseif pr.title =~ '^FIX:'
call add(fixs, s:pr_to_list(pr))
else
call add(others, s:pr_to_list(pr))
endif
endfor
if !empty(adds)
call add(md, '')
call add(md, '#### New Features')
call add(md, '')
endif
if !empty(changes)
call add(md, '')
call add(md, '#### Feature Changes')
call add(md, '')
endif
if !empty(fixs)
call add(md, '')
call add(md, '#### Bug Fixs')
call add(md, '')
endif
if !empty(others)
call add(md, '')
call add(md, '#### Unmarked PRs')
call add(md, '')
endif
return md
endfunction