AWS CDK Construct Library to interact with GitHub's API.
Project description
CDK-GitHub
AWS CDK v2 L3 constructs for GitHub.
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 Terraform GitHub Provider.
Internally AWS CloudFormation custom resources will be used to track GitHub resources (such as Secrets).
Installation
JavaScript/TypeScript:
npm install cdk-github
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
ActionSecret
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,
});
}
}
See full example in ActionSecretStack
ActionEnvironmentSecret
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,
});
}
}
See full example in ActionEnvironmentSecretStack
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for cdk_github-0.0.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 497f192943fd1dc9c26a599c358f1a1bc8af5ab91112fbb0161517c7de5aac97 |
|
MD5 | be57766d99173a039faa33213ad2133d |
|
BLAKE2b-256 | d9c21c22044b2781a2a4120018bc714d27ef8734f3235a3faf251394ae37061f |