@ckeditor/ckeditor5-dev-ci 57.0.0-alpha.1 → 57.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/README.md +2 -0
- package/bin/trigger-circle-build.js +5 -0
- package/lib/trigger-circle-build.js +14 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -153,6 +153,8 @@ These commands accept a mix of environment variables and command line arguments.
|
|
|
153
153
|
- `--trigger-repository-slug` — *(Optional)* Repository slug (`org/name`) that triggered the new pipeline.
|
|
154
154
|
Can be omitted if it matches `--slug`.
|
|
155
155
|
- `--release-branch` — *(Optional)* Branch that leads the release process.
|
|
156
|
+
- `--pipeline-definition-id` — *(Optional)* GitHub App pipeline definition ID. When provided, the specified pipeline
|
|
157
|
+
definition is triggered instead of the project's default OAuth pipeline.
|
|
156
158
|
|
|
157
159
|
- ⚙️ **`ckeditor5-dev-ci-trigger-snyk-scan`**
|
|
158
160
|
|
|
@@ -20,6 +20,7 @@ import triggerCircleBuild from '../lib/trigger-circle-build.js';
|
|
|
20
20
|
* - `--trigger-repository-slug` - (optional) a repository slug (org/name) that triggers a new pipeline.
|
|
21
21
|
* Can be skipped when overlaps with `--slug`.
|
|
22
22
|
* - `--release-branch` - (optional) define a branch that leads the release process.
|
|
23
|
+
* - `--pipeline-definition-id` - (optional) define a GitHub App pipeline to trigger.
|
|
23
24
|
*
|
|
24
25
|
* Example usage:
|
|
25
26
|
* CKE5_CIRCLE_TOKEN=... ckeditor5-dev-ci-trigger-circle-build
|
|
@@ -38,6 +39,9 @@ const { values: cliOptions } = parseArgs( {
|
|
|
38
39
|
'release-branch': {
|
|
39
40
|
type: 'string',
|
|
40
41
|
default: process.env.CKE5_GITHUB_RELEASE_BRANCH
|
|
42
|
+
},
|
|
43
|
+
'pipeline-definition-id': {
|
|
44
|
+
type: 'string'
|
|
41
45
|
}
|
|
42
46
|
}
|
|
43
47
|
} );
|
|
@@ -46,6 +50,7 @@ const options = {
|
|
|
46
50
|
circleToken: process.env.CKE5_CIRCLE_TOKEN,
|
|
47
51
|
commit: process.env.CIRCLE_SHA1,
|
|
48
52
|
branch: process.env.CIRCLE_BRANCH,
|
|
53
|
+
pipelineDefinitionId: cliOptions[ 'pipeline-definition-id' ],
|
|
49
54
|
releaseBranch: cliOptions[ 'release-branch' ],
|
|
50
55
|
repositorySlug: cliOptions.slug
|
|
51
56
|
};
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
* @param {string} options.commit
|
|
10
10
|
* @param {string} options.branch
|
|
11
11
|
* @param {string} options.repositorySlug A repository slug (org/name) where a new build will be started.
|
|
12
|
+
* @param {string|null} [options.pipelineDefinitionId=null] A pipeline definition to trigger.
|
|
12
13
|
* @param {string|null} [options.releaseBranch=null] Define a branch that leads the release process.
|
|
13
14
|
* @param {string|null} [options.triggerRepositorySlug=null] A repository slug (org/name) that triggers a new build.
|
|
14
15
|
* @returns {Promise}
|
|
@@ -19,11 +20,15 @@ export default async function triggerCircleBuild( options ) {
|
|
|
19
20
|
commit,
|
|
20
21
|
branch,
|
|
21
22
|
repositorySlug,
|
|
23
|
+
pipelineDefinitionId = null,
|
|
22
24
|
releaseBranch = null,
|
|
23
25
|
triggerRepositorySlug = null
|
|
24
26
|
} = options;
|
|
25
27
|
|
|
26
|
-
|
|
28
|
+
// The new (GitHub App) endpoint accepts only the `gh` provider prefix, while the legacy one supports both.
|
|
29
|
+
const requestUrl = pipelineDefinitionId ?
|
|
30
|
+
`https://circleci.com/api/v2/project/gh/${ repositorySlug }/pipeline/run` :
|
|
31
|
+
`https://circleci.com/api/v2/project/github/${ repositorySlug }/pipeline`;
|
|
27
32
|
|
|
28
33
|
const parameters = {
|
|
29
34
|
triggerCommitHash: commit
|
|
@@ -37,6 +42,13 @@ export default async function triggerCircleBuild( options ) {
|
|
|
37
42
|
parameters.triggerRepositorySlug = triggerRepositorySlug;
|
|
38
43
|
}
|
|
39
44
|
|
|
45
|
+
const requestBody = pipelineDefinitionId ? {
|
|
46
|
+
definition_id: pipelineDefinitionId,
|
|
47
|
+
config: { branch },
|
|
48
|
+
checkout: { branch },
|
|
49
|
+
parameters
|
|
50
|
+
} : { branch, parameters };
|
|
51
|
+
|
|
40
52
|
const requestOptions = {
|
|
41
53
|
method: 'POST',
|
|
42
54
|
headers: {
|
|
@@ -44,7 +56,7 @@ export default async function triggerCircleBuild( options ) {
|
|
|
44
56
|
'Accept': 'application/json',
|
|
45
57
|
'Circle-Token': circleToken
|
|
46
58
|
},
|
|
47
|
-
body: JSON.stringify(
|
|
59
|
+
body: JSON.stringify( requestBody )
|
|
48
60
|
};
|
|
49
61
|
|
|
50
62
|
return fetch( requestUrl, requestOptions )
|