@@ -56,19 +56,18 @@ class CIInfoExtension extends BaseExtension {
56
56
this . #setRepositoryElement( ) ;
57
57
}
58
58
if ( this . extension . inputs . show_repository_branch ) {
59
- if ( this . ci . repository_ref . includes ( 'refs/pull' ) ) {
59
+ if ( this . ci . pull_request_name ) {
60
60
this . #setPullRequestElement( ) ;
61
61
} else {
62
62
this . #setRepositoryBranchElement( ) ;
63
63
}
64
64
}
65
65
if ( ! this . extension . inputs . show_repository && ! this . extension . inputs . show_repository_branch && this . extension . inputs . show_repository_non_common ) {
66
- if ( this . ci . repository_ref . includes ( 'refs/pull' ) ) {
66
+ if ( this . ci . pull_request_name ) {
67
67
this . #setRepositoryElement( ) ;
68
68
this . #setPullRequestElement( ) ;
69
69
} else {
70
- const branch_name = this . ci . repository_ref . replace ( 'refs/heads/' , '' ) ;
71
- if ( ! COMMON_BRANCH_NAMES . includes ( branch_name . toLowerCase ( ) ) ) {
70
+ if ( ! COMMON_BRANCH_NAMES . includes ( this . ci . branch_name . toLowerCase ( ) ) ) {
72
71
this . #setRepositoryElement( ) ;
73
72
this . #setRepositoryBranchElement( ) ;
74
73
}
@@ -81,15 +80,11 @@ class CIInfoExtension extends BaseExtension {
81
80
}
82
81
83
82
#setPullRequestElement( ) {
84
- const pr_url = this . ci . repository_url + this . ci . repository_ref . replace ( 'refs/pull/' , '/pull/' ) ;
85
- const pr_name = this . ci . repository_ref . replace ( 'refs/pull/' , '' ) . replace ( '/merge' , '' ) ;
86
- this . repository_elements . push ( { label : 'Pull Request' , key : pr_name , value : pr_url , type : 'hyperlink' } ) ;
83
+ this . repository_elements . push ( { label : 'Pull Request' , key : this . ci . pull_request_name , value : this . ci . pull_request_url , type : 'hyperlink' } ) ;
87
84
}
88
85
89
86
#setRepositoryBranchElement( ) {
90
- const branch_url = this . ci . repository_url + this . ci . repository_ref . replace ( 'refs/heads/' , '/tree/' ) ;
91
- const branch_name = this . ci . repository_ref . replace ( 'refs/heads/' , '' ) ;
92
- this . repository_elements . push ( { label : 'Branch' , key : branch_name , value : branch_url , type : 'hyperlink' } ) ;
87
+ this . repository_elements . push ( { label : 'Branch' , key : this . ci . branch_name , value : this . ci . branch_url , type : 'hyperlink' } ) ;
93
88
}
94
89
95
90
#setBuildElements( ) {
0 commit comments