cloudcomponents.cdk-pull-request-approval-rule


Namecloudcomponents.cdk-pull-request-approval-rule JSON
Version 2.4.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-05-16 19:33:09
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/38/7f/7287fc1db032b911f15203b6e03affad5a3333b7dc48c3be2f25904bad42/cloudcomponents.cdk-pull-request-approval-rule-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-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.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": "2f4d6db02015837cc45c917df638e3e6c859f81d1a4f5dbfb21c316d8922054f",
                "md5": "9dd67967e2a4f5427461ca50d187777b",
                "sha256": "7c485ef804c8761696d234fc574b9e89bd02e6c60c6eb6df61b6f13b9a838c7f"
            },
            "downloads": -1,
            "filename": "cloudcomponents.cdk_pull_request_approval_rule-2.4.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "9dd67967e2a4f5427461ca50d187777b",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "~=3.8",
            "size": 141378,
            "upload_time": "2024-05-16T19:33:05",
            "upload_time_iso_8601": "2024-05-16T19:33:05.155554Z",
            "url": "https://files.pythonhosted.org/packages/2f/4d/6db02015837cc45c917df638e3e6c859f81d1a4f5dbfb21c316d8922054f/cloudcomponents.cdk_pull_request_approval_rule-2.4.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "387f7287fc1db032b911f15203b6e03affad5a3333b7dc48c3be2f25904bad42",
                "md5": "fd9ecd2967784ddaad617e1ddaa93b04",
                "sha256": "fff9b374fa8a1a95e605eff7d83189a641e0b35d563018dbf0c947ba24e70bdd"
            },
            "downloads": -1,
            "filename": "cloudcomponents.cdk-pull-request-approval-rule-2.4.0.tar.gz",
            "has_sig": false,
            "md5_digest": "fd9ecd2967784ddaad617e1ddaa93b04",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "~=3.8",
            "size": 142448,
            "upload_time": "2024-05-16T19:33:09",
            "upload_time_iso_8601": "2024-05-16T19:33:09.543958Z",
            "url": "https://files.pythonhosted.org/packages/38/7f/7287fc1db032b911f15203b6e03affad5a3333b7dc48c3be2f25904bad42/cloudcomponents.cdk-pull-request-approval-rule-2.4.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-05-16 19:33:09",
    "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: 2.68625s