@ckeditor/ckeditor5-dev-ci 44.0.0-alpha.5 → 44.1.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/bin/circle-workflow-notifier.js +4 -4
- package/bin/is-workflow-restarted.js +46 -0
- package/lib/circle-update-auto-cancel-builds.js +5 -5
- package/lib/format-message.js +31 -31
- package/lib/is-job-triggered-by-member.js +7 -7
- package/lib/process-job-statuses.js +4 -4
- package/lib/trigger-circle-build.js +7 -7
- package/lib/utils/get-job-approver.js +4 -4
- package/package.json +2 -1
|
@@ -118,10 +118,10 @@ async function getOtherJobsData() {
|
|
|
118
118
|
}
|
|
119
119
|
|
|
120
120
|
/**
|
|
121
|
-
* @param {Array.<
|
|
122
|
-
* @returns {
|
|
123
|
-
* @returns {
|
|
124
|
-
* @returns {Array
|
|
121
|
+
* @param {Array.<string>} args
|
|
122
|
+
* @returns {object} result
|
|
123
|
+
* @returns {string} result.task
|
|
124
|
+
* @returns {Array.<string>} result.ignore
|
|
125
125
|
*/
|
|
126
126
|
function parseArguments( args ) {
|
|
127
127
|
const config = {
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
5
|
+
* For licensing, see LICENSE.md.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/* eslint-env node */
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* This script checks if the provided workflow has been restarted. If so, it exits with a zero error code.
|
|
12
|
+
*
|
|
13
|
+
* In order to integrate the action in your pipeline, you need prepare a few environment variables:
|
|
14
|
+
*
|
|
15
|
+
* - CIRCLE_WORKFLOW_ID - provided by default by CircleCI and keeps the workflow id.
|
|
16
|
+
* - CKE5_CIRCLE_TOKEN - an authorization token to talk to CircleCI REST API.
|
|
17
|
+
*
|
|
18
|
+
* Example usage:
|
|
19
|
+
* CKE5_CIRCLE_TOKEN=... ckeditor5-dev-ci-is-workflow-restarted
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
const {
|
|
23
|
+
CKE5_CIRCLE_TOKEN,
|
|
24
|
+
CIRCLE_WORKFLOW_ID
|
|
25
|
+
} = process.env;
|
|
26
|
+
|
|
27
|
+
const requestUrl = `https://circleci.com/api/v2/workflow/${ CIRCLE_WORKFLOW_ID }`;
|
|
28
|
+
|
|
29
|
+
const requestOptions = {
|
|
30
|
+
method: 'GET',
|
|
31
|
+
headers: {
|
|
32
|
+
'Circle-Token': CKE5_CIRCLE_TOKEN
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
fetch( requestUrl, requestOptions )
|
|
37
|
+
.then( res => res.json() )
|
|
38
|
+
.then( response => {
|
|
39
|
+
const { tag = '' } = response;
|
|
40
|
+
|
|
41
|
+
if ( tag.startsWith( 'rerun' ) ) {
|
|
42
|
+
return process.exit( 0 );
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
return process.exit( 1 );
|
|
46
|
+
} );
|
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* @param options
|
|
8
|
-
* @param {
|
|
9
|
-
* @param {
|
|
10
|
-
* @param {
|
|
11
|
-
* @param {
|
|
12
|
-
* @
|
|
8
|
+
* @param {string} options.circleToken
|
|
9
|
+
* @param {string} options.githubOrganization
|
|
10
|
+
* @param {string} options.githubRepository
|
|
11
|
+
* @param {boolean} options.newValue
|
|
12
|
+
* @returns {Promise.<boolean>}
|
|
13
13
|
*/
|
|
14
14
|
export default async function circleUpdateAutoCancelBuilds( options ) {
|
|
15
15
|
const {
|
package/lib/format-message.js
CHANGED
|
@@ -10,20 +10,20 @@ import { bots, members } from './data/index.js';
|
|
|
10
10
|
const REPOSITORY_REGEXP = /github\.com\/([^/]+)\/([^/]+)/;
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
|
-
* @param {
|
|
14
|
-
* @param {
|
|
15
|
-
* @param {
|
|
16
|
-
* @param {
|
|
17
|
-
* @param {
|
|
18
|
-
* @param {
|
|
19
|
-
* @param {
|
|
20
|
-
* @param {
|
|
21
|
-
* @param {
|
|
22
|
-
* @param {
|
|
23
|
-
* @param {
|
|
24
|
-
* @param {
|
|
25
|
-
* @param {
|
|
26
|
-
* @param {
|
|
13
|
+
* @param {object} options
|
|
14
|
+
* @param {string} options.slackMessageUsername
|
|
15
|
+
* @param {string} options.iconUrl
|
|
16
|
+
* @param {string} options.repositoryOwner
|
|
17
|
+
* @param {string} options.repositoryName
|
|
18
|
+
* @param {string} options.branch
|
|
19
|
+
* @param {string} options.buildTitle
|
|
20
|
+
* @param {string} options.buildUrl
|
|
21
|
+
* @param {string} options.buildId
|
|
22
|
+
* @param {string} options.githubToken
|
|
23
|
+
* @param {string} options.triggeringCommitUrl
|
|
24
|
+
* @param {number} options.startTime
|
|
25
|
+
* @param {number} options.endTime
|
|
26
|
+
* @param {boolean} options.shouldHideAuthor
|
|
27
27
|
*/
|
|
28
28
|
export default async function formatMessage( options ) {
|
|
29
29
|
const commitDetails = await getCommitDetails( options.triggeringCommitUrl, options.githubToken );
|
|
@@ -64,11 +64,11 @@ export default async function formatMessage( options ) {
|
|
|
64
64
|
/**
|
|
65
65
|
* Returns the additional message that will be added to the notifier post.
|
|
66
66
|
*
|
|
67
|
-
* @param {
|
|
68
|
-
* @param {
|
|
69
|
-
* @param {
|
|
70
|
-
* @param {
|
|
71
|
-
* @returns {
|
|
67
|
+
* @param {object} options
|
|
68
|
+
* @param {boolean} options.shouldHideAuthor
|
|
69
|
+
* @param {string|null} options.githubAccount
|
|
70
|
+
* @param {string} options.commitAuthor
|
|
71
|
+
* @returns {string}
|
|
72
72
|
*/
|
|
73
73
|
function getNotifierMessage( options ) {
|
|
74
74
|
if ( options.shouldHideAuthor ) {
|
|
@@ -95,8 +95,8 @@ function getNotifierMessage( options ) {
|
|
|
95
95
|
}
|
|
96
96
|
|
|
97
97
|
/**
|
|
98
|
-
* @param {
|
|
99
|
-
* @returns {
|
|
98
|
+
* @param {string|null} githubAccount
|
|
99
|
+
* @returns {string|null}
|
|
100
100
|
*/
|
|
101
101
|
function findSlackAccount( githubAccount ) {
|
|
102
102
|
if ( !githubAccount ) {
|
|
@@ -116,9 +116,9 @@ function findSlackAccount( githubAccount ) {
|
|
|
116
116
|
* Returns string representing amount of time passed between two timestamps.
|
|
117
117
|
* Timestamps should be in seconds instead of milliseconds.
|
|
118
118
|
*
|
|
119
|
-
* @param {
|
|
120
|
-
* @param {
|
|
121
|
-
* @returns {
|
|
119
|
+
* @param {number} startTime
|
|
120
|
+
* @param {number} endTime
|
|
121
|
+
* @returns {string}
|
|
122
122
|
*/
|
|
123
123
|
function getExecutionTime( startTime, endTime ) {
|
|
124
124
|
if ( !startTime || !endTime ) {
|
|
@@ -155,8 +155,8 @@ function getExecutionTime( startTime, endTime ) {
|
|
|
155
155
|
/**
|
|
156
156
|
* Replaces `#Id` and `Repo/Owner#Id` with URls to Github Issues.
|
|
157
157
|
*
|
|
158
|
-
* @param {
|
|
159
|
-
* @param {
|
|
158
|
+
* @param {string} commitMessage
|
|
159
|
+
* @param {string} triggeringCommitUrl
|
|
160
160
|
* @returns {string}
|
|
161
161
|
*/
|
|
162
162
|
function getFormattedMessage( commitMessage, triggeringCommitUrl ) {
|
|
@@ -178,9 +178,9 @@ function getFormattedMessage( commitMessage, triggeringCommitUrl ) {
|
|
|
178
178
|
/**
|
|
179
179
|
* Returns a promise that resolves the commit details (author and message) based on the specified GitHub URL.
|
|
180
180
|
*
|
|
181
|
-
* @param {
|
|
182
|
-
* @param {
|
|
183
|
-
* @returns {Promise.<
|
|
181
|
+
* @param {string} triggeringCommitUrl The URL to the commit on GitHub.
|
|
182
|
+
* @param {string} githubToken Github token used for authorization a request,
|
|
183
|
+
* @returns {Promise.<object>}
|
|
184
184
|
*/
|
|
185
185
|
function getCommitDetails( triggeringCommitUrl, githubToken ) {
|
|
186
186
|
const apiGithubUrlCommit = getGithubApiUrl( triggeringCommitUrl );
|
|
@@ -205,8 +205,8 @@ function getCommitDetails( triggeringCommitUrl, githubToken ) {
|
|
|
205
205
|
/**
|
|
206
206
|
* Returns a URL to GitHub API which returns details of the commit that caused the CI to fail its job.
|
|
207
207
|
*
|
|
208
|
-
* @param {
|
|
209
|
-
* @returns {
|
|
208
|
+
* @param {string} triggeringCommitUrl The URL to the commit on GitHub.
|
|
209
|
+
* @returns {string}
|
|
210
210
|
*/
|
|
211
211
|
function getGithubApiUrl( triggeringCommitUrl ) {
|
|
212
212
|
return triggeringCommitUrl.replace( 'github.com/', 'api.github.com/repos/' ).replace( '/commit/', '/commits/' );
|
|
@@ -8,13 +8,13 @@ import getJobApprover from './utils/get-job-approver.js';
|
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* @param options
|
|
11
|
-
* @param {
|
|
12
|
-
* @param {
|
|
13
|
-
* @param {
|
|
14
|
-
* @param {
|
|
15
|
-
* @param {
|
|
16
|
-
* @param {
|
|
17
|
-
* @
|
|
11
|
+
* @param {string} options.circleToken
|
|
12
|
+
* @param {string} options.circleWorkflowId
|
|
13
|
+
* @param {string} options.circleApprovalJobName
|
|
14
|
+
* @param {string} options.githubOrganization
|
|
15
|
+
* @param {string} options.githubTeamSlug
|
|
16
|
+
* @param {string} options.githubToken
|
|
17
|
+
* @returns {Promise.<boolean>}
|
|
18
18
|
*/
|
|
19
19
|
export default async function isJobTriggeredByMember( options ) {
|
|
20
20
|
const {
|
|
@@ -57,7 +57,7 @@ export default function processJobStatuses( jobs ) {
|
|
|
57
57
|
|
|
58
58
|
/**
|
|
59
59
|
* @param {WorkflowJob} job
|
|
60
|
-
* @returns {
|
|
60
|
+
* @returns {boolean}
|
|
61
61
|
*/
|
|
62
62
|
function isJobFailed( job ) {
|
|
63
63
|
if ( job.status === 'failed' ) {
|
|
@@ -81,11 +81,11 @@ function clone( obj ) {
|
|
|
81
81
|
}
|
|
82
82
|
|
|
83
83
|
/**
|
|
84
|
-
* @typedef {
|
|
84
|
+
* @typedef {object} WorkflowJob
|
|
85
85
|
*
|
|
86
|
-
* @property {
|
|
86
|
+
* @property {string} id
|
|
87
87
|
*
|
|
88
88
|
* @property {'blocked'|'running'|'failed'|'failed_parent'|'success'} status
|
|
89
89
|
*
|
|
90
|
-
* @property {Array.<
|
|
90
|
+
* @property {Array.<string>} dependencies
|
|
91
91
|
*/
|
|
@@ -7,13 +7,13 @@
|
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* @param options
|
|
10
|
-
* @param {
|
|
11
|
-
* @param {
|
|
12
|
-
* @param {
|
|
13
|
-
* @param {
|
|
14
|
-
* @param {
|
|
15
|
-
* @param {
|
|
16
|
-
* @
|
|
10
|
+
* @param {string} options.circleToken
|
|
11
|
+
* @param {string} options.commit
|
|
12
|
+
* @param {string} options.branch
|
|
13
|
+
* @param {string} options.repositorySlug A repository slug (org/name) where a new build will be started.
|
|
14
|
+
* @param {string|null} [options.releaseBranch=null] Define a branch that leads the release process.
|
|
15
|
+
* @param {string|null} [options.triggerRepositorySlug=null] A repository slug (org/name) that triggers a new build.
|
|
16
|
+
* @returns {Promise}
|
|
17
17
|
*/
|
|
18
18
|
export default async function triggerCircleBuild( options ) {
|
|
19
19
|
const {
|
|
@@ -6,10 +6,10 @@
|
|
|
6
6
|
/**
|
|
7
7
|
* Returns a promise that resolves to GitHub name of a developer who approved the `jobName` job.
|
|
8
8
|
*
|
|
9
|
-
* @param {
|
|
10
|
-
* @param {
|
|
11
|
-
* @param {
|
|
12
|
-
* @returns {Promise.<
|
|
9
|
+
* @param {string} circleCiToken
|
|
10
|
+
* @param {string} workflowId
|
|
11
|
+
* @param {string} jobName
|
|
12
|
+
* @returns {Promise.<string>}
|
|
13
13
|
*/
|
|
14
14
|
export default async function getJobApprover( circleCiToken, workflowId, jobName ) {
|
|
15
15
|
const circleRequestOptions = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ckeditor/ckeditor5-dev-ci",
|
|
3
|
-
"version": "44.
|
|
3
|
+
"version": "44.1.0",
|
|
4
4
|
"description": "Utils used on various Continuous Integration services.",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"author": "CKSource (http://cksource.com/)",
|
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
"ckeditor5-dev-ci-allocate-swap-memory": "bin/allocate-swap-memory.sh",
|
|
30
30
|
"ckeditor5-dev-ci-install-latest-chrome": "bin/install-latest-chrome.sh",
|
|
31
31
|
"ckeditor5-dev-ci-is-job-triggered-by-member": "bin/is-job-triggered-by-member.js",
|
|
32
|
+
"ckeditor5-dev-ci-is-workflow-restarted": "bin/is-workflow-restarted.js",
|
|
32
33
|
"ckeditor5-dev-ci-trigger-circle-build": "bin/trigger-circle-build.js",
|
|
33
34
|
"ckeditor5-dev-ci-circle-disable-auto-cancel-builds": "bin/circle-disable-auto-cancel-builds.js",
|
|
34
35
|
"ckeditor5-dev-ci-circle-enable-auto-cancel-builds": "bin/circle-enable-auto-cancel-builds.js"
|