@ckeditor/ckeditor5-dev-ci 44.0.0 → 44.1.1
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/is-workflow-restarted.js +46 -0
- package/package.json +2 -1
|
@@ -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
|
+
} );
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ckeditor/ckeditor5-dev-ci",
|
|
3
|
-
"version": "44.
|
|
3
|
+
"version": "44.1.1",
|
|
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"
|