Create, update and delete github webhooks with your app deployment
Project description
@cloudcomponents/cdk-github-webhook
Create, update and delete github webhooks with your app deployment
Install
TypeScript/JavaScript:
npm i @cloudcomponents/cdk-github-webhook
Python:
pip install cloudcomponents.cdk-github-webhook
How to use
import { GithubWebhook } from '@cloudcomponents/cdk-github-webhook';
import { SecretKey } from '@cloudcomponents/cdk-secret-key';
import { Stack, StackProps, aws_apigateway } from 'aws-cdk-lib';
import { Construct } from 'constructs';
export class GithubWebhookStack extends Stack {
constructor(scope: Construct, id: string, props?: StackProps) {
super(scope, id, props);
const api = new aws_apigateway.RestApi(this, 'github-webhook');
api.root.addMethod('POST');
if (typeof process.env.API_TOKEN === 'undefined') {
throw new Error('environment variable API_TOKEN undefined');
}
const githubApiToken = SecretKey.fromPlainText(process.env.API_TOKEN);
// @example https://github.com/cloudcomponents/cdk-constructs
if (typeof process.env.REPO_URL === 'undefined') {
throw new Error('environment variable REPO_URL undefined');
}
const githubRepoUrl = process.env.REPO_URL;
// @see https://developer.github.com/v3/activity/events/types/
const events = ['*'];
new GithubWebhook(this, 'GithubWebhook', {
githubApiToken,
githubRepoUrl,
payloadUrl: api.url,
events,
logLevel: 'debug',
});
}
}
API Reference
See API.md.
Example
See more complete examples.
License
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
Close
Hashes for cloudcomponents.cdk-github-webhook-2.1.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | a0ac51ae5a196a110900887cea430e147b5270ba9a64bf885b7e19e307639704 |
|
MD5 | 58508f1ee475327ce83373d74cb80510 |
|
BLAKE2b-256 | c1fc7dee31cec7012e8ffda38208fc87e56ecc7eaa93ea6dc5149b78db70d36e |
Close
Hashes for cloudcomponents.cdk_github_webhook-2.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d5c35bbb48cfb9d002f274eecf888a112748b04826714bf2cb89c74a67e6b767 |
|
MD5 | a3521948eb8f72148a32c465a9455fa7 |
|
BLAKE2b-256 | 155b70ae63597d4ba99cbaf50aa38a07e8abf156f73f3b4f3bdfa576ba257bff |