Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import circleci from "../../circleci.app.mjs";

export default {
key: "circleci-get-job-artifacts",
name: "Get Job Artifacts",
description: "Retrieves a job's artifacts. [See the documentation](https://circleci.com/docs/api/v2/index.html#tag/Job/operation/getJobArtifacts).",
version: "0.0.1",
type: "action",
props: {
circleci,
projectSlug: {
propDefinition: [
circleci,
"projectSlug",
],
},
pipelineId: {
propDefinition: [
circleci,
"pipelineId",
(c) => ({
projectSlug: c.projectSlug,
}),
],
},
workflowId: {
propDefinition: [
circleci,
"workflowId",
(c) => ({
pipelineId: c.pipelineId,
}),
],
},
jobNumber: {
propDefinition: [
circleci,
"jobNumber",
(c) => ({
workflowId: c.workflowId,
}),
],
},
},
async run({ $ }) {
const response = await this.circleci.getJobArtifacts({
$,
projectSlug: this.projectSlug,
jobNumber: this.jobNumber,
});
$.export("$summary", `Successfully retrieved artifacts for job number: ${this.jobNumber}`);
return response;
},
};
79 changes: 79 additions & 0 deletions components/circleci/actions/rerun-workflow/rerun-workflow.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
import circleci from "../../circleci.app.mjs";

export default {
key: "circleci-rerun-workflow",
name: "Rerun Workflow",
description: "Reruns the specified workflow. [See the documentation](https://circleci.com/docs/api/v2/index.html#tag/Workflow/operation/rerunWorkflow)",
version: "0.0.1",
type: "action",
props: {
circleci,
projectSlug: {
propDefinition: [
circleci,
"projectSlug",
],
},
pipelineId: {
propDefinition: [
circleci,
"pipelineId",
(c) => ({
projectSlug: c.projectSlug,
}),
],
},
workflowId: {
propDefinition: [
circleci,
"workflowId",
(c) => ({
pipelineId: c.pipelineId,
}),
],
},
enableSsh: {
type: "boolean",
label: "Enable SSH",
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.",
optional: true,
},
fromFailed: {
type: "boolean",
label: "From Failed",
description: "Whether to rerun the workflow from the failed job. Mutually exclusive with the jobs parameter.",
optional: true,
},
jobIds: {
propDefinition: [
circleci,
"jobIds",
(c) => ({
workflowId: c.workflowId,
}),
],
},
sparseTree: {
type: "boolean",
label: "Sparse Tree",
description: "",
optional: true,
},
},
async run({ $ }) {
const response = await this.circleci.rerunWorkflow({
$,
workflowId: this.workflowId,
data: {
enable_ssh: this.enableSsh,
from_failed: this.from_failed,
jobs: typeof this.jobIds === "string"
? JSON.parse(this.jobIds)
: this.jobIds,
sparse_tree: this.sparseTree,
},
});
$.export("$summary", `Successfully started a rerun of workflow with ID: ${this.workflowId}`);
return response;
},
};
82 changes: 82 additions & 0 deletions components/circleci/actions/trigger-pipeline/trigger-pipeline.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
import circleci from "../../circleci.app.mjs";

export default {
key: "circleci-trigger-pipeline",
name: "Trigger a Pipeline",
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)",
version: "0.0.1",
type: "action",
props: {
circleci,
projectSlug: {
propDefinition: [
circleci,
"projectSlug",
],
},
definitionId: {
type: "string",
label: "Definition ID",
description: "The unique ID for the pipeline definition. This can be found in the page Project Settings > Pipelines.",
},
configBranch: {
type: "string",
label: "Config Branch",
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)",
optional: true,
},
configTag: {
type: "string",
label: "Config Tag",
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.",
optional: true,
},
checkoutBranch: {
type: "string",
label: "Checkout Branch",
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)",
optional: true,
},
checkoutTag: {
type: "string",
label: "Checkout Tag",
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.",
optional: true,
},
parameters: {
type: "object",
label: "Parameters",
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.",
optional: true,
},
},
async run({ $ }) {
const response = await this.circleci.triggerPipeline({
$,
projectSlug: this.projectSlug,
data: {
definition_id: this.definitionId,
config: this.configBranch || this.configTag
? {
branch: this.configBranch,
tag: this.configTag,
}
: undefined,
checkout: this.checkoutBranch || this.checkoutTag
? {
branch: this.checkoutBranch,
tag: this.checkoutTag,
}
: undefined,
parameters: typeof this.parameters === "string"
? JSON.parse(this.parameters)
: this.parameters,
},
});

if (response?.id) {
$.export("$summary", `Successfully triggered pipeline with ID: ${response.id}`);
}
return response;
},
};
Loading
Loading