Skip to content

Commit c34c108

Browse files
authored
chore(ci): improve PR, Issues, and release automations (#1431)
* chore: update PR template * chore: updated semantic config to include scopes * chore: update pr, issue, and release automation * chore: add path to boring-cyborg * chore: reverted multi events * chore: fixed bugs in the scripts * chore: added missing labels into document * chore: fixed setLabels command * chore: fix version tag in url
1 parent 194bbd3 commit c34c108

10 files changed

+406
-138
lines changed

Diff for: .github/PULL_REQUEST_TEMPLATE.md

+17-20
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,29 @@
1-
<!--- 1. Make sure you follow our Contributing Guidelines: https://github.com/awslabs/aws-lambda-powertools-typescript/blob/main/CONTRIBUTING.md -->
2-
<!--- 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. -->
1+
<!---
2+
Instructions:
3+
1. Make sure you follow our Contributing Guidelines: https://github.com/awslabs/aws-lambda-powertools-typescript/blob/main/CONTRIBUTING.md
4+
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.
5+
3. -->
36

47
## Description of your changes
58

6-
<!--- Include here a summary of the change. -->
9+
<!---
10+
Include here a summary of the change.
711
8-
<!--- Please include also relevant motivation and context. -->
12+
Please include also relevant motivation and context.
913
10-
<!--- List any dependencies that are required for this change. -->
14+
Add any applicable code snippets, links, screenshots, or other resources
15+
that can help us verify your changes.
16+
-->
1117

12-
<!--- If this PR is part of a sequence of related PRs or TODOs, list the high level TODO items. -->
13-
14-
### How to verify this change
15-
16-
<!--- Add any applicable config, projects, screenshots or other resources -->
17-
<!--- that can help us verify your changes. -->
18+
### Related issues, RFCs
1819

19-
<!--- Examples: -->
20-
<!--- Screenshots, cloud configuration, anything helping us evaluate better. -->
20+
<!---
21+
Add here the number (i.e. #42) to the Github Issue or RFC that is related to this PR.
2122
22-
### Related issues, RFCs
23+
Don't include any other text, otherwise the Github Issue will not be detected.
2324
24-
<!--- Add here the number (i.e. #42) to the Github Issue or RFC that is related to this PR. -->
25-
<!--- If no issue is present the PR might get blocked and not be reviewed. -->
25+
Note: If no issue is present the PR might get blocked and not be reviewed.
26+
-->
2627
**Issue number:**
2728

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

4239
### Breaking change checklist

Diff for: .github/boring-cyborg.yml

+173
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,173 @@
1+
##### Labeler ##########################################################################################################
2+
labelPRBasedOnFilePath:
3+
area/logger:
4+
- packages/logger/src/*
5+
- packages/logger/src/**/*
6+
area/tracer:
7+
- packages/tracer/src/*
8+
- packages/tracer/src/**/*
9+
area/metrics:
10+
- packages/metrics/src/*
11+
- packages/metrics/src/**/*
12+
area/idempotency:
13+
- packages/idempotency/src/*
14+
- packages/idempotency/src/**/*
15+
area/parameters:
16+
- packages/parameters/src/*
17+
- packages/parameters/src/**/*
18+
area/parser:
19+
- packages/parser/src/*
20+
- packages/parser/src/**/*
21+
area/validator:
22+
- packages/validator/src/*
23+
- packages/validator/src/**/*
24+
area/batch:
25+
- packages/batch/src/*
26+
- packages/batch/src/**/*
27+
area/commons:
28+
- packages/commons/src/*
29+
- packages/commons/src/**/*
30+
31+
area/layers:
32+
- layers/src/*
33+
- layers/src/**/*
34+
- layers/bin/*
35+
- layers/cdk.json
36+
37+
type/tests:
38+
- packages/logger/tests/*
39+
- packages/logger/tests/**/*
40+
- packages/logger/jest.config.js
41+
- packages/tracer/tests/*
42+
- packages/tracer/tests/**/*
43+
- packages/tracer/jest.config.js
44+
- packages/metrics/tests/*
45+
- packages/metrics/tests/**/*
46+
- packages/metrics/jest.config.js
47+
- packages/idempotency/tests/*
48+
- packages/idempotency/tests/**/*
49+
- packages/idempotency/jest.config.js
50+
- packages/parameters/tests/*
51+
- packages/parameters/tests/**/*
52+
- packages/parameters/jest.config.js
53+
- packages/parser/tests/*
54+
- packages/parser/tests/**/*
55+
- packages/parser/jest.config.js
56+
- packages/validator/tests/*
57+
- packages/validator/tests/**/*
58+
- packages/validator/jest.config.js
59+
- packages/batch/tests/*
60+
- packages/batch/tests/**/*
61+
- packages/batch/jest.config.js
62+
- packages/commons/tests/*
63+
- packages/commons/tests/**/*
64+
- packages/commons/jest.config.js
65+
- layers/jest.config.js
66+
- layers/tests/*
67+
- layers/tests/**/*
68+
69+
area/documentation:
70+
- docs/*
71+
- docs/**/*
72+
- mkdocs.yml
73+
- typedoc.js
74+
- examples/cdk/bin/*
75+
- examples/cdk/functions/*
76+
- examples/cdk/functions/**/*
77+
- examples/cdk/src/*
78+
- examples/cdk/src/**/*
79+
- examples/cdk/tests/*
80+
- examples/cdk/tests/**/*
81+
- examples/cdk/README.md
82+
- examples/cdk/cdk.json
83+
- examples/sam/events/*
84+
- examples/sam/src/*
85+
- examples/sam/src/**/*
86+
- examples/sam/tests/*
87+
- examples/sam/tests/**/*
88+
- examples/sam/README.md
89+
- examples/sam/template.yaml
90+
91+
area/automation:
92+
- .github/scripts/*
93+
- .github/scripts/**/*
94+
- .github/workflows/*
95+
- .github/workflows/**/*
96+
- .github/actions/*
97+
- .github/actions/**/*
98+
- .github/release-drafter.yml
99+
- .github/boring-cyborg.yml
100+
- .github/semantic.yml
101+
102+
type/internal:
103+
- .github/CODEOWNERS
104+
- .github/PULL_REQUEST_TEMPLATE.md
105+
- .github/ISSUE_TEMPLATE/*
106+
- CONTRIBUTING.md
107+
- MAINTAINERS.md
108+
- CODE_OF_CONDUCT.md
109+
- SECURITY.md
110+
- LICENSE
111+
- LICENSE-THIRD-PARTY
112+
- lerna.json
113+
- .nvmrc
114+
- .eslintrc.js
115+
- .eslintignore
116+
- .npmignore
117+
- .gitpod.yml
118+
- .husky/*
119+
- .devcontainer/*
120+
- packages/logger/tsconfig*.json
121+
- packages/logger/README.md
122+
- packages/metrics/tsconfig*.json
123+
- packages/metrics/README.md
124+
- packages/tracer/tsconfig*.json
125+
- packages/tracer/README.md
126+
- packages/parser/tsconfig*.json
127+
- packages/parser/README.md
128+
- packages/idempotency/tsconfig*.json
129+
- packages/idempotency/README.md
130+
- packages/batch/tsconfig*.json
131+
- packages/batch/README.md
132+
- packages/commons/tsconfig*.json
133+
- packages/commons/README.md
134+
- packages/validator/tsconfig*.json
135+
- packages/validator/README.md
136+
- packages/parser/tsconfig*.json
137+
- packages/parser/README.md
138+
- layers/tsconfig*.json
139+
- layers/README.md
140+
- examples/sam/tsconfig*.json
141+
- examples/cdk/tsconfig*.json
142+
143+
type/dependencies:
144+
- package.json
145+
- package-lock.json
146+
- packages/tracer/package.json
147+
- packages/metrics/package.json
148+
- packages/logger/package.json
149+
- packages/commons/package.json
150+
- packages/parameters/package.json
151+
- packages/idempotency/package.json
152+
- packages/parser/package.json
153+
- packages/validator/package.json
154+
- packages/batch/package.json
155+
- layers/package.json
156+
- examples/cdk/package.json
157+
- examples/sam/package.json
158+
159+
##### Greetings ########################################################################################################
160+
firstPRWelcomeComment: >
161+
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.
162+
163+
In the meantime, check out the #typescript channel on our AWS Lambda Powertools Discord: [Invite link](https://discord.gg/B8zZKbbyET)
164+
165+
# Comment to be posted to congratulate user on their first merged PR
166+
firstPRMergeComment: >
167+
Awesome work, congrats on your first merged pull request and thank you for helping improve everyone's experience!
168+
169+
# Comment to be posted to on first time issues
170+
firstIssueWelcomeComment: >
171+
Thanks for opening your first issue here! We'll come back to you as soon as we can.
172+
173+
In the meantime, check out the #typescript channel on our AWS Lambda Powertools Discord: [Invite link](https://discord.gg/B8zZKbbyET)

Diff for: .github/scripts/constants.js

+2-6
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,6 @@ module.exports = Object.freeze({
3636
/** @type {string[]} */
3737
"IGNORE_AUTHORS": ["dependabot[bot]"],
3838

39-
/** @type {string[]} */
40-
"AREAS": [
41-
"tracer",
42-
"metrics",
43-
"logger",
44-
],
39+
/** @type {RegExp} */
40+
"RELATED_ISSUE_REGEX": /\bIssue number:(?<closingWord>:closes?|close|fix|fixes?|fixed|resolves?|resolved)?\s*#(?<issue>\d+)\b/
4541
});

Diff for: .github/scripts/label_missing_related_issue.js

+41-27
Original file line numberDiff line numberDiff line change
@@ -5,36 +5,50 @@ const {
55
PR_NUMBER,
66
IGNORE_AUTHORS,
77
LABEL_BLOCK,
8-
LABEL_BLOCK_REASON
8+
LABEL_BLOCK_REASON,
9+
RELATED_ISSUE_REGEX,
910
} = require("./constants");
1011

11-
module.exports = async ({github, context, core}) => {
12-
if (IGNORE_AUTHORS.includes(PR_AUTHOR)) {
13-
return core.notice("Author in IGNORE_AUTHORS list; skipping...");
14-
}
12+
module.exports = async ({ github, context, core }) => {
13+
if (IGNORE_AUTHORS.includes(PR_AUTHOR)) {
14+
return core.notice("Author in IGNORE_AUTHORS list; skipping...");
15+
}
1516

16-
if (PR_ACTION != "opened") {
17-
return core.notice("Only newly open PRs are labelled to avoid spam; skipping");
18-
}
17+
if (["opened"].includes(PR_ACTION)) {
18+
return core.notice(
19+
"Only newly opened PRs are labelled to avoid spam; skipping"
20+
);
21+
}
1922

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

25-
let msg = "No related issues found. Please ensure there is an open issue related to this change to avoid significant delays or closure.";
26-
await github.rest.issues.createComment({
27-
owner: context.repo.owner,
28-
repo: context.repo.repo,
29-
body: msg,
30-
issue_number: PR_NUMBER,
31-
});
29+
let msg =
30+
"No related issues found. Please ensure there is an open issue related to this change to avoid significant delays or closure.";
31+
await github.rest.issues.createComment({
32+
owner: context.repo.owner,
33+
repo: context.repo.repo,
34+
body: msg,
35+
issue_number: PR_NUMBER,
36+
});
3237

33-
return await github.rest.issues.addLabels({
34-
issue_number: PR_NUMBER,
35-
owner: context.repo.owner,
36-
repo: context.repo.repo,
37-
labels: [LABEL_BLOCK, LABEL_BLOCK_REASON]
38-
});
39-
}
40-
}
38+
return await github.rest.issues.addLabels({
39+
issue_number: PR_NUMBER,
40+
owner: context.repo.owner,
41+
repo: context.repo.repo,
42+
labels: [LABEL_BLOCK, LABEL_BLOCK_REASON],
43+
});
44+
} else {
45+
const { closingWord, issue } = isMatch.groups;
46+
core.info(
47+
`Found related issue #${issue} ${
48+
closingWord === undefined
49+
? "without closing word"
50+
: `with closing word ${closingWord}`
51+
}`
52+
);
53+
}
54+
};

0 commit comments

Comments
 (0)