Skip to content

Commit c89498a

Browse files
committed
new components
1 parent 74f7853 commit c89498a

File tree

16 files changed

+727
-755
lines changed

16 files changed

+727
-755
lines changed

components/circleci/actions/add-comment/add-comment.mjs

Lines changed: 0 additions & 41 deletions
This file was deleted.

components/circleci/actions/create-item/create-item.mjs

Lines changed: 0 additions & 41 deletions
This file was deleted.
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
import circleci from "../../circleci.app.mjs";
2+
3+
export default {
4+
key: "circleci-get-job-artifacts",
5+
name: "Get Job Artifacts",
6+
description: "Retrieves a job's artifacts. [See the documentation](https://circleci.com/docs/api/v2/index.html#tag/Job/operation/getJobArtifacts).",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
circleci,
11+
projectSlug: {
12+
propDefinition: [
13+
circleci,
14+
"projectSlug",
15+
],
16+
},
17+
pipelineId: {
18+
propDefinition: [
19+
circleci,
20+
"pipelineId",
21+
(c) => ({
22+
projectSlug: c.projectSlug,
23+
}),
24+
],
25+
},
26+
workflowId: {
27+
propDefinition: [
28+
circleci,
29+
"workflowId",
30+
(c) => ({
31+
pipelineId: c.pipelineId,
32+
}),
33+
],
34+
},
35+
jobNumber: {
36+
propDefinition: [
37+
circleci,
38+
"jobNumber",
39+
(c) => ({
40+
workflowId: c.workflowId,
41+
}),
42+
],
43+
},
44+
},
45+
async run({ $ }) {
46+
const response = await this.circleci.getJobArtifacts({
47+
$,
48+
projectSlug: this.projectSlug,
49+
jobNumber: this.jobNumber,
50+
});
51+
$.export("$summary", `Successfully retrieved artifacts for job number: ${this.jobNumber}`);
52+
return response;
53+
},
54+
};
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
import circleci from "../../circleci.app.mjs";
2+
3+
export default {
4+
key: "circleci-rerun-workflow",
5+
name: "Rerun Workflow",
6+
description: "Reruns the specified workflow. [See the documentation](https://circleci.com/docs/api/v2/index.html#tag/Workflow/operation/rerunWorkflow)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
circleci,
11+
projectSlug: {
12+
propDefinition: [
13+
circleci,
14+
"projectSlug",
15+
],
16+
},
17+
pipelineId: {
18+
propDefinition: [
19+
circleci,
20+
"pipelineId",
21+
(c) => ({
22+
projectSlug: c.projectSlug,
23+
}),
24+
],
25+
},
26+
workflowId: {
27+
propDefinition: [
28+
circleci,
29+
"workflowId",
30+
(c) => ({
31+
pipelineId: c.pipelineId,
32+
}),
33+
],
34+
},
35+
enableSsh: {
36+
type: "boolean",
37+
label: "Enable SSH",
38+
description: "Whether to enable SSH access for the triggering user on the newly-rerun job. Requires the jobs parameter to be used and so is mutually exclusive with the from_failed parameter.",
39+
optional: true,
40+
},
41+
fromFailed: {
42+
type: "boolean",
43+
label: "From Failed",
44+
description: "Whether to rerun the workflow from the failed job. Mutually exclusive with the jobs parameter.",
45+
optional: true,
46+
},
47+
jobIds: {
48+
propDefinition: [
49+
circleci,
50+
"jobIds",
51+
(c) => ({
52+
workflowId: c.workflowId,
53+
}),
54+
],
55+
},
56+
sparseTree: {
57+
type: "boolean",
58+
label: "Sparse Tree",
59+
description: "",
60+
optional: true,
61+
},
62+
},
63+
async run({ $ }) {
64+
const response = await this.circleci.rerunWorkflow({
65+
$,
66+
workflowId: this.workflowId,
67+
data: {
68+
enable_ssh: this.enableSsh,
69+
from_failed: this.from_failed,
70+
jobs: typeof this.jobIds === "string"
71+
? JSON.parse(this.jobIds)
72+
: this.jobIds,
73+
sparse_tree: this.sparseTree,
74+
},
75+
});
76+
$.export("$summary", `Successfully started a rerun of workflow with ID: ${this.workflowId}`);
77+
return response;
78+
},
79+
};
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
import circleci from "../../circleci.app.mjs";
2+
3+
export default {
4+
key: "circleci-trigger-pipeline",
5+
name: "Trigger a Pipeline",
6+
description: "Trigger a pipeline given a pipeline definition ID. Supports all integrations except GitLab. [See the documentation](https://circleci.com/docs/api/v2/index.html#tag/Pipeline/operation/triggerPipelineRun)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
circleci,
11+
projectSlug: {
12+
propDefinition: [
13+
circleci,
14+
"projectSlug",
15+
],
16+
},
17+
definitionId: {
18+
type: "string",
19+
label: "Definition ID",
20+
description: "The unique ID for the pipeline definition. This can be found in the page Project Settings > Pipelines.",
21+
},
22+
configBranch: {
23+
type: "string",
24+
label: "Config Branch",
25+
description: "The branch that should be used to fetch the config file. Note that branch and tag are mutually exclusive. To trigger a pipeline for a PR by number use pull//head for the PR ref or pull//merge for the merge ref (GitHub only)",
26+
optional: true,
27+
},
28+
configTag: {
29+
type: "string",
30+
label: "Config Tag",
31+
description: "The tag that should be used to fetch the config file. The commit that this tag points to is used for the pipeline. Note that branch and tag are mutually exclusive.",
32+
optional: true,
33+
},
34+
checkoutBranch: {
35+
type: "string",
36+
label: "Checkout Branch",
37+
description: "The branch that should be used to check out code on a checkout step. Note that branch and tag are mutually exclusive. To trigger a pipeline for a PR by number use pull//head for the PR ref or pull//merge for the merge ref (GitHub only)",
38+
optional: true,
39+
},
40+
checkoutTag: {
41+
type: "string",
42+
label: "Checkout Tag",
43+
description: "The tag that should be used to check out code on a checkout step. The commit that this tag points to is used for the pipeline. Note that branch and tag are mutually exclusive.",
44+
optional: true,
45+
},
46+
parameters: {
47+
type: "object",
48+
label: "Parameters",
49+
description: "An object containing pipeline parameters and their values. Pipeline parameters have the following size limits: 100 max entries, 128 maximum key length, 512 maximum value length.",
50+
optional: true,
51+
},
52+
},
53+
async run({ $ }) {
54+
const response = await this.circleci.triggerPipeline({
55+
$,
56+
projectSlug: this.projectSlug,
57+
data: {
58+
definition_id: this.definitionId,
59+
config: this.configBranch || this.configTag
60+
? {
61+
branch: this.configBranch,
62+
tag: this.configTag,
63+
}
64+
: undefined,
65+
checkout: this.checkoutBranch || this.checkoutTag
66+
? {
67+
branch: this.checkoutBranch,
68+
tag: this.checkoutTag,
69+
}
70+
: undefined,
71+
parameters: typeof this.parameters === "string"
72+
? JSON.parse(this.parameters)
73+
: this.parameters,
74+
},
75+
});
76+
77+
if (response?.id) {
78+
$.export("$summary", `Successfully triggered pipeline with ID: ${response.id}`);
79+
}
80+
return response;
81+
},
82+
};

components/circleci/actions/update-item/update-item.mjs

Lines changed: 0 additions & 33 deletions
This file was deleted.

0 commit comments

Comments
 (0)