# CodeStarConnectionsSourceActionProps

Construction properties for `CodeStarConnectionsSourceAction`.

Extends: [CommonAwsActionProps](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_codepipeline.CommonAwsActionProps.html)
Used as props by: [CodeStarConnectionsSourceAction](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_codepipeline_actions.CodeStarConnectionsSourceAction.html)

- Source: [`aws-codepipeline-actions/lib/codestar-connections/source-action.ts`](https://github.com/aws/aws-cdk/blob/v2.278.0/packages/aws-cdk-lib/aws-codepipeline-actions/lib/codestar-connections/source-action.ts#L28)

## Example

TypeScript:

```ts
declare const project: codebuild.Project;

const sourceOutput = new codepipeline.Artifact();
const sourceAction = new codepipeline_actions.CodeStarConnectionsSourceAction({
  actionName: 'BitBucket_Source',
  owner: 'aws',
  repo: 'aws-cdk',
  output: sourceOutput,
  connectionArn: 'arn:aws:codestar-connections:us-east-1:123456789012:connection/12345678-abcd-12ab-34cdef5678gh',
  variablesNamespace: 'SomeSpace', // optional - by default, a name will be generated for you
});

// later:

new codepipeline_actions.CodeBuildAction({
  actionName: 'CodeBuild',
  project,
  input: sourceOutput,
  environmentVariables: {
    COMMIT_ID: {
      value: sourceAction.variables.commitId,
    },
  },
});
```

Python:

```python
# project: codebuild.Project

source_output = codepipeline.Artifact()
source_action = codepipeline_actions.CodeStarConnectionsSourceAction(
    action_name="BitBucket_Source",
    owner="aws",
    repo="aws-cdk",
    output=source_output,
    connection_arn="arn:aws:codestar-connections:us-east-1:123456789012:connection/12345678-abcd-12ab-34cdef5678gh",
    variables_namespace="SomeSpace"
)

# later:

codepipeline_actions.CodeBuildAction(
    action_name="CodeBuild",
    project=project,
    input=source_output,
    environment_variables={
        "COMMIT_ID": codebuild.BuildEnvironmentVariable(
            value=source_action.variables.commit_id
        )
    }
)
```

Java:

```java
Project project;

Artifact sourceOutput = new Artifact();
CodeStarConnectionsSourceAction sourceAction = CodeStarConnectionsSourceAction.Builder.create()
        .actionName("BitBucket_Source")
        .owner("aws")
        .repo("aws-cdk")
        .output(sourceOutput)
        .connectionArn("arn:aws:codestar-connections:us-east-1:123456789012:connection/12345678-abcd-12ab-34cdef5678gh")
        .variablesNamespace("SomeSpace")
        .build();

// later:

// later:
CodeBuildAction.Builder.create()
        .actionName("CodeBuild")
        .project(project)
        .input(sourceOutput)
        .environmentVariables(Map.of(
                "COMMIT_ID", BuildEnvironmentVariable.builder()
                        .value(sourceAction.getVariables().getCommitId())
                        .build()))
        .build();
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.Lib
Project project;

var sourceOutput = new Artifact();
var sourceAction = new CodeStarConnectionsSourceAction(new CodeStarConnectionsSourceActionProps {
    ActionName = "BitBucket_Source",
    Owner = "aws",
    Repo = "aws-cdk",
    Output = sourceOutput,
    ConnectionArn = "arn:aws:codestar-connections:us-east-1:123456789012:connection/12345678-abcd-12ab-34cdef5678gh",
    VariablesNamespace = "SomeSpace"
});

// later:

// later:
new CodeBuildAction(new CodeBuildActionProps {
    ActionName = "CodeBuild",
    Project = project,
    Input = sourceOutput,
    EnvironmentVariables = new Dictionary<string, BuildEnvironmentVariable> {
        { "COMMIT_ID", new BuildEnvironmentVariable {
            Value = sourceAction.Variables.CommitId
        } }
    }
});
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
var project Project

sourceOutput := codepipeline.NewArtifact()
sourceAction := codepipeline_actions.NewCodeStarConnectionsSourceAction(&CodeStarConnectionsSourceActionProps{
	ActionName: jsii.String("BitBucket_Source"),
	Owner: jsii.String("aws"),
	Repo: jsii.String("aws-cdk"),
	Output: sourceOutput,
	ConnectionArn: jsii.String("arn:aws:codestar-connections:us-east-1:123456789012:connection/12345678-abcd-12ab-34cdef5678gh"),
	VariablesNamespace: jsii.String("SomeSpace"),
})

// later:

// later:
codepipeline_actions.NewCodeBuildAction(&CodeBuildActionProps{
	ActionName: jsii.String("CodeBuild"),
	Project: Project,
	Input: sourceOutput,
	EnvironmentVariables: map[string]BuildEnvironmentVariable{
		"COMMIT_ID": &BuildEnvironmentVariable{
			"value": sourceAction.variables.commitId,
		},
	},
})
```

## 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' — The branch to build.

- `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`.

- `connectionArn`: string (required) — The ARN of the CodeStar Connection created in the AWS console that has permissions to access this GitHub or BitBucket repository.

  ```ts
  'arn:aws:codestar-connections:us-east-1:123456789012:connection/12345678-abcd-12ab-34cdef5678gh'
  ```

- `output`: [Artifact](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_codepipeline.Artifact.html) (required) — The output artifact that this action produces.

  Can be used as input for further pipeline actions.

- `owner`: string (required) — The owning user or organization of the repository.

  ```ts
  'aws'
  ```

- `repo`: string (required) — The name of the repository.

  ```ts
  'aws-cdk'
  ```

- `role`: [IRole](https://docs.aws.amazon.com/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.

- `triggerOnPush`: boolean = true — Controls automatically starting your pipeline when a new commit is made on the configured repository and branch.

  If unspecified,
  the default value is true, and the field does not display by default.

- `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
