File tree Expand file tree Collapse file tree 2 files changed +23
-9
lines changed
Expand file tree Collapse file tree 2 files changed +23
-9
lines changed Original file line number Diff line number Diff line change 11{
22 "name" : " auto-close-fixed-issues" ,
3- "version" : " 1.0.0 " ,
3+ "version" : " 1.0.1 " ,
44 "main" : " dist/index.js" ,
55 "files" : [
66 " dist" ,
Original file line number Diff line number Diff line change @@ -44,19 +44,33 @@ export namespace Action {
4444 )
4545 }
4646
47- const body = pr . body
4847 const issues : string [ ] = [ ]
49-
50- if ( body ) {
51- const re = / (?: (?: r e s o l v | c l o s | f i x ) e [ d s ] ? | f i x ) + # ( \d + ) / gi // https://regex101.com/r/5Zet3S/1
52- let match = re . exec ( body )
48+ const collect = ( body : string ) => {
49+ // @see : https://regex101.com/r/5Zet3S/1
50+ const regex = / (?: (?: r e s o l v | c l o s | f i x ) e [ d s ] ? | f i x ) + # ( \d + ) / gi
51+ let match = regex . exec ( body )
5352 while ( match ) {
54- issues . push ( match [ 1 ] )
55- core . info ( `Found fixed issue: #${ match [ 1 ] } .` )
56- match = re . exec ( body )
53+ if ( ! issues . includes ( match [ 1 ] ) ) {
54+ issues . push ( match [ 1 ] )
55+ core . info ( `Found fixed issue: #${ match [ 1 ] } .` )
56+ }
57+ match = regex . exec ( body )
5758 }
5859 }
5960
61+ if ( pr . body ) {
62+ collect ( pr . body )
63+ }
64+
65+ const { data : commits } = await octokit . pulls . listCommits ( {
66+ ...context . repo ,
67+ pull_number : pr . number ,
68+ } )
69+
70+ commits . forEach ( ( { commit } ) => {
71+ collect ( commit . message )
72+ } )
73+
6074 if ( issues . length === 0 ) {
6175 core . info ( `This pull request fixes no issue. Stepping out...` )
6276 return
You can’t perform that action at this time.
0 commit comments