Skip to content

chore(ci): improve PR, Issues, and release automations #1431

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
May 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 17 additions & 20 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,28 +1,29 @@
<!--- 1. Make sure you follow our Contributing Guidelines: https://github.com/awslabs/aws-lambda-powertools-typescript/blob/main/CONTRIBUTING.md -->
<!--- 2. Please follow the template, and do not remove any section in the template. If something is not applicable leave it empty, but leave it in the PR. -->
<!---
Instructions:
1. Make sure you follow our Contributing Guidelines: https://github.com/awslabs/aws-lambda-powertools-typescript/blob/main/CONTRIBUTING.md
2. Please follow the template, and do not remove any section/item. If something is not applicable leave it empty, but leave it in the PR.
3. -->

## Description of your changes

<!--- Include here a summary of the change. -->
<!---
Include here a summary of the change.

<!--- Please include also relevant motivation and context. -->
Please include also relevant motivation and context.

<!--- List any dependencies that are required for this change. -->
Add any applicable code snippets, links, screenshots, or other resources
that can help us verify your changes.
-->

<!--- If this PR is part of a sequence of related PRs or TODOs, list the high level TODO items. -->

### How to verify this change

<!--- Add any applicable config, projects, screenshots or other resources -->
<!--- that can help us verify your changes. -->
### Related issues, RFCs

<!--- Examples: -->
<!--- Screenshots, cloud configuration, anything helping us evaluate better. -->
<!---
Add here the number (i.e. #42) to the Github Issue or RFC that is related to this PR.

### Related issues, RFCs
Don't include any other text, otherwise the Github Issue will not be detected.

<!--- Add here the number (i.e. #42) to the Github Issue or RFC that is related to this PR. -->
<!--- If no issue is present the PR might get blocked and not be reviewed. -->
Note: If no issue is present the PR might get blocked and not be reviewed.
-->
**Issue number:**

## Checklist
Expand All @@ -31,12 +32,8 @@
- [ ] I have performed a *self-review* of my own code
- [ ] I have *commented* my code where necessary, particularly in areas that should be flagged with a TODO, or hard-to-understand areas
- [ ] I have made corresponding changes to the *documentation*
- [ ] I have made corresponding changes to the *examples*
- [ ] My changes generate *no new warnings*
- [ ] The *code coverage* hasn't decreased
- [ ] I have *added tests* that prove my change is effective and works
- [ ] New and existing *unit tests pass* locally and in Github Actions
- [ ] Any *dependent changes have been merged and published*
- [ ] The PR title follows the [conventional commit semantics](https://github.com/awslabs/aws-lambda-powertools-typescript/blob/main/.github/semantic.yml#L2)

### Breaking change checklist
Expand Down
173 changes: 173 additions & 0 deletions .github/boring-cyborg.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,173 @@
##### Labeler ##########################################################################################################
labelPRBasedOnFilePath:
area/logger:
- packages/logger/src/*
- packages/logger/src/**/*
area/tracer:
- packages/tracer/src/*
- packages/tracer/src/**/*
area/metrics:
- packages/metrics/src/*
- packages/metrics/src/**/*
area/idempotency:
- packages/idempotency/src/*
- packages/idempotency/src/**/*
area/parameters:
- packages/parameters/src/*
- packages/parameters/src/**/*
area/parser:
- packages/parser/src/*
- packages/parser/src/**/*
area/validator:
- packages/validator/src/*
- packages/validator/src/**/*
area/batch:
- packages/batch/src/*
- packages/batch/src/**/*
area/commons:
- packages/commons/src/*
- packages/commons/src/**/*

area/layers:
- layers/src/*
- layers/src/**/*
- layers/bin/*
- layers/cdk.json

type/tests:
- packages/logger/tests/*
- packages/logger/tests/**/*
- packages/logger/jest.config.js
- packages/tracer/tests/*
- packages/tracer/tests/**/*
- packages/tracer/jest.config.js
- packages/metrics/tests/*
- packages/metrics/tests/**/*
- packages/metrics/jest.config.js
- packages/idempotency/tests/*
- packages/idempotency/tests/**/*
- packages/idempotency/jest.config.js
- packages/parameters/tests/*
- packages/parameters/tests/**/*
- packages/parameters/jest.config.js
- packages/parser/tests/*
- packages/parser/tests/**/*
- packages/parser/jest.config.js
- packages/validator/tests/*
- packages/validator/tests/**/*
- packages/validator/jest.config.js
- packages/batch/tests/*
- packages/batch/tests/**/*
- packages/batch/jest.config.js
- packages/commons/tests/*
- packages/commons/tests/**/*
- packages/commons/jest.config.js
- layers/jest.config.js
- layers/tests/*
- layers/tests/**/*

area/documentation:
- docs/*
- docs/**/*
- mkdocs.yml
- typedoc.js
- examples/cdk/bin/*
- examples/cdk/functions/*
- examples/cdk/functions/**/*
- examples/cdk/src/*
- examples/cdk/src/**/*
- examples/cdk/tests/*
- examples/cdk/tests/**/*
- examples/cdk/README.md
- examples/cdk/cdk.json
- examples/sam/events/*
- examples/sam/src/*
- examples/sam/src/**/*
- examples/sam/tests/*
- examples/sam/tests/**/*
- examples/sam/README.md
- examples/sam/template.yaml

area/automation:
- .github/scripts/*
- .github/scripts/**/*
- .github/workflows/*
- .github/workflows/**/*
- .github/actions/*
- .github/actions/**/*
- .github/release-drafter.yml
- .github/boring-cyborg.yml
- .github/semantic.yml

type/internal:
- .github/CODEOWNERS
- .github/PULL_REQUEST_TEMPLATE.md
- .github/ISSUE_TEMPLATE/*
- CONTRIBUTING.md
- MAINTAINERS.md
- CODE_OF_CONDUCT.md
- SECURITY.md
- LICENSE
- LICENSE-THIRD-PARTY
- lerna.json
- .nvmrc
- .eslintrc.js
- .eslintignore
- .npmignore
- .gitpod.yml
- .husky/*
- .devcontainer/*
- packages/logger/tsconfig*.json
- packages/logger/README.md
- packages/metrics/tsconfig*.json
- packages/metrics/README.md
- packages/tracer/tsconfig*.json
- packages/tracer/README.md
- packages/parser/tsconfig*.json
- packages/parser/README.md
- packages/idempotency/tsconfig*.json
- packages/idempotency/README.md
- packages/batch/tsconfig*.json
- packages/batch/README.md
- packages/commons/tsconfig*.json
- packages/commons/README.md
- packages/validator/tsconfig*.json
- packages/validator/README.md
- packages/parser/tsconfig*.json
- packages/parser/README.md
- layers/tsconfig*.json
- layers/README.md
- examples/sam/tsconfig*.json
- examples/cdk/tsconfig*.json

type/dependencies:
- package.json
- package-lock.json
- packages/tracer/package.json
- packages/metrics/package.json
- packages/logger/package.json
- packages/commons/package.json
- packages/parameters/package.json
- packages/idempotency/package.json
- packages/parser/package.json
- packages/validator/package.json
- packages/batch/package.json
- layers/package.json
- examples/cdk/package.json
- examples/sam/package.json

##### Greetings ########################################################################################################
firstPRWelcomeComment: >
Thanks a lot for your first contribution! Please check out our [contributing guidelines](https://github.com/awslabs/aws-lambda-powertools-typescript/blob/chore/pr_automation/CONTRIBUTING.md) and don't hesitate to ask whatever you need.

In the meantime, check out the #typescript channel on our AWS Lambda Powertools Discord: [Invite link](https://discord.gg/B8zZKbbyET)

# Comment to be posted to congratulate user on their first merged PR
firstPRMergeComment: >
Awesome work, congrats on your first merged pull request and thank you for helping improve everyone's experience!

# Comment to be posted to on first time issues
firstIssueWelcomeComment: >
Thanks for opening your first issue here! We'll come back to you as soon as we can.

In the meantime, check out the #typescript channel on our AWS Lambda Powertools Discord: [Invite link](https://discord.gg/B8zZKbbyET)
8 changes: 2 additions & 6 deletions .github/scripts/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,6 @@ module.exports = Object.freeze({
/** @type {string[]} */
"IGNORE_AUTHORS": ["dependabot[bot]"],

/** @type {string[]} */
"AREAS": [
"tracer",
"metrics",
"logger",
],
/** @type {RegExp} */
"RELATED_ISSUE_REGEX": /\bIssue number:(?<closingWord>:closes?|close|fix|fixes?|fixed|resolves?|resolved)?\s*#(?<issue>\d+)\b/
});
68 changes: 41 additions & 27 deletions .github/scripts/label_missing_related_issue.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,36 +5,50 @@ const {
PR_NUMBER,
IGNORE_AUTHORS,
LABEL_BLOCK,
LABEL_BLOCK_REASON
LABEL_BLOCK_REASON,
RELATED_ISSUE_REGEX,
} = require("./constants");

module.exports = async ({github, context, core}) => {
if (IGNORE_AUTHORS.includes(PR_AUTHOR)) {
return core.notice("Author in IGNORE_AUTHORS list; skipping...");
}
module.exports = async ({ github, context, core }) => {
if (IGNORE_AUTHORS.includes(PR_AUTHOR)) {
return core.notice("Author in IGNORE_AUTHORS list; skipping...");
}

if (PR_ACTION != "opened") {
return core.notice("Only newly open PRs are labelled to avoid spam; skipping");
}
if (["opened"].includes(PR_ACTION)) {
return core.notice(
"Only newly opened PRs are labelled to avoid spam; skipping"
);
}

const RELATED_ISSUE_REGEX = /Issue number:[^\d\r\n]+(?<issue>\d+)/;
const isMatch = RELATED_ISSUE_REGEX.exec(PR_BODY);
if (isMatch == null) {
core.info(`No related issue found, maybe the author didn't use the template but there is one.`);
const isMatch = RELATED_ISSUE_REGEX.exec(PR_BODY);
if (isMatch == null) {
core.info(
`No related issue found, maybe the author didn't use the template but there is one.`
);

let msg = "No related issues found. Please ensure there is an open issue related to this change to avoid significant delays or closure.";
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
body: msg,
issue_number: PR_NUMBER,
});
let msg =
"No related issues found. Please ensure there is an open issue related to this change to avoid significant delays or closure.";
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
body: msg,
issue_number: PR_NUMBER,
});

return await github.rest.issues.addLabels({
issue_number: PR_NUMBER,
owner: context.repo.owner,
repo: context.repo.repo,
labels: [LABEL_BLOCK, LABEL_BLOCK_REASON]
});
}
}
return await github.rest.issues.addLabels({
issue_number: PR_NUMBER,
owner: context.repo.owner,
repo: context.repo.repo,
labels: [LABEL_BLOCK, LABEL_BLOCK_REASON],
});
} else {
const { closingWord, issue } = isMatch.groups;
core.info(
`Found related issue #${issue} ${
closingWord === undefined
? "without closing word"
: `with closing word ${closingWord}`
}`
);
}
};
Loading