cloudcomponents.cdk-pull-request-approval-rule


Namecloudcomponents.cdk-pull-request-approval-rule JSON
Version 2.3.0 PyPI version JSON
download
home_pagehttps://github.com/cloudcomponents/cdk-constructs
SummaryCodeCommit pull request approval rules to enforcing your pull request workflow
upload_time2024-04-17 18:36:27
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-pull-request-approval-rule

[![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-pull-request-approval-rule)
[![python](https://img.shields.io/badge/jsii-python-blueviolet.svg)](https://pypi.org/project/cloudcomponents.cdk-pull-request-approval-rule/)

> CodeCommit pull request approval rules to enforcing your pull request workflow

## Install

TypeScript/JavaScript:

```bash
npm i @cloudcomponents/cdk-pull-request-approval-rule
```

Python:

```bash
pip install cloudcomponents.cdk-pull-request-approval-rule
```

## How to use

```python
import { ApprovalRuleTemplate, ApprovalRuleTemplateRepositoryAssociation } from '@cloudcomponents/cdk-pull-request-approval-rule';
import { PullRequestCheck } from '@cloudcomponents/cdk-pull-request-check';
import { Stack, StackProps } from 'aws-cdk-lib';
import { BuildSpec } from 'aws-cdk-lib/aws-codebuild';
import { Repository } from 'aws-cdk-lib/aws-codecommit';
import { Construct } from 'constructs';

export class PullRequestStack extends Stack {
  constructor(scope: Construct, id: string, props?: StackProps) {
    super(scope, id, props);

    const repository = new Repository(this, 'Repository', {
      repositoryName: 'pr-check-repository',
    });

    const { approvalRuleTemplateName } = new ApprovalRuleTemplate(this, 'ApprovalRuleTemplate', {
      approvalRuleTemplateName: 'template-name',
      template: {
        approvers: {
          numberOfApprovalsNeeded: 1,
        },
      },
    });

    new ApprovalRuleTemplateRepositoryAssociation(this, 'ApprovalRuleTemplateRepositoryAssociation', {
      approvalRuleTemplateName,
      repository,
    });

    new PullRequestCheck(this, 'PullRequestCheck', {
      repository,
      buildSpec: BuildSpec.fromSourceFilename('prcheck.yml'),
    });
  }
}
```

## ApprovalRuleOverridden notification

```python
import { ApprovalRuleTemplate, ApprovalRuleTemplateRepositoryAssociation } from '@cloudcomponents/cdk-pull-request-approval-rule';
import { PullRequestCheck } from '@cloudcomponents/cdk-pull-request-check';
import { Stack, StackProps } from 'aws-cdk-lib';
import { BuildSpec } from 'aws-cdk-lib/aws-codebuild';
import { Repository } from 'aws-cdk-lib/aws-codecommit';
import { SnsTopic } from 'aws-cdk-lib/aws-events-targets';
import { Topic } from 'aws-cdk-lib/aws-sns';
import { Construct } from 'constructs';

export class PullRequestStack extends Stack {
  constructor(scope: Construct, id: string, props?: StackProps) {
    super(scope, id, props);

    const repository = new Repository(this, 'Repository', {
      repositoryName: 'pr-check-repository',
    });

    const { approvalRuleTemplateName } = new ApprovalRuleTemplate(
      this,
      'ApprovalRuleTemplate',
      {
        approvalRuleTemplateName: 'template-name',
        template: {
          approvers: {
            numberOfApprovalsNeeded: 1,
          },
        },
      },
    );

    const ruleAsscociation = new ApprovalRuleTemplateRepositoryAssociation(
      stack,
      'ApprovalRuleTemplateRepositoryAssociation',
      {
          approvalRuleTemplateName,
          repository,
      },
    );

    const topic = new Topic(stack, 'Topic');

    ruleAsscociation.onOverridden('overridden', {
        target: new SnsTopic(topic),
    });

    // Approves the pull request
    new PullRequestCheck(this, 'PullRequestCheck', {
        repository,
        buildSpec: BuildSpec.fromSourceFilename('prcheck.yml'),
    });
  }
}
```

## API Reference

See [API.md](https://github.com/cloudcomponents/cdk-constructs/tree/master/packages/cdk-pull-request-approval-rule/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-pull-request-approval-rule/LICENSE)

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/cloudcomponents/cdk-constructs",
    "name": "cloudcomponents.cdk-pull-request-approval-rule",
    "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/60/28/4e93fddaf686cc7a5044e09607f4c7c4aac166acff1efa7ee681b639a61f/cloudcomponents.cdk-pull-request-approval-rule-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-pull-request-approval-rule\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-pull-request-approval-rule)\n[![python](https://img.shields.io/badge/jsii-python-blueviolet.svg)](https://pypi.org/project/cloudcomponents.cdk-pull-request-approval-rule/)\n\n> CodeCommit pull request approval rules to enforcing your pull request workflow\n\n## Install\n\nTypeScript/JavaScript:\n\n```bash\nnpm i @cloudcomponents/cdk-pull-request-approval-rule\n```\n\nPython:\n\n```bash\npip install cloudcomponents.cdk-pull-request-approval-rule\n```\n\n## How to use\n\n```python\nimport { ApprovalRuleTemplate, ApprovalRuleTemplateRepositoryAssociation } from '@cloudcomponents/cdk-pull-request-approval-rule';\nimport { PullRequestCheck } from '@cloudcomponents/cdk-pull-request-check';\nimport { Stack, StackProps } from 'aws-cdk-lib';\nimport { BuildSpec } from 'aws-cdk-lib/aws-codebuild';\nimport { Repository } from 'aws-cdk-lib/aws-codecommit';\nimport { Construct } from 'constructs';\n\nexport class PullRequestStack extends Stack {\n  constructor(scope: Construct, id: string, props?: StackProps) {\n    super(scope, id, props);\n\n    const repository = new Repository(this, 'Repository', {\n      repositoryName: 'pr-check-repository',\n    });\n\n    const { approvalRuleTemplateName } = new ApprovalRuleTemplate(this, 'ApprovalRuleTemplate', {\n      approvalRuleTemplateName: 'template-name',\n      template: {\n        approvers: {\n          numberOfApprovalsNeeded: 1,\n        },\n      },\n    });\n\n    new ApprovalRuleTemplateRepositoryAssociation(this, 'ApprovalRuleTemplateRepositoryAssociation', {\n      approvalRuleTemplateName,\n      repository,\n    });\n\n    new PullRequestCheck(this, 'PullRequestCheck', {\n      repository,\n      buildSpec: BuildSpec.fromSourceFilename('prcheck.yml'),\n    });\n  }\n}\n```\n\n## ApprovalRuleOverridden notification\n\n```python\nimport { ApprovalRuleTemplate, ApprovalRuleTemplateRepositoryAssociation } from '@cloudcomponents/cdk-pull-request-approval-rule';\nimport { PullRequestCheck } from '@cloudcomponents/cdk-pull-request-check';\nimport { Stack, StackProps } from 'aws-cdk-lib';\nimport { BuildSpec } from 'aws-cdk-lib/aws-codebuild';\nimport { Repository } from 'aws-cdk-lib/aws-codecommit';\nimport { SnsTopic } from 'aws-cdk-lib/aws-events-targets';\nimport { Topic } from 'aws-cdk-lib/aws-sns';\nimport { Construct } from 'constructs';\n\nexport class PullRequestStack extends Stack {\n  constructor(scope: Construct, id: string, props?: StackProps) {\n    super(scope, id, props);\n\n    const repository = new Repository(this, 'Repository', {\n      repositoryName: 'pr-check-repository',\n    });\n\n    const { approvalRuleTemplateName } = new ApprovalRuleTemplate(\n      this,\n      'ApprovalRuleTemplate',\n      {\n        approvalRuleTemplateName: 'template-name',\n        template: {\n          approvers: {\n            numberOfApprovalsNeeded: 1,\n          },\n        },\n      },\n    );\n\n    const ruleAsscociation = new ApprovalRuleTemplateRepositoryAssociation(\n      stack,\n      'ApprovalRuleTemplateRepositoryAssociation',\n      {\n          approvalRuleTemplateName,\n          repository,\n      },\n    );\n\n    const topic = new Topic(stack, 'Topic');\n\n    ruleAsscociation.onOverridden('overridden', {\n        target: new SnsTopic(topic),\n    });\n\n    // Approves the pull request\n    new PullRequestCheck(this, 'PullRequestCheck', {\n        repository,\n        buildSpec: BuildSpec.fromSourceFilename('prcheck.yml'),\n    });\n  }\n}\n```\n\n## API Reference\n\nSee [API.md](https://github.com/cloudcomponents/cdk-constructs/tree/master/packages/cdk-pull-request-approval-rule/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-pull-request-approval-rule/LICENSE)\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "CodeCommit pull request approval rules to enforcing your pull request workflow",
    "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": "f84cd42c7736e96d2e3fa4a9947aae64fcb0c8bca65420e7e39fdce97f515269",
                "md5": "8304eb46a257977797c91bfc375e2231",
                "sha256": "fc62bce0d6125fcd661f26973e64daffc1d3b9b916b8889fdd44d44dd9b44b44"
            },
            "downloads": -1,
            "filename": "cloudcomponents.cdk_pull_request_approval_rule-2.3.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "8304eb46a257977797c91bfc375e2231",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "~=3.8",
            "size": 2538584,
            "upload_time": "2024-04-17T18:36:03",
            "upload_time_iso_8601": "2024-04-17T18:36:03.350734Z",
            "url": "https://files.pythonhosted.org/packages/f8/4c/d42c7736e96d2e3fa4a9947aae64fcb0c8bca65420e7e39fdce97f515269/cloudcomponents.cdk_pull_request_approval_rule-2.3.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "60284e93fddaf686cc7a5044e09607f4c7c4aac166acff1efa7ee681b639a61f",
                "md5": "c485e1ee13d182fca7aa988a1e3401cf",
                "sha256": "58450d0bfb2dca9433615ecc1227e4bbfc2ef9b50a9132764a000dea9a88270b"
            },
            "downloads": -1,
            "filename": "cloudcomponents.cdk-pull-request-approval-rule-2.3.0.tar.gz",
            "has_sig": false,
            "md5_digest": "c485e1ee13d182fca7aa988a1e3401cf",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "~=3.8",
            "size": 2539277,
            "upload_time": "2024-04-17T18:36:27",
            "upload_time_iso_8601": "2024-04-17T18:36:27.399523Z",
            "url": "https://files.pythonhosted.org/packages/60/28/4e93fddaf686cc7a5044e09607f4c7c4aac166acff1efa7ee681b639a61f/cloudcomponents.cdk-pull-request-approval-rule-2.3.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-17 18:36:27",
    "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-pull-request-approval-rule"
}
        
Elapsed time: 0.23481s