cloudcomponents.cdk-github-webhook


Namecloudcomponents.cdk-github-webhook JSON
Version 2.3.0 PyPI version JSON
download
home_pagehttps://github.com/cloudcomponents/cdk-constructs
SummaryCreate, update and delete github webhooks with your app deployment
upload_time2024-04-17 18:36:34
maintainerNone
docs_urlNone
authorhupe1980
requires_python~=3.8
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            [![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/e2/62/706cd0859bf9e2e21d11713b61b7a0ab01d805e1fbddc652ef9c59165625/cloudcomponents.cdk-github-webhook-2.3.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.3.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": "6537de8c39f5ba1a03d45a8117f057bf5ce7336c80221251a5e45e325abf3b23",
                "md5": "f094ac892eec14048da7ddbaef1e908c",
                "sha256": "eb4e67711d9c0963d4b58eda08930d6c16c2b4b596fe820b0e4a667b11d54f14"
            },
            "downloads": -1,
            "filename": "cloudcomponents.cdk_github_webhook-2.3.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "f094ac892eec14048da7ddbaef1e908c",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "~=3.8",
            "size": 1829432,
            "upload_time": "2024-04-17T18:36:28",
            "upload_time_iso_8601": "2024-04-17T18:36:28.872685Z",
            "url": "https://files.pythonhosted.org/packages/65/37/de8c39f5ba1a03d45a8117f057bf5ce7336c80221251a5e45e325abf3b23/cloudcomponents.cdk_github_webhook-2.3.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e262706cd0859bf9e2e21d11713b61b7a0ab01d805e1fbddc652ef9c59165625",
                "md5": "66ac04bb588b8b55222232762e1a8b67",
                "sha256": "cfe3addf63d369e67ad2f2ef1403b1509867797bf1d2992695b003223e470a52"
            },
            "downloads": -1,
            "filename": "cloudcomponents.cdk-github-webhook-2.3.0.tar.gz",
            "has_sig": false,
            "md5_digest": "66ac04bb588b8b55222232762e1a8b67",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "~=3.8",
            "size": 1830546,
            "upload_time": "2024-04-17T18:36:34",
            "upload_time_iso_8601": "2024-04-17T18:36:34.226981Z",
            "url": "https://files.pythonhosted.org/packages/e2/62/706cd0859bf9e2e21d11713b61b7a0ab01d805e1fbddc652ef9c59165625/cloudcomponents.cdk-github-webhook-2.3.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-17 18:36:34",
    "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"
}
        
Elapsed time: 0.24638s