# CDK Pipelines for GitHub Workflows ![cdk-constructs: Experimental](https://img.shields.io/badge/cdk--constructs-experimental-important.svg?style=for-the-badge) [![View on Construct Hub](https://constructs.dev/badge?package=cdk-pipelines-github)](https://constructs.dev/packages/cdk-pipelines-github) > The APIs in this module are experimental and under active development. > They are subject to non-backward compatible changes or removal in any future version. These are > not subject to the [Semantic Versioning](https://semver.org/) model and breaking changes will be > announced in the release notes. This means that while you may use them, you may need to update > your source code when upgrading to a newer version of this package. A construct library for painless Continuous Delivery of CDK applications, deployed via [GitHub Workflows](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions). The CDK already has a CI/CD solution, [CDK Pipelines](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.pipelines-readme.html), which creates an AWS CodePipeline that deploys CDK applications. This module serves the same surface area, except that it is implemented with GitHub Workflows. ## Table of Contents - [CDK Pipelines for GitHub Workflows](#cdk-pipelines-for-github-workflows) - [Table of Contents](#table-of-contents) - [Usage](#usage) - [Initial Setup](#initial-setup) - [AWS Credentials](#aws-credentials) - [GitHub Action Role](#github-action-role) - [`GitHubActionRole` Construct](#githubactionrole-construct) - [GitHub Secrets](#github-secrets) - [Runners with Preconfigured Credentials](#runners-with-preconfigured-credentials) - [Using Docker in the Pipeline](#using-docker-in-the-pipeline) - [Authenticating to Docker registries](#authenticating-to-docker-registries) - [Runner Types](#runner-types) - [GitHub Hosted Runner](#github-hosted-runner) - [Self Hosted Runner](#self-hosted-runner) - [Escape Hatches](#escape-hatches) - [Additional Features](#additional-features) - [GitHub Action Step](#github-action-step) - [Configure GitHub Environment](#configure-github-environment) - [Waves for Parallel Builds](#waves-for-parallel-builds) - [Manual Approval Step](#manual-approval-step) - [Pipeline YAML Comments](#pipeline-yaml-comments) - [Tutorial](#tutorial) - [Not supported yet](#not-supported-yet) - [Contributing](#contributing) - [License](#license) ## Usage Assuming you have a [`Stage`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.Stage.html) called `MyStage` that includes CDK stacks for your app and you want to deploy it to two AWS environments (`BETA_ENV` and `PROD_ENV`): ```ts import { ShellStep } from 'aws-cdk-lib/pipelines'; const app = new App(); const pipeline = new GitHubWorkflow(app, 'Pipeline', { synth: new ShellStep('Build', { commands: [ 'yarn install', 'yarn build', ], }), awsCreds: AwsCredentials.fromOpenIdConnect({ gitHubActionRoleArn: 'arn:aws:iam:::role/GitHubActionRole', }), }); // Build the stages const betaStage = new MyStage(app, 'Beta', { env: BETA_ENV }); const prodStage = new MyStage(app, 'Prod', { env: PROD_ENV }); // Add the stages for sequential build - earlier stages failing will stop later ones: pipeline.addStage(betaStage); pipeline.addStage(prodStage); // OR add the stages for parallel building of multiple stages with a Wave: const wave = pipeline.addWave('Wave'); wave.addStage(betaStage); wave.addStage(prodStage); app.synth(); ``` When you run `cdk synth`, a `deploy.yml` workflow will be created under `.github/workflows` in your repo. This workflow will deploy your application based on the definition of the pipeline. In the example above, it will deploy the two stages in sequence, and within each stage, it will deploy all the stacks according to their dependency order and maximum parallelism. If your app uses assets, assets will be published to the relevant destination environment. The `Pipeline` class from `cdk-pipelines-github` is derived from the base CDK Pipelines class, so most features should be supported out of the box. See the [CDK Pipelines](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.pipelines-readme.html) documentation for more details. To express GitHub-specifc details, such as those outlined in [Additional Features](#additional-features), you have a few options: - Use a `GitHubStage` instead of `Stage` (or make a `GitHubStage` subclass instead of a `Stage` subclass) - this adds the `GitHubCommonProps` to the `Stage` properties - With this you can use `pipeline.addStage(myGitHubStage)` or `wave.addStage(myGitHubStage)` and the properties of the stage will be used - Using a `Stage` (or subclass thereof) or a `GitHubStage` (or subclass thereof) you can call `pipeline.addStageWithGitHubOptions(stage, stageOptions)` or `wave.addStageWithGitHubOptions(stage, stageOptions)` - In this case you're providing the same options along with the stage instead of embedded in the stage. - Note that properties of a `GitHubStage` added with `addStageWithGitHubOptions()` will override the options provided to `addStageWithGitHubOptions()` **NOTES:** * Environments must be bootstrapped separately using `cdk bootstrap`. See [CDK Environment Bootstrapping](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.pipelines-readme.html#cdk-environment-bootstrapping) for details. ## Initial Setup Assuming you have your CDK app checked out on your local machine, here are the suggested steps to develop your GitHub Workflow. * Set up AWS Credentials your local environment. It is highly recommended to authenticate via an OpenId Connect IAM Role. You can set one up using the [`GithubActionRole`](#github-action-role) class provided in this module. For more information (and alternatives), see [AWS Credentials](#aws-credentials). * When you've updated your pipeline and are ready to deploy, run `cdk synth`. This creates a workflow file in `.github/workflows/deploy.yml`. * When you are ready to test your pipeline, commit your code changes as well as the `deploy.yml` file to GitHub. GitHub will automatically try to run the workflow found under `.github/workflows/deploy.yml`. * You will be able to see the result of the run on the `Actions` tab in your repository: ![Screen Shot 2021-08-22 at 12 06 05](https://user-images.githubusercontent.com/598796/130349345-a10a2f75-0848-4de8-bc4c-f5a1418ee228.png) For an in-depth run-through on creating your own GitHub Workflow, see the [Tutorial](#tutorial) section. ## AWS Credentials There are two ways to supply AWS credentials to the workflow: * GitHub Action IAM Role (recommended). * Long-lived AWS Credentials stored in GitHub Secrets. The GitHub Action IAM Role authenticates via the GitHub OpenID Connect provider and is recommended, but it requires preparing your AWS account beforehand. This approach allows your Workflow to exchange short-lived tokens directly from AWS. With OIDC, benefits include: * No cloud secrets. * Authentication and authorization management. * Rotating credentials. You can read more [here](https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/about-security-hardening-with-openid-connect). ### GitHub Action Role Authenticating via OpenId Connect means you do not need to store long-lived credentials as GitHub Secrets. With OIDC, you provide a pre-provisioned IAM role with optional role session name to your GitHub Workflow via the `awsCreds.fromOpenIdConnect` API: ```ts import { ShellStep } from 'aws-cdk-lib/pipelines'; const app = new App(); const pipeline = new GitHubWorkflow(app, 'Pipeline', { synth: new ShellStep('Build', { commands: [ 'yarn install', 'yarn build', ], }), awsCreds: AwsCredentials.fromOpenIdConnect({ gitHubActionRoleArn: 'arn:aws:iam:::role/GitHubActionRole', roleSessionName: 'optional-role-session-name', }), }); ``` There are two ways to create this IAM role: * Use the `GitHubActionRole` construct (recommended and described below). * Manually set up the role ([Guide](https://github.com/cdklabs/cdk-pipelines-github/blob/main/GITHUB_ACTION_ROLE_SETUP.md)). #### `GitHubActionRole` Construct Because this construct involves creating an IAM role in your account, it must be created separate to your GitHub Workflow and deployed via a normal `cdk deploy` with your local AWS credentials. Upon successful deployment, the arn of your newly created IAM role will be exposed as a `CfnOutput`. To utilize this construct, create a separate CDK stack with the following code and `cdk deploy`: ```ts class MyGitHubActionRole extends Stack { constructor(scope: Construct, id: string, props?: StackProps) { super(scope, id, props); const provider = new GitHubActionRole(this, 'github-action-role', { repos: ['myUser/myRepo'], }); } } const app = new App(); new MyGitHubActionRole(app, 'MyGitHubActionRole'); app.synth(); ``` Note: If you have previously created the GitHub identity provider with url `https://token.actions.githubusercontent.com`, the above example will fail because you can only have one such provider defined per account. In this case, you must provide the already created provider into your `GithubActionRole` construct via the `provider` property. > Make sure the audience for the provider is `sts.amazonaws.com` in this case. ```ts class MyGitHubActionRole extends Stack { constructor(scope: Construct, id: string, props?: StackProps) { super(scope, id, props); const provider = new GitHubActionRole(this, 'github-action-role', { repos: ['myUser/myRepo'], provider: GitHubActionRole.existingGitHubActionsProvider(this), }); } } ``` ### GitHub Secrets Authenticating via this approach means that you will be manually creating AWS credentials and duplicating them in GitHub secrets. The workflow expects the GitHub repository to include secrets with AWS credentials under `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY`. You can override these defaults by supplying the `awsCreds.fromGitHubSecrets` API to the workflow: ```ts import { ShellStep } from 'aws-cdk-lib/pipelines'; const app = new App(); const pipeline = new GitHubWorkflow(app, 'Pipeline', { synth: new ShellStep('Build', { commands: [ 'yarn install', 'yarn build', ], }), awsCreds: AwsCredentials.fromGitHubSecrets({ accessKeyId: 'MY_ID', // GitHub will look for the access key id under the secret `MY_ID` secretAccessKey: 'MY_KEY', // GitHub will look for the secret access key under the secret `MY_KEY` }), }); ``` ### Runners with Preconfigured Credentials If your runners provide credentials themselves, you can configure `awsCreds` to skip passing credentials: ```ts import { ShellStep } from 'aws-cdk-lib/pipelines'; const app = new App(); const pipeline = new GitHubWorkflow(app, 'Pipeline', { synth: new ShellStep('Build', { commands: [ 'yarn install', 'yarn build', ], }), awsCreds: AwsCredentials.runnerHasPreconfiguredCreds(), // NO credentials will be provided. }); ``` ### Using Docker in the Pipeline You can use Docker in GitHub Workflows in a similar fashion to CDK Pipelines. For a full discussion on how to use Docker in CDK Pipelines, see [Using Docker in the Pipeline](https://github.com/aws/aws-cdk/blob/master/packages/@aws-cdk/pipelines/README.md#using-docker-in-the-pipeline). Just like CDK Pipelines, you may need to authenticate to Docker registries to avoid being throttled. #### Authenticating to Docker registries You can specify credentials to use for authenticating to Docker registries as part of the Workflow definition. This can be useful if any Docker image assets — in the pipeline or any of the application stages — require authentication, either due to being in a different environment (e.g., ECR repo) or to avoid throttling (e.g., DockerHub). ```ts import { ShellStep } from 'aws-cdk-lib/pipelines'; const app = new App(); const pipeline = new GitHubWorkflow(app, 'Pipeline', { synth: new ShellStep('Build', { commands: [ 'yarn install', 'yarn build', ], }), dockerCredentials: [ // Authenticate to ECR DockerCredential.ecr('.dkr.ecr..amazonaws.com'), // Authenticate to DockerHub DockerCredential.dockerHub({ // These properties are defaults; feel free to omit usernameKey: 'DOCKERHUB_USERNAME', personalAccessTokenKey: 'DOCKERHUB_TOKEN', }), // Authenticate to Custom Registries DockerCredential.customRegistry('custom-registry', { usernameKey: 'CUSTOM_USERNAME', passwordKey: 'CUSTOM_PASSWORD', }), ], }); ``` ## Runner Types You can choose to run the workflow in either a GitHub hosted or [self-hosted](https://docs.github.com/en/actions/hosting-your-own-runners/about-self-hosted-runners) runner. ### GitHub Hosted Runner The default is `Runner.UBUNTU_LATEST`. You can override this as shown below: ```ts import { ShellStep } from 'aws-cdk-lib/pipelines'; const app = new App(); const pipeline = new GitHubWorkflow(app, 'Pipeline', { synth: new ShellStep('Build', { commands: [ 'yarn install', 'yarn build', ], }), runner: Runner.WINDOWS_LATEST, }); ``` ### Self Hosted Runner The following example shows how to configure the workflow to run on a self-hosted runner. Note that you do not need to pass in `self-hosted` explicitly as a label. ```ts import { ShellStep } from 'aws-cdk-lib/pipelines'; const app = new App(); const pipeline = new GitHubWorkflow(app, 'Pipeline', { synth: new ShellStep('Build', { commands: [ 'yarn install', 'yarn build', ], }), runner: Runner.selfHosted(['label1', 'label2']), }); ``` ## Escape Hatches You can override the `deploy.yml` workflow file post-synthesis however you like. ```ts import { ShellStep } from 'aws-cdk-lib/pipelines'; const app = new App(); const pipeline = new GitHubWorkflow(app, 'Pipeline', { synth: new ShellStep('Build', { commands: [ 'yarn install', 'yarn build', ], }), }); const deployWorkflow = pipeline.workflowFile; // add `on: workflow_call: {}` to deploy.yml deployWorkflow.patch(JsonPatch.add('/on/workflow_call', {})); // remove `on: workflow_dispatch` from deploy.yml deployWorkflow.patch(JsonPatch.remove('/on/workflow_dispatch')); ``` ## Additional Features Below is a compilation of additional features available for GitHub Workflows. ### GitHub Action Step If you want to call a GitHub Action in a step, you can utilize the `GitHubActionStep`. `GitHubActionStep` extends `Step` and can be used anywhere a `Step` type is allowed. The `jobSteps` array is placed into the pipeline job at the relevant `jobs..steps` as [documented here](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idsteps). In this example, ```ts import { ShellStep } from 'aws-cdk-lib/pipelines'; const app = new App(); const pipeline = new GitHubWorkflow(app, 'Pipeline', { synth: new ShellStep('Build', { commands: [ 'yarn install', 'yarn build', ], }), }); // "Beta" stage with a pre-check that uses code from the repo and an action const stage = new MyStage(app, 'Beta', { env: BETA_ENV }); pipeline.addStage(stage, { pre: [new GitHubActionStep('PreBetaDeployAction', { jobSteps: [ { name: 'Checkout', uses: 'actions/checkout@v3', }, { name: 'pre beta-deploy action', uses: 'my-pre-deploy-action@1.0.0', }, { name: 'pre beta-deploy check', run: 'npm run preDeployCheck', }, ], })], }); app.synth(); ``` ### Configure GitHub Environment You can run your GitHub Workflow in select [GitHub Environments](https://docs.github.com/en/actions/deployment/targeting-different-environments/using-environments-for-deployment). Via the GitHub UI, you can configure environments with protection rules and secrets, and reference those environments in your CDK app. A workflow that references an environment must follow any protection rules for the environment before running or accessing the environment's secrets. Assuming (just like in the main [example](#usage)) you have a [`Stage`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.Stage.html) called `MyStage` that includes CDK stacks for your app and you want to deploy it to two AWS environments (`BETA_ENV` and `PROD_ENV`) as well as GitHub Environments `beta` and `prod`: ```ts import { ShellStep } from 'aws-cdk-lib/pipelines'; const app = new App(); const pipeline = new GitHubWorkflow(app, 'Pipeline', { synth: new ShellStep('Build', { commands: [ 'yarn install', 'yarn build', ], }), awsCreds: AwsCredentials.fromOpenIdConnect({ gitHubActionRoleArn: 'arn:aws:iam:::role/GitHubActionRole', }), }); pipeline.addStageWithGitHubOptions(new Stage(this, 'Beta', { env: BETA_ENV, }), { gitHubEnvironment: { name: 'beta' }, }); pipeline.addStageWithGitHubOptions(new MyStage(this, 'Prod', { env: PROD_ENV, }), { gitHubEnvironment: { name: 'prod' }, }); app.synth(); ``` #### Waves for Parallel Builds You can add a Wave to a pipeline, where each stage of a wave will build in parallel. > **Note**: The `pipeline.addWave()` call will return a `Wave` object that is actually a `GitHubWave` object, but > due to JSII rules the return type of `addWave()` cannot be changed. If you need to use > `wave.addStageWithGitHubOptions()` then you should call `pipeline.addGitHubWave()` instead, or you can > use `GitHubStage`s to carry the GitHub properties. When deploying to multiple accounts or otherwise deploying mostly-unrelated stacks, using waves can be a huge win. Here's a relatively large (but real) example, **without** a wave: without-waves-light-mode You can see how dependencies get chained unnecessarily, where the `cUrl` step should be the final step (a test) for an account: without-waves-deps-light-mode Here's the exact same stages deploying the same stacks to the same accounts, but **with** a wave: with-waves And the dependency chains are reduced to only what is actually needed, with the `cUrl` calls as the final stage for each account: deps For additional information and a code example see [here](docs/waves.md). #### Manual Approval Step One use case for using GitHub Environments with your CDK Pipeline is to create a manual approval step for specific environments via Environment protection rules. From the GitHub UI, you can specify up to 5 required reviewers that must approve before the deployment can proceed: require-reviewers For more information and a tutorial for how to set this up, see this [discussion](https://github.com/cdklabs/cdk-pipelines-github/issues/162). ### Pipeline YAML Comments An "AUTOMATICALLY GENERATED FILE..." comment will by default be added to the top of the pipeline YAML. This can be overriden as desired to add additional context to the pipeline YAML. ``` declare const pipeline: GitHubWorkflow; pipeline.workflowFile.commentAtTop = `AUTOGENERATED FILE, DO NOT EDIT DIRECTLY! Deployed stacks from this pipeline: ${STACK_NAMES.map((s)=>`- ${s}\n`)}`; ``` This will generate the normal `deploy.yml` file, but with the additional comments: ```yaml # AUTOGENERATED FILE, DO NOT EDIT DIRECTLY! # Deployed stacks from this pipeline: # - APIStack # - AuroraStack name: deploy on: push: branches: < the rest of the pipeline YAML contents> ``` ## Tutorial You can find an example usage in [test/example-app.ts](./test/example-app.ts) which includes a simple CDK app and a pipeline. You can find a repository that uses this example here: [eladb/test-app-cdkpipeline](https://github.com/eladb/test-app-cdkpipeline). To run the example, clone this repository and install dependencies: ```shell cd ~/projects # or some other playground space git clone https://github.com/cdklabs/cdk-pipelines-github cd cdk-pipelines-github yarn ``` Now, create a new GitHub repository and clone it as well: ```shell cd ~/projects git clone https://github.com/myaccount/my-test-repository ``` You'll need to set up AWS credentials in your environment. Note that this tutorial uses long-lived GitHub secrets as credentials for simplicity, but it is recommended to set up a GitHub OIDC role instead. ```shell export AWS_ACCESS_KEY_ID=xxxx export AWS_SECRET_ACCESS_KEY=xxxxx ``` Bootstrap your environments: ```shell export CDK_NEW_BOOTSTRAP=1 npx cdk bootstrap aws://ACCOUNTID/us-east-1 npx cdk bootstrap aws://ACCOUNTID/eu-west-2 ``` Now, run the `manual-test.sh` script when your working directory is the new repository: ```shell cd ~/projects/my-test-repository ~/projects/cdk-piplines/github/test/manual-test.sh ``` This will produce a `cdk.out` directory and a `.github/workflows/deploy.yml` file. Commit and push these files to your repo and you should see the deployment workflow in action. Make sure your GitHub repository has `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY` secrets that can access the same account that you synthesized against. > In this tutorial, you are supposed to commit `cdk.out` (i.e. the code is pre-synthed). > Do not do this in your app; you should always synth during the synth step of the GitHub > workflow. In the example app this is achieved through the `preSynthed: true` option. > It is for example purposes only and is not something you should do in your app. > ```ts > import { ShellStep } from 'aws-cdk-lib/pipelines'; > const pipeline = new GitHubWorkflow(new App(), 'Pipeline', { > synth: new ShellStep('Build', { > commands: ['echo "nothing to do (cdk.out is committed)"'], > }), > // only the example app should do this. your app should synth in the synth step. > preSynthed: true, > }); > ``` ## Not supported yet Most features that exist in CDK Pipelines are supported. However, as the CDK Pipelines feature are expands, the feature set for GitHub Workflows may lag behind. If you see a feature that you feel should be supported by GitHub Workflows, please open a GitHub issue to track it. ## Contributing See [CONTRIBUTING](CONTRIBUTING.md) for more information. ## License This project is licensed under the Apache-2.0 License. # API Reference ## Constructs ### GitHubActionRole Creates or references a GitHub OIDC provider and accompanying role that trusts the provider. This role can be used to authenticate against AWS instead of using long-lived AWS user credentials stored in GitHub secrets. You can do this manually in the console, or create a separate stack that uses this construct. You must `cdk deploy` once (with your normal AWS credentials) to have this role created for you. You can then make note of the role arn in the stack output and send it into the Github Workflow app via the `gitHubActionRoleArn` property. The role arn will be `arn:aws:iam:::role/GithubActionRole`. > [https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/configuring-openid-connect-in-amazon-web-services](https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/configuring-openid-connect-in-amazon-web-services) #### Initializers ```typescript import { GitHubActionRole } from 'cdk-pipelines-github' new GitHubActionRole(scope: Construct, id: string, props: GitHubActionRoleProps) ``` | **Name** | **Type** | **Description** | | --- | --- | --- | | scope | constructs.Construct | *No description.* | | id | string | *No description.* | | props | GitHubActionRoleProps | *No description.* | --- ##### `scope`Required - *Type:* constructs.Construct --- ##### `id`Required - *Type:* string --- ##### `props`Required - *Type:* GitHubActionRoleProps --- #### Methods | **Name** | **Description** | | --- | --- | | toString | Returns a string representation of this construct. | --- ##### `toString` ```typescript public toString(): string ``` Returns a string representation of this construct. #### Static Functions | **Name** | **Description** | | --- | --- | | isConstruct | Checks if `x` is a construct. | | existingGitHubActionsProvider | Reference an existing GitHub Actions provider. | --- ##### ~~`isConstruct`~~ ```typescript import { GitHubActionRole } from 'cdk-pipelines-github' GitHubActionRole.isConstruct(x: any) ``` Checks if `x` is a construct. ###### `x`Required - *Type:* any Any object. --- ##### `existingGitHubActionsProvider` ```typescript import { GitHubActionRole } from 'cdk-pipelines-github' GitHubActionRole.existingGitHubActionsProvider(scope: Construct) ``` Reference an existing GitHub Actions provider. You do not need to pass in an arn because the arn for such a provider is always the same. ###### `scope`Required - *Type:* constructs.Construct --- #### Properties | **Name** | **Type** | **Description** | | --- | --- | --- | | node | constructs.Node | The tree node. | | role | aws-cdk-lib.aws_iam.IRole | The role that gets created. | --- ##### `node`Required ```typescript public readonly node: Node; ``` - *Type:* constructs.Node The tree node. --- ##### `role`Required ```typescript public readonly role: IRole; ``` - *Type:* aws-cdk-lib.aws_iam.IRole The role that gets created. You should use the arn of this role as input to the `gitHubActionRoleArn` property in your GitHub Workflow app. --- ### GitHubStage #### Initializers ```typescript import { GitHubStage } from 'cdk-pipelines-github' new GitHubStage(scope: Construct, id: string, props?: GitHubStageProps) ``` | **Name** | **Type** | **Description** | | --- | --- | --- | | scope | constructs.Construct | *No description.* | | id | string | *No description.* | | props | GitHubStageProps | *No description.* | --- ##### `scope`Required - *Type:* constructs.Construct --- ##### `id`Required - *Type:* string --- ##### `props`Optional - *Type:* GitHubStageProps --- #### Methods | **Name** | **Description** | | --- | --- | | toString | Returns a string representation of this construct. | | synth | Synthesize this stage into a cloud assembly. | --- ##### `toString` ```typescript public toString(): string ``` Returns a string representation of this construct. ##### `synth` ```typescript public synth(options?: StageSynthesisOptions): CloudAssembly ``` Synthesize this stage into a cloud assembly. Once an assembly has been synthesized, it cannot be modified. Subsequent calls will return the same assembly. ###### `options`Optional - *Type:* aws-cdk-lib.StageSynthesisOptions --- #### Static Functions | **Name** | **Description** | | --- | --- | | isConstruct | Checks if `x` is a construct. | | isStage | Test whether the given construct is a stage. | | of | Return the stage this construct is contained with, if available. | --- ##### ~~`isConstruct`~~ ```typescript import { GitHubStage } from 'cdk-pipelines-github' GitHubStage.isConstruct(x: any) ``` Checks if `x` is a construct. ###### `x`Required - *Type:* any Any object. --- ##### `isStage` ```typescript import { GitHubStage } from 'cdk-pipelines-github' GitHubStage.isStage(x: any) ``` Test whether the given construct is a stage. ###### `x`Required - *Type:* any --- ##### `of` ```typescript import { GitHubStage } from 'cdk-pipelines-github' GitHubStage.of(construct: IConstruct) ``` Return the stage this construct is contained with, if available. If called on a nested stage, returns its parent. ###### `construct`Required - *Type:* constructs.IConstruct --- #### Properties | **Name** | **Type** | **Description** | | --- | --- | --- | | node | constructs.Node | The tree node. | | artifactId | string | Artifact ID of the assembly if it is a nested stage. The root stage (app) will return an empty string. | | assetOutdir | string | The cloud assembly asset output directory. | | outdir | string | The cloud assembly output directory. | | stageName | string | The name of the stage. | | account | string | The default account for all resources defined within this stage. | | parentStage | aws-cdk-lib.Stage | The parent stage or `undefined` if this is the app. | | region | string | The default region for all resources defined within this stage. | | props | GitHubStageProps | *No description.* | --- ##### `node`Required ```typescript public readonly node: Node; ``` - *Type:* constructs.Node The tree node. --- ##### `artifactId`Required ```typescript public readonly artifactId: string; ``` - *Type:* string Artifact ID of the assembly if it is a nested stage. The root stage (app) will return an empty string. Derived from the construct path. --- ##### `assetOutdir`Required ```typescript public readonly assetOutdir: string; ``` - *Type:* string The cloud assembly asset output directory. --- ##### `outdir`Required ```typescript public readonly outdir: string; ``` - *Type:* string The cloud assembly output directory. --- ##### `stageName`Required ```typescript public readonly stageName: string; ``` - *Type:* string The name of the stage. Based on names of the parent stages separated by hypens. --- ##### `account`Optional ```typescript public readonly account: string; ``` - *Type:* string The default account for all resources defined within this stage. --- ##### `parentStage`Optional ```typescript public readonly parentStage: Stage; ``` - *Type:* aws-cdk-lib.Stage The parent stage or `undefined` if this is the app. * --- ##### `region`Optional ```typescript public readonly region: string; ``` - *Type:* string The default region for all resources defined within this stage. --- ##### `props`Optional ```typescript public readonly props: GitHubStageProps; ``` - *Type:* GitHubStageProps --- ### GitHubWorkflow CDK Pipelines for GitHub workflows. #### Initializers ```typescript import { GitHubWorkflow } from 'cdk-pipelines-github' new GitHubWorkflow(scope: Construct, id: string, props: GitHubWorkflowProps) ``` | **Name** | **Type** | **Description** | | --- | --- | --- | | scope | constructs.Construct | *No description.* | | id | string | *No description.* | | props | GitHubWorkflowProps | *No description.* | --- ##### `scope`Required - *Type:* constructs.Construct --- ##### `id`Required - *Type:* string --- ##### `props`Required - *Type:* GitHubWorkflowProps --- #### Methods | **Name** | **Description** | | --- | --- | | toString | Returns a string representation of this construct. | | addStage | Deploy a single Stage by itself. | | addWave | Add a Wave to the pipeline, for deploying multiple Stages in parallel. | | buildPipeline | Send the current pipeline definition to the engine, and construct the pipeline. | | addGitHubWave | *No description.* | | addStageWithGitHubOptions | Deploy a single Stage by itself with options for further GitHub configuration. | --- ##### `toString` ```typescript public toString(): string ``` Returns a string representation of this construct. ##### `addStage` ```typescript public addStage(stage: Stage, options?: AddStageOpts): StageDeployment ``` Deploy a single Stage by itself. Add a Stage to the pipeline, to be deployed in sequence with other Stages added to the pipeline. All Stacks in the stage will be deployed in an order automatically determined by their relative dependencies. ###### `stage`Required - *Type:* aws-cdk-lib.Stage --- ###### `options`Optional - *Type:* aws-cdk-lib.pipelines.AddStageOpts --- ##### `addWave` ```typescript public addWave(id: string, options?: WaveOptions): Wave ``` Add a Wave to the pipeline, for deploying multiple Stages in parallel. Use the return object of this method to deploy multiple stages in parallel. Example: ```ts declare const pipeline: GitHubWorkflow; // assign pipeline a value const wave = pipeline.addWave('MyWave'); wave.addStage(new MyStage(this, 'Stage1')); wave.addStage(new MyStage(this, 'Stage2')); ``` ###### `id`Required - *Type:* string --- ###### `options`Optional - *Type:* aws-cdk-lib.pipelines.WaveOptions --- ##### `buildPipeline` ```typescript public buildPipeline(): void ``` Send the current pipeline definition to the engine, and construct the pipeline. It is not possible to modify the pipeline after calling this method. ##### `addGitHubWave` ```typescript public addGitHubWave(id: string, options?: WaveOptions): GitHubWave ``` ###### `id`Required - *Type:* string --- ###### `options`Optional - *Type:* aws-cdk-lib.pipelines.WaveOptions --- ##### `addStageWithGitHubOptions` ```typescript public addStageWithGitHubOptions(stage: Stage, options?: AddGitHubStageOptions): StageDeployment ``` Deploy a single Stage by itself with options for further GitHub configuration. Add a Stage to the pipeline, to be deployed in sequence with other Stages added to the pipeline. All Stacks in the stage will be deployed in an order automatically determined by their relative dependencies. ###### `stage`Required - *Type:* aws-cdk-lib.Stage --- ###### `options`Optional - *Type:* AddGitHubStageOptions --- #### Static Functions | **Name** | **Description** | | --- | --- | | isConstruct | Checks if `x` is a construct. | --- ##### ~~`isConstruct`~~ ```typescript import { GitHubWorkflow } from 'cdk-pipelines-github' GitHubWorkflow.isConstruct(x: any) ``` Checks if `x` is a construct. ###### `x`Required - *Type:* any Any object. --- #### Properties | **Name** | **Type** | **Description** | | --- | --- | --- | | node | constructs.Node | The tree node. | | cloudAssemblyFileSet | aws-cdk-lib.pipelines.FileSet | The FileSet tha contains the cloud assembly. | | synth | aws-cdk-lib.pipelines.IFileSetProducer | The build step that produces the CDK Cloud Assembly. | | waves | aws-cdk-lib.pipelines.Wave[] | The waves in this pipeline. | | workflowFile | YamlFile | *No description.* | | workflowName | string | *No description.* | | workflowPath | string | *No description.* | --- ##### `node`Required ```typescript public readonly node: Node; ``` - *Type:* constructs.Node The tree node. --- ##### `cloudAssemblyFileSet`Required ```typescript public readonly cloudAssemblyFileSet: FileSet; ``` - *Type:* aws-cdk-lib.pipelines.FileSet The FileSet tha contains the cloud assembly. This is the primary output of the synth step. --- ##### `synth`Required ```typescript public readonly synth: IFileSetProducer; ``` - *Type:* aws-cdk-lib.pipelines.IFileSetProducer The build step that produces the CDK Cloud Assembly. --- ##### `waves`Required ```typescript public readonly waves: Wave[]; ``` - *Type:* aws-cdk-lib.pipelines.Wave[] The waves in this pipeline. --- ##### `workflowFile`Required ```typescript public readonly workflowFile: YamlFile; ``` - *Type:* YamlFile --- ##### `workflowName`Required ```typescript public readonly workflowName: string; ``` - *Type:* string --- ##### `workflowPath`Required ```typescript public readonly workflowPath: string; ``` - *Type:* string --- ## Structs ### AddGitHubStageOptions Options to pass to `addStageWithGitHubOpts`. #### Initializer ```typescript import { AddGitHubStageOptions } from 'cdk-pipelines-github' const addGitHubStageOptions: AddGitHubStageOptions = { ... } ``` #### Properties | **Name** | **Type** | **Description** | | --- | --- | --- | | post | aws-cdk-lib.pipelines.Step[] | Additional steps to run after all of the stacks in the stage. | | pre | aws-cdk-lib.pipelines.Step[] | Additional steps to run before any of the stacks in the stage. | | stackSteps | aws-cdk-lib.pipelines.StackSteps[] | Instructions for stack level steps. | | gitHubEnvironment | GitHubEnvironment | Run the stage in a specific GitHub Environment. | | jobSettings | JobSettings | Job level settings that will be applied to all jobs in the stage. | | stackCapabilities | StackCapabilities[] | In some cases, you must explicitly acknowledge that your CloudFormation stack template contains certain capabilities in order for CloudFormation to create the stack. | --- ##### `post`Optional ```typescript public readonly post: Step[]; ``` - *Type:* aws-cdk-lib.pipelines.Step[] - *Default:* No additional steps Additional steps to run after all of the stacks in the stage. --- ##### `pre`Optional ```typescript public readonly pre: Step[]; ``` - *Type:* aws-cdk-lib.pipelines.Step[] - *Default:* No additional steps Additional steps to run before any of the stacks in the stage. --- ##### `stackSteps`Optional ```typescript public readonly stackSteps: StackSteps[]; ``` - *Type:* aws-cdk-lib.pipelines.StackSteps[] - *Default:* No additional instructions Instructions for stack level steps. --- ##### `gitHubEnvironment`Optional ```typescript public readonly gitHubEnvironment: GitHubEnvironment; ``` - *Type:* GitHubEnvironment - *Default:* no GitHub environment Run the stage in a specific GitHub Environment. If specified, any protection rules configured for the environment must pass before the job is set to a runner. For example, if the environment has a manual approval rule configured, then the workflow will wait for the approval before sending the job to the runner. Running a workflow that references an environment that does not exist will create an environment with the referenced name. > [https://docs.github.com/en/actions/deployment/targeting-different-environments/using-environments-for-deployment](https://docs.github.com/en/actions/deployment/targeting-different-environments/using-environments-for-deployment) --- ##### `jobSettings`Optional ```typescript public readonly jobSettings: JobSettings; ``` - *Type:* JobSettings Job level settings that will be applied to all jobs in the stage. Currently the only valid setting is 'if'. --- ##### `stackCapabilities`Optional ```typescript public readonly stackCapabilities: StackCapabilities[]; ``` - *Type:* StackCapabilities[] - *Default:* ['CAPABILITY_IAM'] In some cases, you must explicitly acknowledge that your CloudFormation stack template contains certain capabilities in order for CloudFormation to create the stack. If insufficiently specified, CloudFormation returns an `InsufficientCapabilities` error. --- ### AwsCredentialsSecrets Names of secrets for AWS credentials. #### Initializer ```typescript import { AwsCredentialsSecrets } from 'cdk-pipelines-github' const awsCredentialsSecrets: AwsCredentialsSecrets = { ... } ``` #### Properties | **Name** | **Type** | **Description** | | --- | --- | --- | | accessKeyId | string | *No description.* | | secretAccessKey | string | *No description.* | | sessionToken | string | *No description.* | --- ##### `accessKeyId`Optional ```typescript public readonly accessKeyId: string; ``` - *Type:* string - *Default:* "AWS_ACCESS_KEY_ID" --- ##### `secretAccessKey`Optional ```typescript public readonly secretAccessKey: string; ``` - *Type:* string - *Default:* "AWS_SECRET_ACCESS_KEY" --- ##### `sessionToken`Optional ```typescript public readonly sessionToken: string; ``` - *Type:* string - *Default:* no session token is used --- ### CheckRunOptions Check run options. #### Initializer ```typescript import { CheckRunOptions } from 'cdk-pipelines-github' const checkRunOptions: CheckRunOptions = { ... } ``` #### Properties | **Name** | **Type** | **Description** | | --- | --- | --- | | types | string[] | Which activity types to trigger on. | --- ##### `types`Optional ```typescript public readonly types: string[]; ``` - *Type:* string[] Which activity types to trigger on. --- ### CheckSuiteOptions Check suite options. #### Initializer ```typescript import { CheckSuiteOptions } from 'cdk-pipelines-github' const checkSuiteOptions: CheckSuiteOptions = { ... } ``` #### Properties | **Name** | **Type** | **Description** | | --- | --- | --- | | types | string[] | Which activity types to trigger on. | --- ##### `types`Optional ```typescript public readonly types: string[]; ``` - *Type:* string[] Which activity types to trigger on. --- ### ContainerCredentials Credentials to use to authenticate to Docker registries. #### Initializer ```typescript import { ContainerCredentials } from 'cdk-pipelines-github' const containerCredentials: ContainerCredentials = { ... } ``` #### Properties | **Name** | **Type** | **Description** | | --- | --- | --- | | password | string | The password. | | username | string | The username. | --- ##### `password`Required ```typescript public readonly password: string; ``` - *Type:* string The password. --- ##### `username`Required ```typescript public readonly username: string; ``` - *Type:* string The username. --- ### ContainerOptions Options petaining to container environments. #### Initializer ```typescript import { ContainerOptions } from 'cdk-pipelines-github' const containerOptions: ContainerOptions = { ... } ``` #### Properties | **Name** | **Type** | **Description** | | --- | --- | --- | | image | string | The Docker image to use as the container to run the action. | | credentials | ContainerCredentials | f the image's container registry requires authentication to pull the image, you can use credentials to set a map of the username and password. | | env | {[ key: string ]: string} | Sets a map of environment variables in the container. | | options | string[] | Additional Docker container resource options. | | ports | number[] | Sets an array of ports to expose on the container. | | volumes | string[] | Sets an array of volumes for the container to use. | --- ##### `image`Required ```typescript public readonly image: string; ``` - *Type:* string The Docker image to use as the container to run the action. The value can be the Docker Hub image name or a registry name. --- ##### `credentials`Optional ```typescript public readonly credentials: ContainerCredentials; ``` - *Type:* ContainerCredentials f the image's container registry requires authentication to pull the image, you can use credentials to set a map of the username and password. The credentials are the same values that you would provide to the docker login command. --- ##### `env`Optional ```typescript public readonly env: {[ key: string ]: string}; ``` - *Type:* {[ key: string ]: string} Sets a map of environment variables in the container. --- ##### `options`Optional ```typescript public readonly options: string[]; ``` - *Type:* string[] Additional Docker container resource options. > [https://docs.docker.com/engine/reference/commandline/create/#options](https://docs.docker.com/engine/reference/commandline/create/#options) --- ##### `ports`Optional ```typescript public readonly ports: number[]; ``` - *Type:* number[] Sets an array of ports to expose on the container. --- ##### `volumes`Optional ```typescript public readonly volumes: string[]; ``` - *Type:* string[] Sets an array of volumes for the container to use. You can use volumes to share data between services or other steps in a job. You can specify named Docker volumes, anonymous Docker volumes, or bind mounts on the host. To specify a volume, you specify the source and destination path: `:`. --- ### CreateOptions The Create event accepts no options. #### Initializer ```typescript import { CreateOptions } from 'cdk-pipelines-github' const createOptions: CreateOptions = { ... } ``` ### CronScheduleOptions CRON schedule options. #### Initializer ```typescript import { CronScheduleOptions } from 'cdk-pipelines-github' const cronScheduleOptions: CronScheduleOptions = { ... } ``` #### Properties | **Name** | **Type** | **Description** | | --- | --- | --- | | cron | string | *No description.* | --- ##### `cron`Required ```typescript public readonly cron: string; ``` - *Type:* string > [https://pubs.opengroup.org/onlinepubs/9699919799/utilities/crontab.html#tag_20_25_07](https://pubs.opengroup.org/onlinepubs/9699919799/utilities/crontab.html#tag_20_25_07) --- ### DeleteOptions The Delete event accepts no options. #### Initializer ```typescript import { DeleteOptions } from 'cdk-pipelines-github' const deleteOptions: DeleteOptions = { ... } ``` ### DeploymentOptions The Deployment event accepts no options. #### Initializer ```typescript import { DeploymentOptions } from 'cdk-pipelines-github' const deploymentOptions: DeploymentOptions = { ... } ``` ### DeploymentStatusOptions The Deployment status event accepts no options. #### Initializer ```typescript import { DeploymentStatusOptions } from 'cdk-pipelines-github' const deploymentStatusOptions: DeploymentStatusOptions = { ... } ``` ### DockerHubCredentialSecrets Locations of GitHub Secrets used to authenticate to DockerHub. #### Initializer ```typescript import { DockerHubCredentialSecrets } from 'cdk-pipelines-github' const dockerHubCredentialSecrets: DockerHubCredentialSecrets = { ... } ``` #### Properties | **Name** | **Type** | **Description** | | --- | --- | --- | | personalAccessTokenKey | string | The key of the GitHub Secret containing the DockerHub personal access token. | | usernameKey | string | The key of the GitHub Secret containing the DockerHub username. | --- ##### `personalAccessTokenKey`Optional ```typescript public readonly personalAccessTokenKey: string; ``` - *Type:* string - *Default:* 'DOCKERHUB_TOKEN' The key of the GitHub Secret containing the DockerHub personal access token. --- ##### `usernameKey`Optional ```typescript public readonly usernameKey: string; ``` - *Type:* string - *Default:* 'DOCKERHUB_USERNAME' The key of the GitHub Secret containing the DockerHub username. --- ### ExternalDockerCredentialSecrets Generic structure to supply the locations of GitHub Secrets used to authenticate to a docker registry. #### Initializer ```typescript import { ExternalDockerCredentialSecrets } from 'cdk-pipelines-github' const externalDockerCredentialSecrets: ExternalDockerCredentialSecrets = { ... } ``` #### Properties | **Name** | **Type** | **Description** | | --- | --- | --- | | passwordKey | string | The key of the GitHub Secret containing your registry password. | | usernameKey | string | The key of the GitHub Secret containing your registry username. | --- ##### `passwordKey`Required ```typescript public readonly passwordKey: string; ``` - *Type:* string The key of the GitHub Secret containing your registry password. --- ##### `usernameKey`Required ```typescript public readonly usernameKey: string; ``` - *Type:* string The key of the GitHub Secret containing your registry username. --- ### ForkOptions The Fork event accepts no options. #### Initializer ```typescript import { ForkOptions } from 'cdk-pipelines-github' const forkOptions: ForkOptions = { ... } ``` ### GitHubActionRoleProps Properties for the GitHubActionRole construct. #### Initializer ```typescript import { GitHubActionRoleProps } from 'cdk-pipelines-github' const gitHubActionRoleProps: GitHubActionRoleProps = { ... } ``` #### Properties | **Name** | **Type** | **Description** | | --- | --- | --- | | repos | string[] | A list of GitHub repositories you want to be able to access the IAM role. | | provider | aws-cdk-lib.aws_iam.IOpenIdConnectProvider | The GitHub OpenId Connect Provider. Must have provider url `https://token.actions.githubusercontent.com`. The audience must be `sts:amazonaws.com`. | | roleName | string | The name of the Oidc role. | | thumbprints | string[] | Thumbprints of GitHub's certificates. | --- ##### `repos`Required ```typescript public readonly repos: string[]; ``` - *Type:* string[] A list of GitHub repositories you want to be able to access the IAM role. Each entry should be your GitHub username and repository passed in as a single string. For example, `['owner/repo1', 'owner/repo2']. --- ##### `provider`Optional ```typescript public readonly provider: IOpenIdConnectProvider; ``` - *Type:* aws-cdk-lib.aws_iam.IOpenIdConnectProvider - *Default:* a provider is created for you. The GitHub OpenId Connect Provider. Must have provider url `https://token.actions.githubusercontent.com`. The audience must be `sts:amazonaws.com`. Only one such provider can be defined per account, so if you already have a provider with the same url, a new provider cannot be created for you. --- ##### `roleName`Optional ```typescript public readonly roleName: string; ``` - *Type:* string - *Default:* 'GitHubActionRole' The name of the Oidc role. --- ##### `thumbprints`Optional ```typescript public readonly thumbprints: string[]; ``` - *Type:* string[] - *Default:* Use built-in keys Thumbprints of GitHub's certificates. Every time GitHub rotates their certificates, this value will need to be updated. Default value is up-to-date to June 27, 2023 as per https://github.blog/changelog/2023-06-27-github-actions-update-on-oidc-integration-with-aws/ --- ### GitHubActionStepProps #### Initializer ```typescript import { GitHubActionStepProps } from 'cdk-pipelines-github' const gitHubActionStepProps: GitHubActionStepProps = { ... } ``` #### Properties | **Name** | **Type** | **Description** | | --- | --- | --- | | jobSteps | JobStep[] | The Job steps. | | env | {[ key: string ]: string} | Environment variables to set. | --- ##### `jobSteps`Required ```typescript public readonly jobSteps: JobStep[]; ``` - *Type:* JobStep[] The Job steps. --- ##### `env`Optional ```typescript public readonly env: {[ key: string ]: string}; ``` - *Type:* {[ key: string ]: string} Environment variables to set. --- ### GitHubCommonProps Common properties to extend both StageProps and AddStageOpts. #### Initializer ```typescript import { GitHubCommonProps } from 'cdk-pipelines-github' const gitHubCommonProps: GitHubCommonProps = { ... } ``` #### Properties | **Name** | **Type** | **Description** | | --- | --- | --- | | gitHubEnvironment | GitHubEnvironment | Run the stage in a specific GitHub Environment. | | jobSettings | JobSettings | Job level settings that will be applied to all jobs in the stage. | | stackCapabilities | StackCapabilities[] | In some cases, you must explicitly acknowledge that your CloudFormation stack template contains certain capabilities in order for CloudFormation to create the stack. | --- ##### `gitHubEnvironment`Optional ```typescript public readonly gitHubEnvironment: GitHubEnvironment; ``` - *Type:* GitHubEnvironment - *Default:* no GitHub environment Run the stage in a specific GitHub Environment. If specified, any protection rules configured for the environment must pass before the job is set to a runner. For example, if the environment has a manual approval rule configured, then the workflow will wait for the approval before sending the job to the runner. Running a workflow that references an environment that does not exist will create an environment with the referenced name. > [https://docs.github.com/en/actions/deployment/targeting-different-environments/using-environments-for-deployment](https://docs.github.com/en/actions/deployment/targeting-different-environments/using-environments-for-deployment) --- ##### `jobSettings`Optional ```typescript public readonly jobSettings: JobSettings; ``` - *Type:* JobSettings Job level settings that will be applied to all jobs in the stage. Currently the only valid setting is 'if'. --- ##### `stackCapabilities`Optional ```typescript public readonly stackCapabilities: StackCapabilities[]; ``` - *Type:* StackCapabilities[] - *Default:* ['CAPABILITY_IAM'] In some cases, you must explicitly acknowledge that your CloudFormation stack template contains certain capabilities in order for CloudFormation to create the stack. If insufficiently specified, CloudFormation returns an `InsufficientCapabilities` error. --- ### GitHubEnvironment Github environment with name and url. > [https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idenvironment](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idenvironment) #### Initializer ```typescript import { GitHubEnvironment } from 'cdk-pipelines-github' const gitHubEnvironment: GitHubEnvironment = { ... } ``` #### Properties | **Name** | **Type** | **Description** | | --- | --- | --- | | name | string | Name of the environment. | | url | string | The url for the environment. | --- ##### `name`Required ```typescript public readonly name: string; ``` - *Type:* string Name of the environment. > [https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#example-using-environment-name-and-url](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#example-using-environment-name-and-url) --- ##### `url`Optional ```typescript public readonly url: string; ``` - *Type:* string The url for the environment. > [https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#example-using-environment-name-and-url](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#example-using-environment-name-and-url) --- ### GitHubSecretsProviderProps Locations of GitHub Secrets used to authenticate to AWS. #### Initializer ```typescript import { GitHubSecretsProviderProps } from 'cdk-pipelines-github' const gitHubSecretsProviderProps: GitHubSecretsProviderProps = { ... } ``` #### Properties | **Name** | **Type** | **Description** | | --- | --- | --- | | accessKeyId | string | *No description.* | | secretAccessKey | string | *No description.* | | sessionToken | string | *No description.* | --- ##### `accessKeyId`Required ```typescript public readonly accessKeyId: string; ``` - *Type:* string - *Default:* "AWS_ACCESS_KEY_ID" --- ##### `secretAccessKey`Required ```typescript public readonly secretAccessKey: string; ``` - *Type:* string - *Default:* "AWS_SECRET_ACCESS_KEY" --- ##### `sessionToken`Optional ```typescript public readonly sessionToken: string; ``` - *Type:* string - *Default:* no session token is used --- ### GitHubStageProps #### Initializer ```typescript import { GitHubStageProps } from 'cdk-pipelines-github' const gitHubStageProps: GitHubStageProps = { ... } ``` #### Properties | **Name** | **Type** | **Description** | | --- | --- | --- | | env | aws-cdk-lib.Environment | Default AWS environment (account/region) for `Stack`s in this `Stage`. | | outdir | string | The output directory into which to emit synthesized artifacts. | | gitHubEnvironment | GitHubEnvironment | Run the stage in a specific GitHub Environment. | | jobSettings | JobSettings | Job level settings that will be applied to all jobs in the stage. | | stackCapabilities | StackCapabilities[] | In some cases, you must explicitly acknowledge that your CloudFormation stack template contains certain capabilities in order for CloudFormation to create the stack. | --- ##### `env`Optional ```typescript public readonly env: Environment; ``` - *Type:* aws-cdk-lib.Environment - *Default:* The environments should be configured on the `Stack`s. Default AWS environment (account/region) for `Stack`s in this `Stage`. Stacks defined inside this `Stage` with either `region` or `account` missing from its env will use the corresponding field given here. If either `region` or `account`is is not configured for `Stack` (either on the `Stack` itself or on the containing `Stage`), the Stack will be *environment-agnostic*. Environment-agnostic stacks can be deployed to any environment, may not be able to take advantage of all features of the CDK. For example, they will not be able to use environmental context lookups, will not automatically translate Service Principals to the right format based on the environment's AWS partition, and other such enhancements. --- *Example* ```typescript // Use a concrete account and region to deploy this Stage to new Stage(app, 'Stage1', { env: { account: '123456789012', region: 'us-east-1' }, }); // Use the CLI's current credentials to determine the target environment new Stage(app, 'Stage2', { env: { account: process.env.CDK_DEFAULT_ACCOUNT, region: process.env.CDK_DEFAULT_REGION }, }); ``` ##### `outdir`Optional ```typescript public readonly outdir: string; ``` - *Type:* string - *Default:* for nested stages, outdir will be determined as a relative directory to the outdir of the app. For apps, if outdir is not specified, a temporary directory will be created. The output directory into which to emit synthesized artifacts. Can only be specified if this stage is the root stage (the app). If this is specified and this stage is nested within another stage, an error will be thrown. --- ##### `gitHubEnvironment`Optional ```typescript public readonly gitHubEnvironment: GitHubEnvironment; ``` - *Type:* GitHubEnvironment - *Default:* no GitHub environment Run the stage in a specific GitHub Environment. If specified, any protection rules configured for the environment must pass before the job is set to a runner. For example, if the environment has a manual approval rule configured, then the workflow will wait for the approval before sending the job to the runner. Running a workflow that references an environment that does not exist will create an environment with the referenced name. > [https://docs.github.com/en/actions/deployment/targeting-different-environments/using-environments-for-deployment](https://docs.github.com/en/actions/deployment/targeting-different-environments/using-environments-for-deployment) --- ##### `jobSettings`Optional ```typescript public readonly jobSettings: JobSettings; ``` - *Type:* JobSettings Job level settings that will be applied to all jobs in the stage. Currently the only valid setting is 'if'. --- ##### `stackCapabilities`Optional ```typescript public readonly stackCapabilities: StackCapabilities[]; ``` - *Type:* StackCapabilities[] - *Default:* ['CAPABILITY_IAM'] In some cases, you must explicitly acknowledge that your CloudFormation stack template contains certain capabilities in order for CloudFormation to create the stack. If insufficiently specified, CloudFormation returns an `InsufficientCapabilities` error. --- ### GitHubWorkflowProps Props for `GitHubWorkflow`. #### Initializer ```typescript import { GitHubWorkflowProps } from 'cdk-pipelines-github' const gitHubWorkflowProps: GitHubWorkflowProps = { ... } ``` #### Properties | **Name** | **Type** | **Description** | | --- | --- | --- | | synth | aws-cdk-lib.pipelines.IFileSetProducer | The build step that produces the CDK Cloud Assembly. | | awsCredentials | AwsCredentialsSecrets | Names of GitHub repository secrets that include AWS credentials for deployment. | | awsCreds | AwsCredentialsProvider | Configure provider for AWS credentials used for deployment. | | buildContainer | ContainerOptions | Build container options. | | cdkCliVersion | string | Version of the CDK CLI to use. | | dockerCredentials | DockerCredential[] | The Docker Credentials to use to login. | | gitHubActionRoleArn | string | A role that utilizes the GitHub OIDC Identity Provider in your AWS account. | | jobSettings | JobSettings | Job level settings that will be applied to all jobs in the workflow, including synth and asset deploy jobs. | | postBuildSteps | JobStep[] | GitHub workflow steps to execute after build. | | preBuildSteps | JobStep[] | GitHub workflow steps to execute before build. | | preSynthed | boolean | Indicates if the repository already contains a synthesized `cdk.out` directory, in which case we will simply checkout the repo in jobs that require `cdk.out`. | | publishAssetsAuthRegion | string | Will assume the GitHubActionRole in this region when publishing assets. | | runner | Runner | The type of runner to run the job on. | | workflowName | string | Name of the workflow. | | workflowPath | string | File path for the GitHub workflow. | | workflowTriggers | WorkflowTriggers | GitHub workflow triggers. | --- ##### `synth`Required ```typescript public readonly synth: IFileSetProducer; ``` - *Type:* aws-cdk-lib.pipelines.IFileSetProducer The build step that produces the CDK Cloud Assembly. The primary output of this step needs to be the `cdk.out` directory generated by the `cdk synth` command. If you use a `ShellStep` here and you don't configure an output directory, the output directory will automatically be assumed to be `cdk.out`. --- ##### ~~`awsCredentials`~~Optional - *Deprecated:* Use `awsCreds.fromGitHubSecrets()` instead. ```typescript public readonly awsCredentials: AwsCredentialsSecrets; ``` - *Type:* AwsCredentialsSecrets - *Default:* `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY`. Names of GitHub repository secrets that include AWS credentials for deployment. --- ##### `awsCreds`Optional ```typescript public readonly awsCreds: AwsCredentialsProvider; ``` - *Type:* AwsCredentialsProvider - *Default:* Get AWS credentials from GitHub secrets `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY`. Configure provider for AWS credentials used for deployment. --- ##### `buildContainer`Optional ```typescript public readonly buildContainer: ContainerOptions; ``` - *Type:* ContainerOptions - *Default:* GitHub defaults Build container options. --- ##### `cdkCliVersion`Optional ```typescript public readonly cdkCliVersion: string; ``` - *Type:* string - *Default:* automatic Version of the CDK CLI to use. --- ##### `dockerCredentials`Optional ```typescript public readonly dockerCredentials: DockerCredential[]; ``` - *Type:* DockerCredential[] The Docker Credentials to use to login. If you set this variable, you will be logged in to docker when you upload Docker Assets. --- ##### ~~`gitHubActionRoleArn`~~Optional - *Deprecated:* Use `awsCreds.fromOpenIdConnect()` instead. ```typescript public readonly gitHubActionRoleArn: string; ``` - *Type:* string - *Default:* GitHub repository secrets are used instead of OpenId Connect role. A role that utilizes the GitHub OIDC Identity Provider in your AWS account. If supplied, this will be used instead of `awsCredentials`. You can create your own role in the console with the necessary trust policy to allow gitHub actions from your gitHub repository to assume the role, or you can utilize the `GitHubActionRole` construct to create a role for you. --- ##### `jobSettings`Optional ```typescript public readonly jobSettings: JobSettings; ``` - *Type:* JobSettings Job level settings that will be applied to all jobs in the workflow, including synth and asset deploy jobs. Currently the only valid setting is 'if'. You can use this to run jobs only in specific repositories. > [https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#example-only-run-job-for-specific-repository](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#example-only-run-job-for-specific-repository) --- ##### `postBuildSteps`Optional ```typescript public readonly postBuildSteps: JobStep[]; ``` - *Type:* JobStep[] - *Default:* [] GitHub workflow steps to execute after build. --- ##### `preBuildSteps`Optional ```typescript public readonly preBuildSteps: JobStep[]; ``` - *Type:* JobStep[] - *Default:* [] GitHub workflow steps to execute before build. --- ##### `preSynthed`Optional ```typescript public readonly preSynthed: boolean; ``` - *Type:* boolean - *Default:* false Indicates if the repository already contains a synthesized `cdk.out` directory, in which case we will simply checkout the repo in jobs that require `cdk.out`. --- ##### `publishAssetsAuthRegion`Optional ```typescript public readonly publishAssetsAuthRegion: string; ``` - *Type:* string - *Default:* "us-west-2" Will assume the GitHubActionRole in this region when publishing assets. This is NOT the region in which the assets are published. In most cases, you do not have to worry about this property, and can safely ignore it. --- ##### `runner`Optional ```typescript public readonly runner: Runner; ``` - *Type:* Runner - *Default:* Runner.UBUNTU_LATEST The type of runner to run the job on. The runner can be either a GitHub-hosted runner or a self-hosted runner. --- ##### `workflowName`Optional ```typescript public readonly workflowName: string; ``` - *Type:* string - *Default:* "deploy" Name of the workflow. --- ##### `workflowPath`Optional ```typescript public readonly workflowPath: string; ``` - *Type:* string - *Default:* ".github/workflows/deploy.yml" File path for the GitHub workflow. --- ##### `workflowTriggers`Optional ```typescript public readonly workflowTriggers: WorkflowTriggers; ``` - *Type:* WorkflowTriggers - *Default:* By default, workflow is triggered on push to the `main` branch and can also be triggered manually (`workflow_dispatch`). GitHub workflow triggers. --- ### GollumOptions The Gollum event accepts no options. #### Initializer ```typescript import { GollumOptions } from 'cdk-pipelines-github' const gollumOptions: GollumOptions = { ... } ``` ### IssueCommentOptions Issue comment options. #### Initializer ```typescript import { IssueCommentOptions } from 'cdk-pipelines-github' const issueCommentOptions: IssueCommentOptions = { ... } ``` #### Properties | **Name** | **Type** | **Description** | | --- | --- | --- | | types | string[] | Which activity types to trigger on. | --- ##### `types`Optional ```typescript public readonly types: string[]; ``` - *Type:* string[] Which activity types to trigger on. --- ### IssuesOptions Issues options. #### Initializer ```typescript import { IssuesOptions } from 'cdk-pipelines-github' const issuesOptions: IssuesOptions = { ... } ``` #### Properties | **Name** | **Type** | **Description** | | --- | --- | --- | | types | string[] | Which activity types to trigger on. | --- ##### `types`Optional ```typescript public readonly types: string[]; ``` - *Type:* string[] Which activity types to trigger on. --- ### Job A GitHub Workflow job definition. #### Initializer ```typescript import { Job } from 'cdk-pipelines-github' const job: Job = { ... } ``` #### Properties | **Name** | **Type** | **Description** | | --- | --- | --- | | permissions | JobPermissions | You can modify the default permissions granted to the GITHUB_TOKEN, adding or removing access as required, so that you only allow the minimum required access. | | runsOn | string \| string[] | The type of machine to run the job on. | | steps | JobStep[] | A job contains a sequence of tasks called steps. | | concurrency | any | Concurrency ensures that only a single job or workflow using the same concurrency group will run at a time. | | container | ContainerOptions | A container to run any steps in a job that don't already specify a container. | | continueOnError | boolean | Prevents a workflow run from failing when a job fails. | | defaults | JobDefaults | A map of default settings that will apply to all steps in the job. | | env | {[ key: string ]: string} | A map of environment variables that are available to all steps in the job. | | environment | any | The environment that the job references. | | if | string | You can use the if conditional to prevent a job from running unless a condition is met. | | name | string | The name of the job displayed on GitHub. | | needs | string[] | Identifies any jobs that must complete successfully before this job will run. | | outputs | {[ key: string ]: string} | A map of outputs for a job. | | services | {[ key: string ]: ContainerOptions} | Used to host service containers for a job in a workflow. | | strategy | JobStrategy | A strategy creates a build matrix for your jobs. | | timeoutMinutes | number | The maximum number of minutes to let a job run before GitHub automatically cancels it. | --- ##### `permissions`Required ```typescript public readonly permissions: JobPermissions; ``` - *Type:* JobPermissions You can modify the default permissions granted to the GITHUB_TOKEN, adding or removing access as required, so that you only allow the minimum required access. Use `{ contents: READ }` if your job only needs to clone code. This is intentionally a required field since it is required in order to allow workflows to run in GitHub repositories with restricted default access. > [https://docs.github.com/en/actions/reference/authentication-in-a-workflow#permissions-for-the-github_token](https://docs.github.com/en/actions/reference/authentication-in-a-workflow#permissions-for-the-github_token) --- ##### `runsOn`Required ```typescript public readonly runsOn: string | string[]; ``` - *Type:* string | string[] The type of machine to run the job on. The machine can be either a GitHub-hosted runner or a self-hosted runner. --- *Example* ```typescript ["ubuntu-latest"] ``` ##### `steps`Required ```typescript public readonly steps: JobStep[]; ``` - *Type:* JobStep[] A job contains a sequence of tasks called steps. Steps can run commands, run setup tasks, or run an action in your repository, a public repository, or an action published in a Docker registry. Not all steps run actions, but all actions run as a step. Each step runs in its own process in the runner environment and has access to the workspace and filesystem. Because steps run in their own process, changes to environment variables are not preserved between steps. GitHub provides built-in steps to set up and complete a job. --- ##### `concurrency`Optional ```typescript public readonly concurrency: any; ``` - *Type:* any Concurrency ensures that only a single job or workflow using the same concurrency group will run at a time. A concurrency group can be any string or expression. The expression can use any context except for the secrets context. --- ##### `container`Optional ```typescript public readonly container: ContainerOptions; ``` - *Type:* ContainerOptions A container to run any steps in a job that don't already specify a container. If you have steps that use both script and container actions, the container actions will run as sibling containers on the same network with the same volume mounts. --- ##### `continueOnError`Optional ```typescript public readonly continueOnError: boolean; ``` - *Type:* boolean Prevents a workflow run from failing when a job fails. Set to true to allow a workflow run to pass when this job fails. --- ##### `defaults`Optional ```typescript public readonly defaults: JobDefaults; ``` - *Type:* JobDefaults A map of default settings that will apply to all steps in the job. You can also set default settings for the entire workflow. --- ##### `env`Optional ```typescript public readonly env: {[ key: string ]: string}; ``` - *Type:* {[ key: string ]: string} A map of environment variables that are available to all steps in the job. You can also set environment variables for the entire workflow or an individual step. --- ##### `environment`Optional ```typescript public readonly environment: any; ``` - *Type:* any The environment that the job references. All environment protection rules must pass before a job referencing the environment is sent to a runner. > [https://docs.github.com/en/actions/reference/environments](https://docs.github.com/en/actions/reference/environments) --- ##### `if`Optional ```typescript public readonly if: string; ``` - *Type:* string You can use the if conditional to prevent a job from running unless a condition is met. You can use any supported context and expression to create a conditional. --- ##### `name`Optional ```typescript public readonly name: string; ``` - *Type:* string The name of the job displayed on GitHub. --- ##### `needs`Optional ```typescript public readonly needs: string[]; ``` - *Type:* string[] Identifies any jobs that must complete successfully before this job will run. It can be a string or array of strings. If a job fails, all jobs that need it are skipped unless the jobs use a conditional expression that causes the job to continue. --- ##### `outputs`Optional ```typescript public readonly outputs: {[ key: string ]: string}; ``` - *Type:* {[ key: string ]: string} A map of outputs for a job. Job outputs are available to all downstream jobs that depend on this job. --- ##### `services`Optional ```typescript public readonly services: {[ key: string ]: ContainerOptions}; ``` - *Type:* {[ key: string ]: ContainerOptions} Used to host service containers for a job in a workflow. Service containers are useful for creating databases or cache services like Redis. The runner automatically creates a Docker network and manages the life cycle of the service containers. --- ##### `strategy`Optional ```typescript public readonly strategy: JobStrategy; ``` - *Type:* JobStrategy A strategy creates a build matrix for your jobs. You can define different variations to run each job in. --- ##### `timeoutMinutes`Optional ```typescript public readonly timeoutMinutes: number; ``` - *Type:* number - *Default:* 360 The maximum number of minutes to let a job run before GitHub automatically cancels it. --- ### JobDefaults Default settings for all steps in the job. #### Initializer ```typescript import { JobDefaults } from 'cdk-pipelines-github' const jobDefaults: JobDefaults = { ... } ``` #### Properties | **Name** | **Type** | **Description** | | --- | --- | --- | | run | RunSettings | Default run settings. | --- ##### `run`Optional ```typescript public readonly run: RunSettings; ``` - *Type:* RunSettings Default run settings. --- ### JobMatrix A job matrix. #### Initializer ```typescript import { JobMatrix } from 'cdk-pipelines-github' const jobMatrix: JobMatrix = { ... } ``` #### Properties | **Name** | **Type** | **Description** | | --- | --- | --- | | domain | {[ key: string ]: string[]} | Each option you define in the matrix has a key and value. | | exclude | {[ key: string ]: string}[] | You can remove a specific configurations defined in the build matrix using the exclude option. | | include | {[ key: string ]: string}[] | You can add additional configuration options to a build matrix job that already exists. | --- ##### `domain`Optional ```typescript public readonly domain: {[ key: string ]: string[]}; ``` - *Type:* {[ key: string ]: string[]} Each option you define in the matrix has a key and value. The keys you define become properties in the matrix context and you can reference the property in other areas of your workflow file. For example, if you define the key os that contains an array of operating systems, you can use the matrix.os property as the value of the runs-on keyword to create a job for each operating system. --- ##### `exclude`Optional ```typescript public readonly exclude: {[ key: string ]: string}[]; ``` - *Type:* {[ key: string ]: string}[] You can remove a specific configurations defined in the build matrix using the exclude option. Using exclude removes a job defined by the build matrix. --- ##### `include`Optional ```typescript public readonly include: {[ key: string ]: string}[]; ``` - *Type:* {[ key: string ]: string}[] You can add additional configuration options to a build matrix job that already exists. For example, if you want to use a specific version of npm when the job that uses windows-latest and version 8 of node runs, you can use include to specify that additional option. --- ### JobPermissions The available scopes and access values for workflow permissions. If you specify the access for any of these scopes, all those that are not specified are set to `JobPermission.NONE`, instead of the default behavior when none is specified. #### Initializer ```typescript import { JobPermissions } from 'cdk-pipelines-github' const jobPermissions: JobPermissions = { ... } ``` #### Properties | **Name** | **Type** | **Description** | | --- | --- | --- | | actions | JobPermission | *No description.* | | checks | JobPermission | *No description.* | | contents | JobPermission | *No description.* | | deployments | JobPermission | *No description.* | | discussions | JobPermission | *No description.* | | idToken | JobPermission | *No description.* | | issues | JobPermission | *No description.* | | packages | JobPermission | *No description.* | | pullRequests | JobPermission | *No description.* | | repositoryProjects | JobPermission | *No description.* | | securityEvents | JobPermission | *No description.* | | statuses | JobPermission | *No description.* | --- ##### `actions`Optional ```typescript public readonly actions: JobPermission; ``` - *Type:* JobPermission --- ##### `checks`Optional ```typescript public readonly checks: JobPermission; ``` - *Type:* JobPermission --- ##### `contents`Optional ```typescript public readonly contents: JobPermission; ``` - *Type:* JobPermission --- ##### `deployments`Optional ```typescript public readonly deployments: JobPermission; ``` - *Type:* JobPermission --- ##### `discussions`Optional ```typescript public readonly discussions: JobPermission; ``` - *Type:* JobPermission --- ##### `idToken`Optional ```typescript public readonly idToken: JobPermission; ``` - *Type:* JobPermission --- ##### `issues`Optional ```typescript public readonly issues: JobPermission; ``` - *Type:* JobPermission --- ##### `packages`Optional ```typescript public readonly packages: JobPermission; ``` - *Type:* JobPermission --- ##### `pullRequests`Optional ```typescript public readonly pullRequests: JobPermission; ``` - *Type:* JobPermission --- ##### `repositoryProjects`Optional ```typescript public readonly repositoryProjects: JobPermission; ``` - *Type:* JobPermission --- ##### `securityEvents`Optional ```typescript public readonly securityEvents: JobPermission; ``` - *Type:* JobPermission --- ##### `statuses`Optional ```typescript public readonly statuses: JobPermission; ``` - *Type:* JobPermission --- ### JobSettings Job level settings applied to all jobs in the workflow. #### Initializer ```typescript import { JobSettings } from 'cdk-pipelines-github' const jobSettings: JobSettings = { ... } ``` #### Properties | **Name** | **Type** | **Description** | | --- | --- | --- | | if | string | jobs..if. | --- ##### `if`Optional ```typescript public readonly if: string; ``` - *Type:* string jobs..if. > [https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idif](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idif) --- ### JobStep A job step. #### Initializer ```typescript import { JobStep } from 'cdk-pipelines-github' const jobStep: JobStep = { ... } ``` #### Properties | **Name** | **Type** | **Description** | | --- | --- | --- | | continueOnError | boolean | Prevents a job from failing when a step fails. | | env | {[ key: string ]: string} | Sets environment variables for steps to use in the runner environment. | | id | string | A unique identifier for the step. | | if | string | You can use the if conditional to prevent a job from running unless a condition is met. | | name | string | A name for your step to display on GitHub. | | run | string | Runs command-line programs using the operating system's shell. | | timeoutMinutes | number | The maximum number of minutes to run the step before killing the process. | | uses | string | Selects an action to run as part of a step in your job. | | with | {[ key: string ]: any} | A map of the input parameters defined by the action. | --- ##### `continueOnError`Optional ```typescript public readonly continueOnError: boolean; ``` - *Type:* boolean Prevents a job from failing when a step fails. Set to true to allow a job to pass when this step fails. --- ##### `env`Optional ```typescript public readonly env: {[ key: string ]: string}; ``` - *Type:* {[ key: string ]: string} Sets environment variables for steps to use in the runner environment. You can also set environment variables for the entire workflow or a job. --- ##### `id`Optional ```typescript public readonly id: string; ``` - *Type:* string A unique identifier for the step. You can use the id to reference the step in contexts. --- ##### `if`Optional ```typescript public readonly if: string; ``` - *Type:* string You can use the if conditional to prevent a job from running unless a condition is met. You can use any supported context and expression to create a conditional. --- ##### `name`Optional ```typescript public readonly name: string; ``` - *Type:* string A name for your step to display on GitHub. --- ##### `run`Optional ```typescript public readonly run: string; ``` - *Type:* string Runs command-line programs using the operating system's shell. If you do not provide a name, the step name will default to the text specified in the run command. --- ##### `timeoutMinutes`Optional ```typescript public readonly timeoutMinutes: number; ``` - *Type:* number The maximum number of minutes to run the step before killing the process. --- ##### `uses`Optional ```typescript public readonly uses: string; ``` - *Type:* string Selects an action to run as part of a step in your job. An action is a reusable unit of code. You can use an action defined in the same repository as the workflow, a public repository, or in a published Docker container image. --- ##### `with`Optional ```typescript public readonly with: {[ key: string ]: any}; ``` - *Type:* {[ key: string ]: any} A map of the input parameters defined by the action. Each input parameter is a key/value pair. Input parameters are set as environment variables. The variable is prefixed with INPUT_ and converted to upper case. --- ### JobStepOutput An output binding for a job. #### Initializer ```typescript import { JobStepOutput } from 'cdk-pipelines-github' const jobStepOutput: JobStepOutput = { ... } ``` #### Properties | **Name** | **Type** | **Description** | | --- | --- | --- | | outputName | string | The name of the job output that is being bound. | | stepId | string | The ID of the step that exposes the output. | --- ##### `outputName`Required ```typescript public readonly outputName: string; ``` - *Type:* string The name of the job output that is being bound. --- ##### `stepId`Required ```typescript public readonly stepId: string; ``` - *Type:* string The ID of the step that exposes the output. --- ### JobStrategy A strategy creates a build matrix for your jobs. You can define different variations to run each job in. #### Initializer ```typescript import { JobStrategy } from 'cdk-pipelines-github' const jobStrategy: JobStrategy = { ... } ``` #### Properties | **Name** | **Type** | **Description** | | --- | --- | --- | | failFast | boolean | When set to true, GitHub cancels all in-progress jobs if any matrix job fails. | | matrix | JobMatrix | You can define a matrix of different job configurations. | | maxParallel | number | The maximum number of jobs that can run simultaneously when using a matrix job strategy. | --- ##### `failFast`Optional ```typescript public readonly failFast: boolean; ``` - *Type:* boolean When set to true, GitHub cancels all in-progress jobs if any matrix job fails. Default: true --- ##### `matrix`Optional ```typescript public readonly matrix: JobMatrix; ``` - *Type:* JobMatrix You can define a matrix of different job configurations. A matrix allows you to create multiple jobs by performing variable substitution in a single job definition. For example, you can use a matrix to create jobs for more than one supported version of a programming language, operating system, or tool. A matrix reuses the job's configuration and creates a job for each matrix you configure. A job matrix can generate a maximum of 256 jobs per workflow run. This limit also applies to self-hosted runners. --- ##### `maxParallel`Optional ```typescript public readonly maxParallel: number; ``` - *Type:* number The maximum number of jobs that can run simultaneously when using a matrix job strategy. By default, GitHub will maximize the number of jobs run in parallel depending on the available runners on GitHub-hosted virtual machines. --- ### LabelOptions label options. #### Initializer ```typescript import { LabelOptions } from 'cdk-pipelines-github' const labelOptions: LabelOptions = { ... } ``` #### Properties | **Name** | **Type** | **Description** | | --- | --- | --- | | types | string[] | Which activity types to trigger on. | --- ##### `types`Optional ```typescript public readonly types: string[]; ``` - *Type:* string[] Which activity types to trigger on. --- ### MilestoneOptions Milestone options. #### Initializer ```typescript import { MilestoneOptions } from 'cdk-pipelines-github' const milestoneOptions: MilestoneOptions = { ... } ``` #### Properties | **Name** | **Type** | **Description** | | --- | --- | --- | | types | string[] | Which activity types to trigger on. | --- ##### `types`Optional ```typescript public readonly types: string[]; ``` - *Type:* string[] Which activity types to trigger on. --- ### OpenIdConnectProviderProps Role to assume using OpenId Connect. #### Initializer ```typescript import { OpenIdConnectProviderProps } from 'cdk-pipelines-github' const openIdConnectProviderProps: OpenIdConnectProviderProps = { ... } ``` #### Properties | **Name** | **Type** | **Description** | | --- | --- | --- | | gitHubActionRoleArn | string | A role that utilizes the GitHub OIDC Identity Provider in your AWS account. | | roleSessionName | string | The role session name to use when assuming the role. | --- ##### `gitHubActionRoleArn`Required ```typescript public readonly gitHubActionRoleArn: string; ``` - *Type:* string A role that utilizes the GitHub OIDC Identity Provider in your AWS account. You can create your own role in the console with the necessary trust policy to allow gitHub actions from your gitHub repository to assume the role, or you can utilize the `GitHubActionRole` construct to create a role for you. --- ##### `roleSessionName`Optional ```typescript public readonly roleSessionName: string; ``` - *Type:* string - *Default:* no role session name The role session name to use when assuming the role. --- ### PageBuildOptions The Page build event accepts no options. #### Initializer ```typescript import { PageBuildOptions } from 'cdk-pipelines-github' const pageBuildOptions: PageBuildOptions = { ... } ``` ### ProjectCardOptions Project card options. #### Initializer ```typescript import { ProjectCardOptions } from 'cdk-pipelines-github' const projectCardOptions: ProjectCardOptions = { ... } ``` #### Properties | **Name** | **Type** | **Description** | | --- | --- | --- | | types | string[] | Which activity types to trigger on. | --- ##### `types`Optional ```typescript public readonly types: string[]; ``` - *Type:* string[] Which activity types to trigger on. --- ### ProjectColumnOptions Probject column options. #### Initializer ```typescript import { ProjectColumnOptions } from 'cdk-pipelines-github' const projectColumnOptions: ProjectColumnOptions = { ... } ``` #### Properties | **Name** | **Type** | **Description** | | --- | --- | --- | | types | string[] | Which activity types to trigger on. | --- ##### `types`Optional ```typescript public readonly types: string[]; ``` - *Type:* string[] Which activity types to trigger on. --- ### ProjectOptions Project options. #### Initializer ```typescript import { ProjectOptions } from 'cdk-pipelines-github' const projectOptions: ProjectOptions = { ... } ``` #### Properties | **Name** | **Type** | **Description** | | --- | --- | --- | | types | string[] | Which activity types to trigger on. | --- ##### `types`Optional ```typescript public readonly types: string[]; ``` - *Type:* string[] Which activity types to trigger on. --- ### PublicOptions The Public event accepts no options. #### Initializer ```typescript import { PublicOptions } from 'cdk-pipelines-github' const publicOptions: PublicOptions = { ... } ``` ### PullRequestOptions Pull request options. #### Initializer ```typescript import { PullRequestOptions } from 'cdk-pipelines-github' const pullRequestOptions: PullRequestOptions = { ... } ``` #### Properties | **Name** | **Type** | **Description** | | --- | --- | --- | | types | string[] | Which activity types to trigger on. | --- ##### `types`Optional ```typescript public readonly types: string[]; ``` - *Type:* string[] Which activity types to trigger on. --- ### PullRequestReviewCommentOptions Pull request review comment options. #### Initializer ```typescript import { PullRequestReviewCommentOptions } from 'cdk-pipelines-github' const pullRequestReviewCommentOptions: PullRequestReviewCommentOptions = { ... } ``` #### Properties | **Name** | **Type** | **Description** | | --- | --- | --- | | types | string[] | Which activity types to trigger on. | --- ##### `types`Optional ```typescript public readonly types: string[]; ``` - *Type:* string[] Which activity types to trigger on. --- ### PullRequestReviewOptions Pull request review options. #### Initializer ```typescript import { PullRequestReviewOptions } from 'cdk-pipelines-github' const pullRequestReviewOptions: PullRequestReviewOptions = { ... } ``` #### Properties | **Name** | **Type** | **Description** | | --- | --- | --- | | types | string[] | Which activity types to trigger on. | --- ##### `types`Optional ```typescript public readonly types: string[]; ``` - *Type:* string[] Which activity types to trigger on. --- ### PullRequestTargetOptions Pull request target options. #### Initializer ```typescript import { PullRequestTargetOptions } from 'cdk-pipelines-github' const pullRequestTargetOptions: PullRequestTargetOptions = { ... } ``` #### Properties | **Name** | **Type** | **Description** | | --- | --- | --- | | branches | string[] | When using the push and pull_request events, you can configure a workflow to run on specific branches or tags. | | paths | string[] | When using the push and pull_request events, you can configure a workflow to run when at least one file does not match paths-ignore or at least one modified file matches the configured paths. | | tags | string[] | When using the push and pull_request events, you can configure a workflow to run on specific branches or tags. | | types | string[] | Which activity types to trigger on. | --- ##### `branches`Optional ```typescript public readonly branches: string[]; ``` - *Type:* string[] When using the push and pull_request events, you can configure a workflow to run on specific branches or tags. For a pull_request event, only branches and tags on the base are evaluated. If you define only tags or only branches, the workflow won't run for events affecting the undefined Git ref. > [https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#filter-pattern-cheat-sheet](https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#filter-pattern-cheat-sheet) --- ##### `paths`Optional ```typescript public readonly paths: string[]; ``` - *Type:* string[] When using the push and pull_request events, you can configure a workflow to run when at least one file does not match paths-ignore or at least one modified file matches the configured paths. Path filters are not evaluated for pushes to tags. > [https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#filter-pattern-cheat-sheet](https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#filter-pattern-cheat-sheet) --- ##### `tags`Optional ```typescript public readonly tags: string[]; ``` - *Type:* string[] When using the push and pull_request events, you can configure a workflow to run on specific branches or tags. For a pull_request event, only branches and tags on the base are evaluated. If you define only tags or only branches, the workflow won't run for events affecting the undefined Git ref. > [https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#filter-pattern-cheat-sheet](https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#filter-pattern-cheat-sheet) --- ##### `types`Optional ```typescript public readonly types: string[]; ``` - *Type:* string[] Which activity types to trigger on. --- ### PushOptions Options for push-like events. #### Initializer ```typescript import { PushOptions } from 'cdk-pipelines-github' const pushOptions: PushOptions = { ... } ``` #### Properties | **Name** | **Type** | **Description** | | --- | --- | --- | | branches | string[] | When using the push and pull_request events, you can configure a workflow to run on specific branches or tags. | | paths | string[] | When using the push and pull_request events, you can configure a workflow to run when at least one file does not match paths-ignore or at least one modified file matches the configured paths. | | tags | string[] | When using the push and pull_request events, you can configure a workflow to run on specific branches or tags. | --- ##### `branches`Optional ```typescript public readonly branches: string[]; ``` - *Type:* string[] When using the push and pull_request events, you can configure a workflow to run on specific branches or tags. For a pull_request event, only branches and tags on the base are evaluated. If you define only tags or only branches, the workflow won't run for events affecting the undefined Git ref. > [https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#filter-pattern-cheat-sheet](https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#filter-pattern-cheat-sheet) --- ##### `paths`Optional ```typescript public readonly paths: string[]; ``` - *Type:* string[] When using the push and pull_request events, you can configure a workflow to run when at least one file does not match paths-ignore or at least one modified file matches the configured paths. Path filters are not evaluated for pushes to tags. > [https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#filter-pattern-cheat-sheet](https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#filter-pattern-cheat-sheet) --- ##### `tags`Optional ```typescript public readonly tags: string[]; ``` - *Type:* string[] When using the push and pull_request events, you can configure a workflow to run on specific branches or tags. For a pull_request event, only branches and tags on the base are evaluated. If you define only tags or only branches, the workflow won't run for events affecting the undefined Git ref. > [https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#filter-pattern-cheat-sheet](https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#filter-pattern-cheat-sheet) --- ### RegistryPackageOptions Registry package options. #### Initializer ```typescript import { RegistryPackageOptions } from 'cdk-pipelines-github' const registryPackageOptions: RegistryPackageOptions = { ... } ``` #### Properties | **Name** | **Type** | **Description** | | --- | --- | --- | | types | string[] | Which activity types to trigger on. | --- ##### `types`Optional ```typescript public readonly types: string[]; ``` - *Type:* string[] Which activity types to trigger on. --- ### ReleaseOptions Release options. #### Initializer ```typescript import { ReleaseOptions } from 'cdk-pipelines-github' const releaseOptions: ReleaseOptions = { ... } ``` #### Properties | **Name** | **Type** | **Description** | | --- | --- | --- | | types | string[] | Which activity types to trigger on. | --- ##### `types`Optional ```typescript public readonly types: string[]; ``` - *Type:* string[] Which activity types to trigger on. --- ### RepositoryDispatchOptions Repository dispatch options. #### Initializer ```typescript import { RepositoryDispatchOptions } from 'cdk-pipelines-github' const repositoryDispatchOptions: RepositoryDispatchOptions = { ... } ``` #### Properties | **Name** | **Type** | **Description** | | --- | --- | --- | | types | string[] | Which activity types to trigger on. | --- ##### `types`Optional ```typescript public readonly types: string[]; ``` - *Type:* string[] Which activity types to trigger on. --- ### RunSettings Run settings for a job. #### Initializer ```typescript import { RunSettings } from 'cdk-pipelines-github' const runSettings: RunSettings = { ... } ``` #### Properties | **Name** | **Type** | **Description** | | --- | --- | --- | | shell | string | Which shell to use for running the step. | | workingDirectory | string | Working directory to use when running the step. | --- ##### `shell`Optional ```typescript public readonly shell: string; ``` - *Type:* string Which shell to use for running the step. --- *Example* ```typescript "bash" ``` ##### `workingDirectory`Optional ```typescript public readonly workingDirectory: string; ``` - *Type:* string Working directory to use when running the step. --- ### StatusOptions The Status event accepts no options. #### Initializer ```typescript import { StatusOptions } from 'cdk-pipelines-github' const statusOptions: StatusOptions = { ... } ``` ### WatchOptions Watch options. #### Initializer ```typescript import { WatchOptions } from 'cdk-pipelines-github' const watchOptions: WatchOptions = { ... } ``` #### Properties | **Name** | **Type** | **Description** | | --- | --- | --- | | types | string[] | Which activity types to trigger on. | --- ##### `types`Optional ```typescript public readonly types: string[]; ``` - *Type:* string[] Which activity types to trigger on. --- ### WorkflowDispatchOptions The Workflow dispatch event accepts no options. #### Initializer ```typescript import { WorkflowDispatchOptions } from 'cdk-pipelines-github' const workflowDispatchOptions: WorkflowDispatchOptions = { ... } ``` ### WorkflowRunOptions Workflow run options. #### Initializer ```typescript import { WorkflowRunOptions } from 'cdk-pipelines-github' const workflowRunOptions: WorkflowRunOptions = { ... } ``` #### Properties | **Name** | **Type** | **Description** | | --- | --- | --- | | types | string[] | Which activity types to trigger on. | --- ##### `types`Optional ```typescript public readonly types: string[]; ``` - *Type:* string[] Which activity types to trigger on. --- ### WorkflowTriggers The set of available triggers for GitHub Workflows. > [https://docs.github.com/en/actions/reference/events-that-trigger-workflows](https://docs.github.com/en/actions/reference/events-that-trigger-workflows) #### Initializer ```typescript import { WorkflowTriggers } from 'cdk-pipelines-github' const workflowTriggers: WorkflowTriggers = { ... } ``` #### Properties | **Name** | **Type** | **Description** | | --- | --- | --- | | checkRun | CheckRunOptions | Runs your workflow anytime the check_run event occurs. | | checkSuite | CheckSuiteOptions | Runs your workflow anytime the check_suite event occurs. | | create | CreateOptions | Runs your workflow anytime someone creates a branch or tag, which triggers the create event. | | delete | DeleteOptions | Runs your workflow anytime someone deletes a branch or tag, which triggers the delete event. | | deployment | DeploymentOptions | Runs your workflow anytime someone creates a deployment, which triggers the deployment event. | | deploymentStatus | DeploymentStatusOptions | Runs your workflow anytime a third party provides a deployment status, which triggers the deployment_status event. | | fork | ForkOptions | Runs your workflow anytime when someone forks a repository, which triggers the fork event. | | gollum | GollumOptions | Runs your workflow when someone creates or updates a Wiki page, which triggers the gollum event. | | issueComment | IssueCommentOptions | Runs your workflow anytime the issue_comment event occurs. | | issues | IssuesOptions | Runs your workflow anytime the issues event occurs. | | label | LabelOptions | Runs your workflow anytime the label event occurs. | | milestone | MilestoneOptions | Runs your workflow anytime the milestone event occurs. | | pageBuild | PageBuildOptions | Runs your workflow anytime someone pushes to a GitHub Pages-enabled branch, which triggers the page_build event. | | project | ProjectOptions | Runs your workflow anytime the project event occurs. | | projectCard | ProjectCardOptions | Runs your workflow anytime the project_card event occurs. | | projectColumn | ProjectColumnOptions | Runs your workflow anytime the project_column event occurs. | | public | PublicOptions | Runs your workflow anytime someone makes a private repository public, which triggers the public event. | | pullRequest | PullRequestOptions | Runs your workflow anytime the pull_request event occurs. | | pullRequestReview | PullRequestReviewOptions | Runs your workflow anytime the pull_request_review event occurs. | | pullRequestReviewComment | PullRequestReviewCommentOptions | Runs your workflow anytime a comment on a pull request's unified diff is modified, which triggers the pull_request_review_comment event. | | pullRequestTarget | PullRequestTargetOptions | This event runs in the context of the base of the pull request, rather than in the merge commit as the pull_request event does. | | push | PushOptions | Runs your workflow when someone pushes to a repository branch, which triggers the push event. | | registryPackage | RegistryPackageOptions | Runs your workflow anytime a package is published or updated. | | release | ReleaseOptions | Runs your workflow anytime the release event occurs. | | repositoryDispatch | RepositoryDispatchOptions | You can use the GitHub API to trigger a webhook event called repository_dispatch when you want to trigger a workflow for activity that happens outside of GitHub. | | schedule | CronScheduleOptions[] | You can schedule a workflow to run at specific UTC times using POSIX cron syntax. | | status | StatusOptions | Runs your workflow anytime the status of a Git commit changes, which triggers the status event. | | watch | WatchOptions | Runs your workflow anytime the watch event occurs. | | workflowDispatch | WorkflowDispatchOptions | You can configure custom-defined input properties, default input values, and required inputs for the event directly in your workflow. | | workflowRun | WorkflowRunOptions | This event occurs when a workflow run is requested or completed, and allows you to execute a workflow based on the finished result of another workflow. | --- ##### `checkRun`Optional ```typescript public readonly checkRun: CheckRunOptions; ``` - *Type:* CheckRunOptions Runs your workflow anytime the check_run event occurs. --- ##### `checkSuite`Optional ```typescript public readonly checkSuite: CheckSuiteOptions; ``` - *Type:* CheckSuiteOptions Runs your workflow anytime the check_suite event occurs. --- ##### `create`Optional ```typescript public readonly create: CreateOptions; ``` - *Type:* CreateOptions Runs your workflow anytime someone creates a branch or tag, which triggers the create event. --- ##### `delete`Optional ```typescript public readonly delete: DeleteOptions; ``` - *Type:* DeleteOptions Runs your workflow anytime someone deletes a branch or tag, which triggers the delete event. --- ##### `deployment`Optional ```typescript public readonly deployment: DeploymentOptions; ``` - *Type:* DeploymentOptions Runs your workflow anytime someone creates a deployment, which triggers the deployment event. Deployments created with a commit SHA may not have a Git ref. --- ##### `deploymentStatus`Optional ```typescript public readonly deploymentStatus: DeploymentStatusOptions; ``` - *Type:* DeploymentStatusOptions Runs your workflow anytime a third party provides a deployment status, which triggers the deployment_status event. Deployments created with a commit SHA may not have a Git ref. --- ##### `fork`Optional ```typescript public readonly fork: ForkOptions; ``` - *Type:* ForkOptions Runs your workflow anytime when someone forks a repository, which triggers the fork event. --- ##### `gollum`Optional ```typescript public readonly gollum: GollumOptions; ``` - *Type:* GollumOptions Runs your workflow when someone creates or updates a Wiki page, which triggers the gollum event. --- ##### `issueComment`Optional ```typescript public readonly issueComment: IssueCommentOptions; ``` - *Type:* IssueCommentOptions Runs your workflow anytime the issue_comment event occurs. --- ##### `issues`Optional ```typescript public readonly issues: IssuesOptions; ``` - *Type:* IssuesOptions Runs your workflow anytime the issues event occurs. --- ##### `label`Optional ```typescript public readonly label: LabelOptions; ``` - *Type:* LabelOptions Runs your workflow anytime the label event occurs. --- ##### `milestone`Optional ```typescript public readonly milestone: MilestoneOptions; ``` - *Type:* MilestoneOptions Runs your workflow anytime the milestone event occurs. --- ##### `pageBuild`Optional ```typescript public readonly pageBuild: PageBuildOptions; ``` - *Type:* PageBuildOptions Runs your workflow anytime someone pushes to a GitHub Pages-enabled branch, which triggers the page_build event. --- ##### `project`Optional ```typescript public readonly project: ProjectOptions; ``` - *Type:* ProjectOptions Runs your workflow anytime the project event occurs. --- ##### `projectCard`Optional ```typescript public readonly projectCard: ProjectCardOptions; ``` - *Type:* ProjectCardOptions Runs your workflow anytime the project_card event occurs. --- ##### `projectColumn`Optional ```typescript public readonly projectColumn: ProjectColumnOptions; ``` - *Type:* ProjectColumnOptions Runs your workflow anytime the project_column event occurs. --- ##### `public`Optional ```typescript public readonly public: PublicOptions; ``` - *Type:* PublicOptions Runs your workflow anytime someone makes a private repository public, which triggers the public event. --- ##### `pullRequest`Optional ```typescript public readonly pullRequest: PullRequestOptions; ``` - *Type:* PullRequestOptions Runs your workflow anytime the pull_request event occurs. --- ##### `pullRequestReview`Optional ```typescript public readonly pullRequestReview: PullRequestReviewOptions; ``` - *Type:* PullRequestReviewOptions Runs your workflow anytime the pull_request_review event occurs. --- ##### `pullRequestReviewComment`Optional ```typescript public readonly pullRequestReviewComment: PullRequestReviewCommentOptions; ``` - *Type:* PullRequestReviewCommentOptions Runs your workflow anytime a comment on a pull request's unified diff is modified, which triggers the pull_request_review_comment event. --- ##### `pullRequestTarget`Optional ```typescript public readonly pullRequestTarget: PullRequestTargetOptions; ``` - *Type:* PullRequestTargetOptions This event runs in the context of the base of the pull request, rather than in the merge commit as the pull_request event does. This prevents executing unsafe workflow code from the head of the pull request that could alter your repository or steal any secrets you use in your workflow. This event allows you to do things like create workflows that label and comment on pull requests based on the contents of the event payload. WARNING: The `pull_request_target` event is granted read/write repository token and can access secrets, even when it is triggered from a fork. Although the workflow runs in the context of the base of the pull request, you should make sure that you do not check out, build, or run untrusted code from the pull request with this event. Additionally, any caches share the same scope as the base branch, and to help prevent cache poisoning, you should not save the cache if there is a possibility that the cache contents were altered. > [https://securitylab.github.com/research/github-actions-preventing-pwn-requests](https://securitylab.github.com/research/github-actions-preventing-pwn-requests) --- ##### `push`Optional ```typescript public readonly push: PushOptions; ``` - *Type:* PushOptions Runs your workflow when someone pushes to a repository branch, which triggers the push event. --- ##### `registryPackage`Optional ```typescript public readonly registryPackage: RegistryPackageOptions; ``` - *Type:* RegistryPackageOptions Runs your workflow anytime a package is published or updated. --- ##### `release`Optional ```typescript public readonly release: ReleaseOptions; ``` - *Type:* ReleaseOptions Runs your workflow anytime the release event occurs. --- ##### `repositoryDispatch`Optional ```typescript public readonly repositoryDispatch: RepositoryDispatchOptions; ``` - *Type:* RepositoryDispatchOptions You can use the GitHub API to trigger a webhook event called repository_dispatch when you want to trigger a workflow for activity that happens outside of GitHub. --- ##### `schedule`Optional ```typescript public readonly schedule: CronScheduleOptions[]; ``` - *Type:* CronScheduleOptions[] You can schedule a workflow to run at specific UTC times using POSIX cron syntax. Scheduled workflows run on the latest commit on the default or base branch. The shortest interval you can run scheduled workflows is once every 5 minutes. > [https://pubs.opengroup.org/onlinepubs/9699919799/utilities/crontab.html#tag_20_25_07](https://pubs.opengroup.org/onlinepubs/9699919799/utilities/crontab.html#tag_20_25_07) --- ##### `status`Optional ```typescript public readonly status: StatusOptions; ``` - *Type:* StatusOptions Runs your workflow anytime the status of a Git commit changes, which triggers the status event. --- ##### `watch`Optional ```typescript public readonly watch: WatchOptions; ``` - *Type:* WatchOptions Runs your workflow anytime the watch event occurs. --- ##### `workflowDispatch`Optional ```typescript public readonly workflowDispatch: WorkflowDispatchOptions; ``` - *Type:* WorkflowDispatchOptions You can configure custom-defined input properties, default input values, and required inputs for the event directly in your workflow. When the workflow runs, you can access the input values in the github.event.inputs context. --- ##### `workflowRun`Optional ```typescript public readonly workflowRun: WorkflowRunOptions; ``` - *Type:* WorkflowRunOptions This event occurs when a workflow run is requested or completed, and allows you to execute a workflow based on the finished result of another workflow. A workflow run is triggered regardless of the result of the previous workflow. --- ### YamlFileOptions Options for `YamlFile`. #### Initializer ```typescript import { YamlFileOptions } from 'cdk-pipelines-github' const yamlFileOptions: YamlFileOptions = { ... } ``` #### Properties | **Name** | **Type** | **Description** | | --- | --- | --- | | obj | any | The object that will be serialized. | --- ##### `obj`Optional ```typescript public readonly obj: any; ``` - *Type:* any - *Default:* {} an empty object The object that will be serialized. You can modify the object's contents before synthesis. --- ## Classes ### AwsCredentials Provides AWS credenitals to the pipeline jobs. #### Initializers ```typescript import { AwsCredentials } from 'cdk-pipelines-github' new AwsCredentials() ``` | **Name** | **Type** | **Description** | | --- | --- | --- | --- #### Static Functions | **Name** | **Description** | | --- | --- | | fromGitHubSecrets | Reference credential secrets to authenticate with AWS. | | fromOpenIdConnect | Provide AWS credentials using OpenID Connect. | | runnerHasPreconfiguredCreds | Don't provide any AWS credentials, use this if runners have preconfigured credentials. | --- ##### `fromGitHubSecrets` ```typescript import { AwsCredentials } from 'cdk-pipelines-github' AwsCredentials.fromGitHubSecrets(props?: GitHubSecretsProviderProps) ``` Reference credential secrets to authenticate with AWS. This method assumes that your credentials will be stored as long-lived GitHub Secrets. ###### `props`Optional - *Type:* GitHubSecretsProviderProps --- ##### `fromOpenIdConnect` ```typescript import { AwsCredentials } from 'cdk-pipelines-github' AwsCredentials.fromOpenIdConnect(props: OpenIdConnectProviderProps) ``` Provide AWS credentials using OpenID Connect. ###### `props`Required - *Type:* OpenIdConnectProviderProps --- ##### `runnerHasPreconfiguredCreds` ```typescript import { AwsCredentials } from 'cdk-pipelines-github' AwsCredentials.runnerHasPreconfiguredCreds() ``` Don't provide any AWS credentials, use this if runners have preconfigured credentials. ### AwsCredentialsProvider AWS credential provider. #### Initializers ```typescript import { AwsCredentialsProvider } from 'cdk-pipelines-github' new AwsCredentialsProvider() ``` | **Name** | **Type** | **Description** | | --- | --- | --- | --- #### Methods | **Name** | **Description** | | --- | --- | | credentialSteps | *No description.* | | jobPermission | *No description.* | --- ##### `credentialSteps` ```typescript public credentialSteps(region: string, assumeRoleArn?: string): JobStep[] ``` ###### `region`Required - *Type:* string --- ###### `assumeRoleArn`Optional - *Type:* string --- ##### `jobPermission` ```typescript public jobPermission(): JobPermission ``` ### DockerCredential Represents a credential used to authenticate to a docker registry. Uses the official Docker Login GitHub Action to authenticate. > [https://github.com/marketplace/actions/docker-login](https://github.com/marketplace/actions/docker-login) #### Static Functions | **Name** | **Description** | | --- | --- | | customRegistry | Create a credential for a custom registry. | | dockerHub | Reference credential secrets to authenticate to DockerHub. | | ecr | Create a credential for ECR. | --- ##### `customRegistry` ```typescript import { DockerCredential } from 'cdk-pipelines-github' DockerCredential.customRegistry(registry: string, creds: ExternalDockerCredentialSecrets) ``` Create a credential for a custom registry. This method assumes that you will have long-lived GitHub Secrets stored under the usernameKey and passwordKey that will authenticate to the registry you provide. > [https://github.com/marketplace/actions/docker-login](https://github.com/marketplace/actions/docker-login) ###### `registry`Required - *Type:* string --- ###### `creds`Required - *Type:* ExternalDockerCredentialSecrets --- ##### `dockerHub` ```typescript import { DockerCredential } from 'cdk-pipelines-github' DockerCredential.dockerHub(creds?: DockerHubCredentialSecrets) ``` Reference credential secrets to authenticate to DockerHub. This method assumes that your credentials will be stored as long-lived GitHub Secrets under the usernameKey and personalAccessTokenKey. The default for usernameKey is `DOCKERHUB_USERNAME`. The default for personalAccessTokenKey is `DOCKERHUB_TOKEN`. If you do not set these values, your credentials should be found in your GitHub Secrets under these default keys. ###### `creds`Optional - *Type:* DockerHubCredentialSecrets --- ##### `ecr` ```typescript import { DockerCredential } from 'cdk-pipelines-github' DockerCredential.ecr(registry: string) ``` Create a credential for ECR. This method will reuse your AWS credentials to log in to AWS. Your AWS credentials are already used to deploy your CDK stacks. It can be supplied via GitHub Secrets or using an IAM role that trusts the GitHub OIDC identity provider. NOTE - All ECR repositories in the same account and region share a domain name (e.g., 0123456789012.dkr.ecr.eu-west-1.amazonaws.com), and can only have one associated set of credentials (and DockerCredential). Attempting to associate one set of credentials with one ECR repo and another with another ECR repo in the same account and region will result in failures when using these credentials in the pipeline. ###### `registry`Required - *Type:* string --- #### Properties | **Name** | **Type** | **Description** | | --- | --- | --- | | name | string | *No description.* | | passwordKey | string | *No description.* | | registry | string | *No description.* | | usernameKey | string | *No description.* | --- ##### `name`Required ```typescript public readonly name: string; ``` - *Type:* string --- ##### `passwordKey`Optional ```typescript public readonly passwordKey: string; ``` - *Type:* string --- ##### `registry`Optional ```typescript public readonly registry: string; ``` - *Type:* string --- ##### `usernameKey`Optional ```typescript public readonly usernameKey: string; ``` - *Type:* string --- ### GitHubActionStep Specifies a GitHub Action as a step in the pipeline. #### Initializers ```typescript import { GitHubActionStep } from 'cdk-pipelines-github' new GitHubActionStep(id: string, props: GitHubActionStepProps) ``` | **Name** | **Type** | **Description** | | --- | --- | --- | | id | string | *No description.* | | props | GitHubActionStepProps | *No description.* | --- ##### `id`Required - *Type:* string --- ##### `props`Required - *Type:* GitHubActionStepProps --- #### Methods | **Name** | **Description** | | --- | --- | | addStepDependency | Add a dependency on another step. | | toString | Return a string representation of this Step. | --- ##### `addStepDependency` ```typescript public addStepDependency(step: Step): void ``` Add a dependency on another step. ###### `step`Required - *Type:* aws-cdk-lib.pipelines.Step --- ##### `toString` ```typescript public toString(): string ``` Return a string representation of this Step. #### Static Functions | **Name** | **Description** | | --- | --- | | sequence | Define a sequence of steps to be executed in order. | --- ##### `sequence` ```typescript import { GitHubActionStep } from 'cdk-pipelines-github' GitHubActionStep.sequence(steps: Step[]) ``` Define a sequence of steps to be executed in order. ###### `steps`Required - *Type:* aws-cdk-lib.pipelines.Step[] --- #### Properties | **Name** | **Type** | **Description** | | --- | --- | --- | | dependencies | aws-cdk-lib.pipelines.Step[] | Return the steps this step depends on, based on the FileSets it requires. | | dependencyFileSets | aws-cdk-lib.pipelines.FileSet[] | The list of FileSets consumed by this Step. | | id | string | Identifier for this step. | | isSource | boolean | Whether or not this is a Source step. | | primaryOutput | aws-cdk-lib.pipelines.FileSet | The primary FileSet produced by this Step. | | env | {[ key: string ]: string} | *No description.* | | jobSteps | JobStep[] | *No description.* | --- ##### `dependencies`Required ```typescript public readonly dependencies: Step[]; ``` - *Type:* aws-cdk-lib.pipelines.Step[] Return the steps this step depends on, based on the FileSets it requires. --- ##### `dependencyFileSets`Required ```typescript public readonly dependencyFileSets: FileSet[]; ``` - *Type:* aws-cdk-lib.pipelines.FileSet[] The list of FileSets consumed by this Step. --- ##### `id`Required ```typescript public readonly id: string; ``` - *Type:* string Identifier for this step. --- ##### `isSource`Required ```typescript public readonly isSource: boolean; ``` - *Type:* boolean Whether or not this is a Source step. What it means to be a Source step depends on the engine. --- ##### `primaryOutput`Optional ```typescript public readonly primaryOutput: FileSet; ``` - *Type:* aws-cdk-lib.pipelines.FileSet The primary FileSet produced by this Step. Not all steps produce an output FileSet--if they do you can substitute the `Step` object for the `FileSet` object. --- ##### `env`Required ```typescript public readonly env: {[ key: string ]: string}; ``` - *Type:* {[ key: string ]: string} --- ##### `jobSteps`Required ```typescript public readonly jobSteps: JobStep[]; ``` - *Type:* JobStep[] --- ### GitHubWave Multiple stages that are deployed in parallel. A `Wave`, but with addition GitHub options Create with `GitHubWorkflow.addWave()` or `GitHubWorkflow.addGitHubWave()`. You should not have to instantiate a GitHubWave yourself. #### Initializers ```typescript import { GitHubWave } from 'cdk-pipelines-github' new GitHubWave(id: string, pipeline: GitHubWorkflow, props?: WaveProps) ``` | **Name** | **Type** | **Description** | | --- | --- | --- | | id | string | Identifier for this Wave. | | pipeline | GitHubWorkflow | GitHubWorkflow that this wave is part of. | | props | aws-cdk-lib.pipelines.WaveProps | *No description.* | --- ##### `id`Required - *Type:* string Identifier for this Wave. --- ##### `pipeline`Required - *Type:* GitHubWorkflow GitHubWorkflow that this wave is part of. --- ##### `props`Optional - *Type:* aws-cdk-lib.pipelines.WaveProps --- #### Methods | **Name** | **Description** | | --- | --- | | addPost | Add an additional step to run after all of the stages in this wave. | | addPre | Add an additional step to run before any of the stages in this wave. | | addStage | Add a Stage to this wave. | | addStageWithGitHubOptions | Add a Stage to this wave. | --- ##### `addPost` ```typescript public addPost(steps: Step): void ``` Add an additional step to run after all of the stages in this wave. ###### `steps`Required - *Type:* aws-cdk-lib.pipelines.Step --- ##### `addPre` ```typescript public addPre(steps: Step): void ``` Add an additional step to run before any of the stages in this wave. ###### `steps`Required - *Type:* aws-cdk-lib.pipelines.Step --- ##### `addStage` ```typescript public addStage(stage: Stage, options?: AddStageOpts): StageDeployment ``` Add a Stage to this wave. It will be deployed in parallel with all other stages in this wave. ###### `stage`Required - *Type:* aws-cdk-lib.Stage --- ###### `options`Optional - *Type:* aws-cdk-lib.pipelines.AddStageOpts --- ##### `addStageWithGitHubOptions` ```typescript public addStageWithGitHubOptions(stage: Stage, options?: AddGitHubStageOptions): StageDeployment ``` Add a Stage to this wave. It will be deployed in parallel with all other stages in this wave. ###### `stage`Required - *Type:* aws-cdk-lib.Stage --- ###### `options`Optional - *Type:* AddGitHubStageOptions --- #### Properties | **Name** | **Type** | **Description** | | --- | --- | --- | | id | string | Identifier for this Wave. | | post | aws-cdk-lib.pipelines.Step[] | Additional steps that are run after all of the stages in the wave. | | pre | aws-cdk-lib.pipelines.Step[] | Additional steps that are run before any of the stages in the wave. | | stages | aws-cdk-lib.pipelines.StageDeployment[] | The stages that are deployed in this wave. | --- ##### `id`Required ```typescript public readonly id: string; ``` - *Type:* string Identifier for this Wave. --- ##### `post`Required ```typescript public readonly post: Step[]; ``` - *Type:* aws-cdk-lib.pipelines.Step[] Additional steps that are run after all of the stages in the wave. --- ##### `pre`Required ```typescript public readonly pre: Step[]; ``` - *Type:* aws-cdk-lib.pipelines.Step[] Additional steps that are run before any of the stages in the wave. --- ##### `stages`Required ```typescript public readonly stages: StageDeployment[]; ``` - *Type:* aws-cdk-lib.pipelines.StageDeployment[] The stages that are deployed in this wave. --- ### JsonPatch Utility for applying RFC-6902 JSON-Patch to a document. Use the the `JsonPatch.apply(doc, ...ops)` function to apply a set of operations to a JSON document and return the result. Operations can be created using the factory methods `JsonPatch.add()`, `JsonPatch.remove()`, etc. const output = JsonPatch.apply(input, JsonPatch.replace('/world/hi/there', 'goodbye'), JsonPatch.add('/world/foo/', 'boom'), JsonPatch.remove('/hello'), ); #### Static Functions | **Name** | **Description** | | --- | --- | | add | Adds a value to an object or inserts it into an array. | | apply | Applies a set of JSON-Patch (RFC-6902) operations to `document` and returns the result. | | copy | Copies a value from one location to another within the JSON document. | | move | Moves a value from one location to the other. | | remove | Removes a value from an object or array. | | replace | Replaces a value. | | test | Tests that the specified value is set in the document. | --- ##### `add` ```typescript import { JsonPatch } from 'cdk-pipelines-github' JsonPatch.add(path: string, value: any) ``` Adds a value to an object or inserts it into an array. In the case of an array, the value is inserted before the given index. The - character can be used instead of an index to insert at the end of an array. *Example* ```typescript JsonPatch.add('/biscuits/1', { "name": "Ginger Nut" }) ``` ###### `path`Required - *Type:* string --- ###### `value`Required - *Type:* any --- ##### `apply` ```typescript import { JsonPatch } from 'cdk-pipelines-github' JsonPatch.apply(document: any, ops: JsonPatch) ``` Applies a set of JSON-Patch (RFC-6902) operations to `document` and returns the result. ###### `document`Required - *Type:* any The document to patch. --- ###### `ops`Required - *Type:* JsonPatch The operations to apply. --- ##### `copy` ```typescript import { JsonPatch } from 'cdk-pipelines-github' JsonPatch.copy(from: string, path: string) ``` Copies a value from one location to another within the JSON document. Both from and path are JSON Pointers. *Example* ```typescript JsonPatch.copy('/biscuits/0', '/best_biscuit') ``` ###### `from`Required - *Type:* string --- ###### `path`Required - *Type:* string --- ##### `move` ```typescript import { JsonPatch } from 'cdk-pipelines-github' JsonPatch.move(from: string, path: string) ``` Moves a value from one location to the other. Both from and path are JSON Pointers. *Example* ```typescript JsonPatch.move('/biscuits', '/cookies') ``` ###### `from`Required - *Type:* string --- ###### `path`Required - *Type:* string --- ##### `remove` ```typescript import { JsonPatch } from 'cdk-pipelines-github' JsonPatch.remove(path: string) ``` Removes a value from an object or array. *Example* ```typescript JsonPatch.remove('/biscuits/0') ``` ###### `path`Required - *Type:* string --- ##### `replace` ```typescript import { JsonPatch } from 'cdk-pipelines-github' JsonPatch.replace(path: string, value: any) ``` Replaces a value. Equivalent to a “remove” followed by an “add”. *Example* ```typescript JsonPatch.replace('/biscuits/0/name', 'Chocolate Digestive') ``` ###### `path`Required - *Type:* string --- ###### `value`Required - *Type:* any --- ##### `test` ```typescript import { JsonPatch } from 'cdk-pipelines-github' JsonPatch.test(path: string, value: any) ``` Tests that the specified value is set in the document. If the test fails, then the patch as a whole should not apply. *Example* ```typescript JsonPatch.test('/best_biscuit/name', 'Choco Leibniz') ``` ###### `path`Required - *Type:* string --- ###### `value`Required - *Type:* any --- ### Runner The type of runner to run the job on. Can be GitHub or Self-hosted. In case of self-hosted, a list of labels can be supplied. #### Static Functions | **Name** | **Description** | | --- | --- | | selfHosted | Creates a runner instance that sets runsOn to `self-hosted`. | --- ##### `selfHosted` ```typescript import { Runner } from 'cdk-pipelines-github' Runner.selfHosted(labels: string[]) ``` Creates a runner instance that sets runsOn to `self-hosted`. Additional labels can be supplied. There is no need to supply `self-hosted` as a label explicitly. ###### `labels`Required - *Type:* string[] --- #### Properties | **Name** | **Type** | **Description** | | --- | --- | --- | | runsOn | string \| string[] | *No description.* | --- ##### `runsOn`Required ```typescript public readonly runsOn: string | string[]; ``` - *Type:* string | string[] --- #### Constants | **Name** | **Type** | **Description** | | --- | --- | --- | | MACOS_LATEST | Runner | Runner instance that sets runsOn to `macos-latest`. | | UBUNTU_LATEST | Runner | Runner instance that sets runsOn to `ubuntu-latest`. | | WINDOWS_LATEST | Runner | Runner instance that sets runsOn to `windows-latest`. | --- ##### `MACOS_LATEST`Required ```typescript public readonly MACOS_LATEST: Runner; ``` - *Type:* Runner Runner instance that sets runsOn to `macos-latest`. --- ##### `UBUNTU_LATEST`Required ```typescript public readonly UBUNTU_LATEST: Runner; ``` - *Type:* Runner Runner instance that sets runsOn to `ubuntu-latest`. --- ##### `WINDOWS_LATEST`Required ```typescript public readonly WINDOWS_LATEST: Runner; ``` - *Type:* Runner Runner instance that sets runsOn to `windows-latest`. --- ### YamlFile Represents a Yaml File. #### Initializers ```typescript import { YamlFile } from 'cdk-pipelines-github' new YamlFile(filePath: string, options?: YamlFileOptions) ``` | **Name** | **Type** | **Description** | | --- | --- | --- | | filePath | string | *No description.* | | options | YamlFileOptions | *No description.* | --- ##### `filePath`Required - *Type:* string --- ##### `options`Optional - *Type:* YamlFileOptions --- #### Methods | **Name** | **Description** | | --- | --- | | patch | Applies an RFC 6902 JSON-patch to the synthesized object file. See https://datatracker.ietf.org/doc/html/rfc6902 for more information. | | toYaml | Returns the patched yaml file. | | update | Update the output object. | | writeFile | Write the patched yaml file to the specified location. | --- ##### `patch` ```typescript public patch(patches: JsonPatch): void ``` Applies an RFC 6902 JSON-patch to the synthesized object file. See https://datatracker.ietf.org/doc/html/rfc6902 for more information. For example, with the following yaml file ```yaml name: deploy on: push: branches: - main workflow_dispatch: {} ... ``` modified in the following way: ```ts declare const pipeline: GitHubWorkflow; pipeline.workflowFile.patch(JsonPatch.add("/on/workflow_call", "{}")); pipeline.workflowFile.patch(JsonPatch.remove("/on/workflow_dispatch")); ``` would result in the following yaml file: ```yaml name: deploy on: push: branches: - main workflow_call: {} ... ``` ###### `patches`Required - *Type:* JsonPatch The patch operations to apply. --- ##### `toYaml` ```typescript public toYaml(): string ``` Returns the patched yaml file. ##### `update` ```typescript public update(obj: any): void ``` Update the output object. ###### `obj`Required - *Type:* any --- ##### `writeFile` ```typescript public writeFile(): void ``` Write the patched yaml file to the specified location. #### Properties | **Name** | **Type** | **Description** | | --- | --- | --- | | commentAtTop | string | A comment to be added to the top of the YAML file. | --- ##### `commentAtTop`Optional ```typescript public readonly commentAtTop: string; ``` - *Type:* string A comment to be added to the top of the YAML file. Can be multiline. All non-empty line are pefixed with '# '. Empty lines are kept, but not commented. For example: ```ts declare const pipeline: GitHubWorkflow; pipeline.workflowFile.commentAtTop = `AUTOGENERATED FILE, DO NOT EDIT! See ReadMe.md `; ``` Results in YAML: ```yaml # AUTOGENERATED FILE, DO NOT EDIT! # See ReadMe.md name: deploy ... ``` --- ## Enums ### JobPermission Access level for workflow permission scopes. #### Members | **Name** | **Description** | | --- | --- | | READ | Read-only access. | | WRITE | Read-write access. | | NONE | No access at all. | --- ##### `READ` Read-only access. --- ##### `WRITE` Read-write access. --- ##### `NONE` No access at all. --- ### StackCapabilities Acknowledge IAM resources in AWS CloudFormation templates. > [https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-iam-template.html#capabilities](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-iam-template.html#capabilities) #### Members | **Name** | **Description** | | --- | --- | | IAM | Acknowledge your stack includes IAM resources. | | NAMED_IAM | Acknowledge your stack includes custom names for IAM resources. | | AUTO_EXPAND | Acknowledge your stack contains one or more macros. | --- ##### `IAM` Acknowledge your stack includes IAM resources. --- ##### `NAMED_IAM` Acknowledge your stack includes custom names for IAM resources. --- ##### `AUTO_EXPAND` Acknowledge your stack contains one or more macros. ---