[![cloudcomponents Logo](https://raw.githubusercontent.com/cloudcomponents/cdk-constructs/master/logo.png)](https://github.com/cloudcomponents/cdk-constructs)
# @cloudcomponents/cdk-github-webhook
[![Build Status](https://github.com/cloudcomponents/cdk-constructs/workflows/Build/badge.svg)](https://github.com/cloudcomponents/cdk-constructs/actions?query=workflow=Build)
[![cdkdx](https://img.shields.io/badge/buildtool-cdkdx-blue.svg)](https://github.com/hupe1980/cdkdx)
[![typescript](https://img.shields.io/badge/jsii-typescript-blueviolet.svg)](https://www.npmjs.com/package/@cloudcomponents/cdk-github-webhook)
[![python](https://img.shields.io/badge/jsii-python-blueviolet.svg)](https://pypi.org/project/cloudcomponents.cdk-github-webhook/)
[![Mentioned in Awesome CDK](https://awesome.re/mentioned-badge.svg)](https://github.com/kolomied/awesome-cdk)
> Create, update and delete github webhooks with your app deployment
## Install
TypeScript/JavaScript:
```bash
npm i @cloudcomponents/cdk-github-webhook
```
Python:
```bash
pip install cloudcomponents.cdk-github-webhook
```
## How to use
```python
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](https://github.com/cloudcomponents/cdk-constructs/tree/master/packages/cdk-github-webhook/API.md).
## Example
See more complete [examples](https://github.com/cloudcomponents/cdk-constructs/tree/master/examples).
## License
[MIT](https://github.com/cloudcomponents/cdk-constructs/tree/master/packages/cdk-github-webhook/LICENSE)
Raw data
{
"_id": null,
"home_page": "https://github.com/cloudcomponents/cdk-constructs",
"name": "cloudcomponents.cdk-github-webhook",
"maintainer": null,
"docs_url": null,
"requires_python": "~=3.8",
"maintainer_email": null,
"keywords": null,
"author": "hupe1980",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/c1/eb/49ac1183a5461a9dd7b291ca71e5fb0afc86aefd19532f18980c1f57554c/cloudcomponents.cdk-github-webhook-2.4.0.tar.gz",
"platform": null,
"description": "[![cloudcomponents Logo](https://raw.githubusercontent.com/cloudcomponents/cdk-constructs/master/logo.png)](https://github.com/cloudcomponents/cdk-constructs)\n\n# @cloudcomponents/cdk-github-webhook\n\n[![Build Status](https://github.com/cloudcomponents/cdk-constructs/workflows/Build/badge.svg)](https://github.com/cloudcomponents/cdk-constructs/actions?query=workflow=Build)\n[![cdkdx](https://img.shields.io/badge/buildtool-cdkdx-blue.svg)](https://github.com/hupe1980/cdkdx)\n[![typescript](https://img.shields.io/badge/jsii-typescript-blueviolet.svg)](https://www.npmjs.com/package/@cloudcomponents/cdk-github-webhook)\n[![python](https://img.shields.io/badge/jsii-python-blueviolet.svg)](https://pypi.org/project/cloudcomponents.cdk-github-webhook/)\n[![Mentioned in Awesome CDK](https://awesome.re/mentioned-badge.svg)](https://github.com/kolomied/awesome-cdk)\n\n> Create, update and delete github webhooks with your app deployment\n\n## Install\n\nTypeScript/JavaScript:\n\n```bash\nnpm i @cloudcomponents/cdk-github-webhook\n```\n\nPython:\n\n```bash\npip install cloudcomponents.cdk-github-webhook\n```\n\n## How to use\n\n```python\nimport { GithubWebhook } from '@cloudcomponents/cdk-github-webhook';\nimport { SecretKey } from '@cloudcomponents/cdk-secret-key';\nimport { Stack, StackProps, aws_apigateway } from 'aws-cdk-lib';\nimport { Construct } from 'constructs';\n\nexport class GithubWebhookStack extends Stack {\n constructor(scope: Construct, id: string, props?: StackProps) {\n super(scope, id, props);\n\n const api = new aws_apigateway.RestApi(this, 'github-webhook');\n api.root.addMethod('POST');\n\n if (typeof process.env.API_TOKEN === 'undefined') {\n throw new Error('environment variable API_TOKEN undefined');\n }\n const githubApiToken = SecretKey.fromPlainText(process.env.API_TOKEN);\n\n // @example https://github.com/cloudcomponents/cdk-constructs\n if (typeof process.env.REPO_URL === 'undefined') {\n throw new Error('environment variable REPO_URL undefined');\n }\n const githubRepoUrl = process.env.REPO_URL;\n\n // @see https://developer.github.com/v3/activity/events/types/\n const events = ['*'];\n\n new GithubWebhook(this, 'GithubWebhook', {\n githubApiToken,\n githubRepoUrl,\n payloadUrl: api.url,\n events,\n logLevel: 'debug',\n });\n }\n}\n```\n\n## API Reference\n\nSee [API.md](https://github.com/cloudcomponents/cdk-constructs/tree/master/packages/cdk-github-webhook/API.md).\n\n## Example\n\nSee more complete [examples](https://github.com/cloudcomponents/cdk-constructs/tree/master/examples).\n\n## License\n\n[MIT](https://github.com/cloudcomponents/cdk-constructs/tree/master/packages/cdk-github-webhook/LICENSE)\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Create, update and delete github webhooks with your app deployment",
"version": "2.4.0",
"project_urls": {
"Homepage": "https://github.com/cloudcomponents/cdk-constructs",
"Source": "https://github.com/cloudcomponents/cdk-constructs.git"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "ff30e26c92ab09ad93dba08bb2ffa615ff9852bba48f920bc38229b3909653be",
"md5": "acab20295b4b406c1dd7e959da0ed581",
"sha256": "5a7e3f6ca32046ac602490e07f29bd1a9bdebf0aa1852bca44725143699976c0"
},
"downloads": -1,
"filename": "cloudcomponents.cdk_github_webhook-2.4.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "acab20295b4b406c1dd7e959da0ed581",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "~=3.8",
"size": 628223,
"upload_time": "2024-05-16T19:33:29",
"upload_time_iso_8601": "2024-05-16T19:33:29.155597Z",
"url": "https://files.pythonhosted.org/packages/ff/30/e26c92ab09ad93dba08bb2ffa615ff9852bba48f920bc38229b3909653be/cloudcomponents.cdk_github_webhook-2.4.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "c1eb49ac1183a5461a9dd7b291ca71e5fb0afc86aefd19532f18980c1f57554c",
"md5": "c5d4c7ae5c1cfb2203b3a9cf200ceee9",
"sha256": "319857086e3dec45b40fa3eb7272dee1ee48ce970fff895bac18534088b28b09"
},
"downloads": -1,
"filename": "cloudcomponents.cdk-github-webhook-2.4.0.tar.gz",
"has_sig": false,
"md5_digest": "c5d4c7ae5c1cfb2203b3a9cf200ceee9",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "~=3.8",
"size": 629337,
"upload_time": "2024-05-16T19:33:35",
"upload_time_iso_8601": "2024-05-16T19:33:35.220022Z",
"url": "https://files.pythonhosted.org/packages/c1/eb/49ac1183a5461a9dd7b291ca71e5fb0afc86aefd19532f18980c1f57554c/cloudcomponents.cdk-github-webhook-2.4.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-05-16 19:33:35",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "cloudcomponents",
"github_project": "cdk-constructs",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "cloudcomponents.cdk-github-webhook"
}