Package Exports
- cdk-github
- cdk-github/lib/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (cdk-github) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
CDK-GitHub
GitHub Constructs for use in AWS CDK .
This project aims to make GitHub's API accessible through CDK with various helper constructs to create resources in GitHub.
The target is to replicate most of the functionality of the official Terraform GitHub Provider.
Internally AWS CloudFormation custom resources and octokit are used to manage GitHub resources (such as Secrets).
🔧 Installation
JavaScript/TypeScript:npm install cdk-github
Python:pip install cdk-github
C#
See https://www.nuget.org/packages/CdkGithub
📚 Constructs
This library provides the following constructs:
- ActionSecret - Creates a GitHub Action (repository) secret from a given AWS Secrets Manager secret.
- ActionEnvironmentSecret - Creates a GitHub Action environment secret from a given AWS Secrets Manager secret.
🔓 Authentication
Currently the constructs only support authentication via a GitHub Personal Access Token. The token needs to be a stored in a AWS SecretsManager Secret and passed to the construct as parameter.
👩🏫 Examples
The API documentation and examples in different languages are available on Construct Hub.
All (typescript) examples can be found in the folder examples.
ActionSecret
import { Secret } from 'aws-cdk-lib/aws-secretsmanager';
import { ActionSecret } from 'cdk-github';
export class ActionSecretStack extends Stack {
constructor(scope: Construct, id: string, props?: StackProps) {
super(scope, id, props);
const sourceSecret = Secret.fromSecretNameV2(this, 'secretToStoreInGitHub', 'testcdkgithub');
const githubTokenSecret = Secret.fromSecretNameV2(this, 'ghSecret', 'GITHUB_TOKEN');
new ActionSecret(this, 'GitHubActionSecret', {
githubTokenSecret,
repositoryName: 'cdk-github',
repositoryOwner: 'wtfjoke',
repositorySecretName: 'aRandomGitHubSecret',
sourceSecret,
});
}
}ActionEnvironmentSecret
import { Secret } from 'aws-cdk-lib/aws-secretsmanager';
import { ActionEnvironmentSecret } from 'cdk-github';
export class ActionEnvironmentSecretStack extends Stack {
constructor(scope: Construct, id: string, props?: StackProps) {
super(scope, id, props);
const sourceSecret = Secret.fromSecretNameV2(this, 'secretToStoreInGitHub', 'testcdkgithub');
const githubTokenSecret = Secret.fromSecretNameV2(this, 'ghSecret', 'GITHUB_TOKEN');
new ActionEnvironmentSecret(this, 'GitHubActionEnvironmentSecret', {
githubTokenSecret,
environment: 'dev',
repositoryName: 'cdk-github',
repositoryOwner: 'wtfjoke',
repositorySecretName: 'aRandomGitHubSecret',
sourceSecret,
});
}
}💖 Contributing
Contributions of all kinds are welcome! Check out our contributing guide.