@@ -4,7 +4,7 @@ import fs from 'fs';
4
4
import path from 'path' ;
5
5
import getTypeGroup from './getTypeGroup' ;
6
6
import { GROUPS } from './constants' ;
7
- import { WriterOptions , CommitGroupLabel , Context , Reference } from './types' ;
7
+ import { WriterOptions , CommitGroupLabel , Context } from './types' ;
8
8
9
9
type GroupMap < T > = { [ K in CommitGroupLabel ] : T } ;
10
10
@@ -31,28 +31,8 @@ const sortWeights: GroupMap<number> = {
31
31
Internals : - 5 ,
32
32
} ;
33
33
34
- function createLink ( paths : string [ ] , context : Context , reference : Partial < Reference > = { } ) : string {
35
- const owner = reference . owner || context . owner ;
36
- const repository = reference . repository || context . repository ;
37
- const url : string [ ] = [ ] ;
38
-
39
- if ( repository ) {
40
- if ( context . host ) {
41
- url . push ( context . host ) ;
42
- }
43
-
44
- if ( owner ) {
45
- url . push ( owner ) ;
46
- }
47
-
48
- url . push ( repository ) ;
49
- } else {
50
- url . push ( context . repoUrl ) ;
51
- }
52
-
53
- url . push ( ...paths ) ;
54
-
55
- return url . join ( '/' ) ;
34
+ function createLink ( paths : string [ ] , context : Context ) : string {
35
+ return [ context . host , context . owner , context . repository , ...paths ] . filter ( Boolean ) . join ( '/' ) ;
56
36
}
57
37
58
38
const options : Partial < WriterOptions > = {
@@ -120,7 +100,7 @@ const options: Partial<WriterOptions> = {
120
100
commit . hashLink = createLink ( [ context . commit , commit . hash ] , context ) ;
121
101
122
102
commit . references . forEach ( reference => {
123
- reference . issueLink = createLink ( [ context . issue , reference . issue ] , context , reference ) ;
103
+ reference . issueLink = createLink ( [ context . issue , reference . issue ] , context ) ;
124
104
125
105
let source = `${ reference . repository || '' } #${ reference . issue } ` ;
126
106
0 commit comments