Skip to main content

Create, update and delete github webhooks with your app deployment

Project description

cloudcomponents Logo

@cloudcomponents/cdk-github-webhook

Build Status cdkdx typescript python Mentioned in Awesome CDK

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

MIT

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

cloudcomponents.cdk-github-webhook-2.0.0.tar.gz (613.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file cloudcomponents.cdk-github-webhook-2.0.0.tar.gz.

File metadata

  • Download URL: cloudcomponents.cdk-github-webhook-2.0.0.tar.gz
  • Upload date:
  • Size: 613.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.1 readme-renderer/30.0 requests/2.26.0 requests-toolbelt/0.9.1 urllib3/1.26.7 tqdm/4.62.3 importlib-metadata/4.8.2 keyring/23.2.1 rfc3986/1.5.0 colorama/0.4.4 CPython/3.9.10

File hashes

Hashes for cloudcomponents.cdk-github-webhook-2.0.0.tar.gz
Algorithm Hash digest
SHA256 efd2ccd9c595998e966fbc0402f74bd7da1a751a033961eeb94577b44fda305f
MD5 740459678033c6c2d2dfd01724db7ba9
BLAKE2b-256 25e45988a8cb324e96bc73c27b1ba0deac7077212d6960ae47dbccfc03a53702

See more details on using hashes here.

File details

Details for the file cloudcomponents.cdk_github_webhook-2.0.0-py3-none-any.whl.

File metadata

  • Download URL: cloudcomponents.cdk_github_webhook-2.0.0-py3-none-any.whl
  • Upload date:
  • Size: 613.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.1 readme-renderer/30.0 requests/2.26.0 requests-toolbelt/0.9.1 urllib3/1.26.7 tqdm/4.62.3 importlib-metadata/4.8.2 keyring/23.2.1 rfc3986/1.5.0 colorama/0.4.4 CPython/3.9.10

File hashes

Hashes for cloudcomponents.cdk_github_webhook-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 23b1e22a6001ca36f9ee0ed555b240d5c0f949daae77bdeaf516a945fa19865f
MD5 0ee459449af8cbb17dd383274aa58ba1
BLAKE2b-256 867e1ecce221c9da3b0d7e3b2caa536c3b3ecfb0b0818ee9bf3a571e628ce556

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page