Class GitHubSourceActionProps
Construction properties of the GitHubSourceAction GitHub source action
.
Inheritance
Namespace: Amazon.CDK.AWS.CodePipeline.Actions
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class GitHubSourceActionProps : Object, IGitHubSourceActionProps, ICommonActionProps
Syntax (vb)
Public Class GitHubSourceActionProps
Inherits Object
Implements IGitHubSourceActionProps, ICommonActionProps
Remarks
ExampleMetadata: infused
Examples
// Read the secret from Secrets Manager
var pipeline = new Pipeline(this, "MyPipeline");
var sourceOutput = new Artifact();
var sourceAction = new GitHubSourceAction(new GitHubSourceActionProps {
ActionName = "GitHub_Source",
Owner = "awslabs",
Repo = "aws-cdk",
OauthToken = SecretValue.SecretsManager("my-github-token"),
Output = sourceOutput,
Branch = "develop"
});
pipeline.AddStage(new StageOptions {
StageName = "Source",
Actions = new [] { sourceAction }
});
Synopsis
Constructors
GitHubSourceActionProps() |
Properties
ActionName | The physical, human-readable name of the Action. |
Branch | The branch to use. |
OauthToken | A GitHub OAuth token to use for authentication. |
Output | |
Owner | The GitHub account/user that owns the repo. |
Repo | The name of the repo, without the username. |
RunOrder | The runOrder property for this Action. |
Trigger | How AWS CodePipeline should be triggered. |
VariablesNamespace | The name of the namespace to use for variables emitted by this action. |
Constructors
GitHubSourceActionProps()
public GitHubSourceActionProps()
Properties
ActionName
The physical, human-readable name of the Action.
public string ActionName { get; set; }
Property Value
System.String
Remarks
Note that Action names must be unique within a single Stage.
Branch
The branch to use.
public string Branch { get; set; }
Property Value
System.String
Remarks
Default: "master"
OauthToken
A GitHub OAuth token to use for authentication.
public SecretValue OauthToken { get; set; }
Property Value
Remarks
It is recommended to use a Secrets Manager Secret
to obtain the token:
const oauth = cdk.SecretValue.secretsManager('my-github-token'); new GitHubSourceAction(this, 'GitHubAction', { oauthToken: oauth, ... });
If you rotate the value in the Secret, you must also change at least one property of the CodePipeline to force CloudFormation to re-read the secret.
The GitHub Personal Access Token should have these scopes:
Output
Owner
The GitHub account/user that owns the repo.
public string Owner { get; set; }
Property Value
System.String
Repo
The name of the repo, without the username.
public string Repo { get; set; }
Property Value
System.String
RunOrder
The runOrder property for this Action.
public Nullable<double> RunOrder { get; set; }
Property Value
System.Nullable<System.Double>
Remarks
RunOrder determines the relative order in which multiple Actions in the same Stage execute.
Default: 1
See: https://docs.aws.amazon.com/codepipeline/latest/userguide/reference-pipeline-structure.html
Trigger
How AWS CodePipeline should be triggered.
public Nullable<GitHubTrigger> Trigger { get; set; }
Property Value
System.Nullable<GitHubTrigger>
Remarks
With the default value "WEBHOOK", a webhook is created in GitHub that triggers the action With "POLL", CodePipeline periodically checks the source for changes With "None", the action is not triggered through changes in the source
To use WEBHOOK
, your GitHub Personal Access Token should have
admin:repo_hook scope (in addition to the regular repo scope).
Default: GitHubTrigger.WEBHOOK
VariablesNamespace
The name of the namespace to use for variables emitted by this action.
public string VariablesNamespace { get; set; }
Property Value
System.String
Remarks
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