@ckeditor/ckeditor5-dev-ci 37.0.1 → 38.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 +13 -10
- package/package.json +1 -1
|
@@ -34,11 +34,10 @@ module.exports = async function notifyTravisStatus( options ) {
|
|
|
34
34
|
notifyCommitUrl: options.notifyCommitUrl,
|
|
35
35
|
repositorySlug: options.repositorySlug
|
|
36
36
|
} );
|
|
37
|
-
const
|
|
37
|
+
const { githubAccount, commitAuthor, commitMessage } = await getCommitDetails( commitUrl, options.githubToken );
|
|
38
38
|
|
|
39
39
|
const [ buildRepoOwner, buildRepoName ] = options.repositorySlug.split( '/' );
|
|
40
|
-
|
|
41
|
-
const slackAccount = members[ commitDetails.author ];
|
|
40
|
+
const slackAccount = members[ githubAccount ] || null;
|
|
42
41
|
const shortCommit = commitUrl.split( '/' ).pop().substring( 0, 7 );
|
|
43
42
|
const repoMatch = commitUrl.match( REPOSITORY_REGEXP );
|
|
44
43
|
|
|
@@ -46,7 +45,8 @@ module.exports = async function notifyTravisStatus( options ) {
|
|
|
46
45
|
username: 'Travis CI',
|
|
47
46
|
text: getNotifierMessage( {
|
|
48
47
|
slackAccount,
|
|
49
|
-
githubAccount
|
|
48
|
+
githubAccount,
|
|
49
|
+
commitAuthor,
|
|
50
50
|
shouldHideAuthor: options.shouldHideAuthor
|
|
51
51
|
} ),
|
|
52
52
|
icon_url: 'https://a.slack-edge.com/66f9/img/services/travis_36.png',
|
|
@@ -80,7 +80,7 @@ module.exports = async function notifyTravisStatus( options ) {
|
|
|
80
80
|
},
|
|
81
81
|
{
|
|
82
82
|
title: 'Commit message',
|
|
83
|
-
value: getFormattedMessage(
|
|
83
|
+
value: getFormattedMessage( commitMessage, repoMatch[ 1 ], repoMatch[ 2 ] ),
|
|
84
84
|
short: false
|
|
85
85
|
}
|
|
86
86
|
]
|
|
@@ -189,8 +189,9 @@ function getCommitDetails( commitUrl, githubToken ) {
|
|
|
189
189
|
return fetch( apiGithubUrlCommit, options )
|
|
190
190
|
.then( response => response.json() )
|
|
191
191
|
.then( json => ( {
|
|
192
|
-
|
|
193
|
-
|
|
192
|
+
githubAccount: json.author ? json.author.login : null,
|
|
193
|
+
commitAuthor: json.commit.author.name,
|
|
194
|
+
commitMessage: json.commit.message
|
|
194
195
|
} ) );
|
|
195
196
|
}
|
|
196
197
|
|
|
@@ -199,8 +200,9 @@ function getCommitDetails( commitUrl, githubToken ) {
|
|
|
199
200
|
*
|
|
200
201
|
* @param {Object} options
|
|
201
202
|
* @param {Boolean} options.shouldHideAuthor
|
|
202
|
-
* @param {String} options.slackAccount
|
|
203
|
-
* @param {String} options.githubAccount
|
|
203
|
+
* @param {String|null} options.slackAccount
|
|
204
|
+
* @param {String|null} options.githubAccount
|
|
205
|
+
* @param {String} options.commitAuthor
|
|
204
206
|
* @returns {String}
|
|
205
207
|
*/
|
|
206
208
|
function getNotifierMessage( options ) {
|
|
@@ -208,8 +210,9 @@ function getNotifierMessage( options ) {
|
|
|
208
210
|
return '_The author of the commit was hidden. <https://github.com/ckeditor/ckeditor5/issues/9252|Read more about why.>_';
|
|
209
211
|
}
|
|
210
212
|
|
|
213
|
+
// If the author of the commit could not be obtained, let's ping the entire team.
|
|
211
214
|
if ( !options.slackAccount ) {
|
|
212
|
-
return
|
|
215
|
+
return `@channel (${ options.commitAuthor }), could you take a look?`;
|
|
213
216
|
}
|
|
214
217
|
|
|
215
218
|
// Slack and GitHub names for bots are equal.
|