CodeCommit pull request approval rules to enforcing your pull request workflow
Project description
@cloudcomponents/cdk-pull-request-approval-rule
CodeCommit pull request approval rules to enforcing your pull request workflow
Install
TypeScript/JavaScript:
npm i @cloudcomponents/cdk-pull-request-approval-rule
Python:
pip install cloudcomponents.cdk-pull-request-approval-rule
How to use
import { Construct, Stack, StackProps } from '@aws-cdk/core';
import { Repository } from '@aws-cdk/aws-codecommit';
import { BuildSpec } from '@aws-cdk/aws-codebuild';
import { PullRequestCheck } from '@cloudcomponents/cdk-pull-request-check';
import {
ApprovalRuleTemplate,
ApprovalRuleTemplateRepositoryAssociation,
} from '@cloudcomponents/cdk-pull-request-approval-rule';
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
import { Construct, Stack, StackProps } from '@aws-cdk/core';
import { Repository } from '@aws-cdk/aws-codecommit';
import { BuildSpec } from '@aws-cdk/aws-codebuild';
import { PullRequestCheck } from '@cloudcomponents/cdk-pull-request-check';
import {
ApprovalRuleTemplate,
ApprovalRuleTemplateRepositoryAssociation,
} from '@cloudcomponents/cdk-pull-request-approval-rule';
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.
Example
See more complete examples.
License
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
Built Distribution
Close
Hashes for cloudcomponents.cdk-pull-request-approval-rule-1.49.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | b3f06da5339dd35a97e6b7d331402bd9feaf16785b82b5560df9a6d919c629da |
|
MD5 | 6b22fbc415d5fc29276a26a4478a9e4f |
|
BLAKE2b-256 | 6159ac2747cf76eea4b189bc8bdbd088e813665f7e329ab1688868d86ebb4cec |
Close
Hashes for cloudcomponents.cdk_pull_request_approval_rule-1.49.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d92ac75b1cf48e6fe0ac2ed5b3f6546155b85c9c6c60bd4f55d7bbd2ffa22307 |
|
MD5 | baac2eeb069157f1b988c64b38d0ce54 |
|
BLAKE2b-256 | 560e16f0d54f07a42e773868bf6a6f0608a1e484044b3d383230f84cd24b47ad |