@ckeditor/ckeditor5-dev-ci 35.0.5 → 36.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/notifytravisstatus.js +28 -20
- package/package.json +3 -3
|
@@ -37,19 +37,12 @@ module.exports = async function notifyTravisStatus( options ) {
|
|
|
37
37
|
const commitDetails = await getCommitDetails( commitUrl, options.githubToken );
|
|
38
38
|
|
|
39
39
|
const [ buildRepoOwner, buildRepoName ] = options.repositorySlug.split( '/' );
|
|
40
|
-
const execTime = getExecutionTime( options.endTime, options.startTime );
|
|
41
40
|
|
|
42
41
|
const slackAccount = members[ commitDetails.author ];
|
|
43
42
|
const shortCommit = commitUrl.split( '/' ).pop().substring( 0, 7 );
|
|
44
43
|
const repoMatch = commitUrl.match( REPOSITORY_REGEXP );
|
|
45
44
|
|
|
46
|
-
const
|
|
47
|
-
|
|
48
|
-
slack.onError = err => {
|
|
49
|
-
console.log( 'API error occurred:', err );
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
return slack.send( {
|
|
45
|
+
const messageData = {
|
|
53
46
|
username: 'Travis CI',
|
|
54
47
|
text: getNotifierMessage( {
|
|
55
48
|
slackAccount,
|
|
@@ -82,7 +75,7 @@ module.exports = async function notifyTravisStatus( options ) {
|
|
|
82
75
|
},
|
|
83
76
|
{
|
|
84
77
|
title: 'Build time',
|
|
85
|
-
value:
|
|
78
|
+
value: getExecutionTime( options.endTime, options.startTime ),
|
|
86
79
|
short: true
|
|
87
80
|
},
|
|
88
81
|
{
|
|
@@ -93,27 +86,42 @@ module.exports = async function notifyTravisStatus( options ) {
|
|
|
93
86
|
]
|
|
94
87
|
}
|
|
95
88
|
]
|
|
96
|
-
}
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
return slackNotify( options.slackWebhookUrl )
|
|
92
|
+
.send( messageData )
|
|
93
|
+
.catch( err => console.log( 'API error occurred:', err ) );
|
|
97
94
|
};
|
|
98
95
|
|
|
99
96
|
/**
|
|
100
|
-
* Returns
|
|
97
|
+
* Returns string representing amount of time passed between two timestamps.
|
|
101
98
|
*
|
|
102
99
|
* @param {Number} endTime
|
|
103
100
|
* @param {Number} startTime
|
|
104
|
-
* @returns {
|
|
101
|
+
* @returns {String}
|
|
105
102
|
*/
|
|
106
103
|
function getExecutionTime( endTime, startTime ) {
|
|
107
|
-
const
|
|
108
|
-
|
|
109
|
-
|
|
104
|
+
const totalMs = ( endTime - startTime ) * 1000;
|
|
105
|
+
const date = new Date( totalMs );
|
|
106
|
+
const hours = date.getUTCHours();
|
|
107
|
+
const minutes = date.getUTCMinutes();
|
|
108
|
+
const seconds = date.getUTCSeconds();
|
|
109
|
+
|
|
110
|
+
const stringParts = [];
|
|
111
|
+
|
|
112
|
+
if ( hours ) {
|
|
113
|
+
stringParts.push( `${ hours } hr.` );
|
|
114
|
+
}
|
|
110
115
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
116
|
+
if ( minutes ) {
|
|
117
|
+
stringParts.push( `${ minutes } min.` );
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
if ( seconds ) {
|
|
121
|
+
stringParts.push( `${ seconds } sec.` );
|
|
122
|
+
}
|
|
115
123
|
|
|
116
|
-
return
|
|
124
|
+
return stringParts.join( ' ' );
|
|
117
125
|
}
|
|
118
126
|
|
|
119
127
|
/**
|
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ckeditor/ckeditor5-dev-ci",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "36.0.0",
|
|
4
4
|
"description": "Utils for CKEditor5 CI builds.",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"dependencies": {
|
|
7
7
|
"node-fetch": "^2.6.7",
|
|
8
|
-
"slack-notify": "^0.
|
|
8
|
+
"slack-notify": "^2.0.6"
|
|
9
9
|
},
|
|
10
10
|
"engines": {
|
|
11
|
-
"node": ">=
|
|
11
|
+
"node": ">=16.0.0",
|
|
12
12
|
"npm": ">=5.7.1"
|
|
13
13
|
},
|
|
14
14
|
"files": [
|