Skip to content

GitHub

This constructs create the setup for a connection between GitHub and AWS through leveraging OpenID Connect.

It creates (or uses) an OpenID Connect provider and creates the required roles for a repository to create the required authentication.

Usage Example

import {
    GitHubOpenIdConnectProvider,
    GitHubOpenIdConnect,
} from '@pit-shared/cdk/github'

declare const scope: import('aws-cdk-lib').Stack

const provider = new GitHubOpenIdConnectProvider(
    scope,
    'GitHubOpenIdConnectProvider',
)
new GitHubOpenIdConnect(scope, 'GitHubOpenIdConnect', {
    provider,
    repositoryName: 'your-org/your-repo',
})

GitHubOpenIdConnectProvider

The provider is the base to establish the connection between GitHub and AWS.

It's possible to create this construct with an existing provider to just use it for the rest of the setup process.

API

/**
 * If given, an existing OpenID Connect provider will be looked up from the account.
 */
openIdConnectProviderArn?: string

GitHubOpenIdConnect

This constructs creates a role to establish the permissions for GitHub to create CDK stacks in your AWS account.

It has to be created with an GitHubOpenIdConnectProvider and a repository.

API

/**
 * The OpenID Connect provider for GitHub Actions.
 */
provider: GitHubOpenIdConnectProvider
/**
 * The repository name in the format `owner/repo`.
 */
repositoryName: `${string}/${string}`