# CodeCommitSourceActionProps

Construction properties of the `CodeCommitSourceAction CodeCommit source CodePipeline Action`.

Extends: CodeCommitSourceActionProps
Extends: CommonAwsActionProps
Used as props by: CodeCommitSourceAction

- Source: [`aws-codepipeline-actions/lib/codecommit/source-action.ts`](https://github.com/aws/aws-cdk/blob/v2.275.0/packages/aws-cdk-lib/aws-codepipeline-actions/lib/codecommit/source-action.ts#L91)
- Type last changed: v2.122.0 · 18 Jan 2024

## Example

```ts
// Source stage: read from repository
const repo = new codecommit.Repository(stack, 'TemplateRepo', {
  repositoryName: 'template-repo',
});
const sourceOutput = new codepipeline.Artifact('SourceArtifact');
const source = new cpactions.CodeCommitSourceAction({
  actionName: 'Source',
  repository: repo,
  output: sourceOutput,
  trigger: cpactions.CodeCommitTrigger.POLL,
});
const sourceStage = {
  stageName: 'Source',
  actions: [source],
};

// Deployment stage: create and deploy changeset with manual approval
const stackName = 'OurStack';
const changeSetName = 'StagedChangeSet';

const prodStage = {
  stageName: 'Deploy',
  actions: [
    new cpactions.CloudFormationCreateReplaceChangeSetAction({
      actionName: 'PrepareChanges',
      stackName,
      changeSetName,
      adminPermissions: true,
      templatePath: sourceOutput.atPath('template.yaml'),
      runOrder: 1,
    }),
    new cpactions.ManualApprovalAction({
      actionName: 'ApproveChanges',
      runOrder: 2,
    }),
    new cpactions.CloudFormationExecuteChangeSetAction({
      actionName: 'ExecuteChanges',
      stackName,
      changeSetName,
      runOrder: 3,
    }),
  ],
};

new codepipeline.Pipeline(stack, 'Pipeline', {
  crossAccountKeys: true,
  stages: [
    sourceStage,
    prodStage,
  ],
});
```

## Properties

- `actionName`: string (required) — The physical, human-readable name of the Action.

  Note that Action names must be unique within a single Stage.

- `branch`: string = 'master'

- `codeBuildCloneOutput`: boolean = false — Whether the output should be the contents of the repository (which is the default), or a link that allows CodeBuild to clone the repository before building.

  **Note**: if this option is true,
  then only CodeBuild actions can use the resulting `output`.

- `customEventRule`: [ICustomEventRule](/cdk/api/v2/docs/aws-cdk-lib.aws_codepipeline_actions.ICustomEventRule.html) — You can pass a `customEventRule` to set up a custom event rule for the CodeCommit source action.

  **Default:** Event rule which is triggered by CodeCommit repository on commit

  You must provide the `eventPattern` and `target` properties in the `customEventRule` object.
  Check which `eventPattern` to use: https://docs.aws.amazon.com/codecommit/latest/userguide/monitoring-events.html

- `eventRole`: [IRole](/cdk/api/v2/docs/aws-cdk-lib.aws_iam.IRole.html) — Role to be used by on commit event rule.

  **Default:** a new role will be created.

  Used only when trigger value is CodeCommitTrigger.EVENTS.

- `output`: [Artifact](/cdk/api/v2/docs/aws-cdk-lib.aws_codepipeline.Artifact.html) (required)

- `repository`: [IRepository](/cdk/api/v2/docs/aws-cdk-lib.aws_codecommit.IRepository.html) (required) — The CodeCommit repository.

- `role`: [IRole](/cdk/api/v2/docs/aws-cdk-lib.aws_iam.IRole.html) — The Role in which context's this Action will be executing in.

  **Default:** a new Role will be generated

  The Pipeline's Role will assume this Role
  (the required permissions for that will be granted automatically)
  right before executing this Action.
  This Action will be passed into your `IAction.bind`
  method in the `ActionBindOptions.role` property.

- `runOrder`: number = 1 — The runOrder property for this Action.

  RunOrder determines the relative order in which multiple Actions in the same Stage execute.

- `trigger`: [CodeCommitTrigger](/cdk/api/v2/docs/aws-cdk-lib.aws_codepipeline_actions.CodeCommitTrigger.html) = CodeCommitTrigger.EVENTS — How should CodePipeline detect source changes for this Action.

- `variablesNamespace`: string — The name of the namespace to use for variables emitted by this action.

  **Default:** a name will be generated, based on the stage and action names, if any of the action's variables were referenced - otherwise, no namespace will be set
