Skip to content

Commit a0df04f

Browse files
authored
Merge branch 'main' into refactor/idempotency_tests
2 parents d66731f + cb9eaf9 commit a0df04f

File tree

111 files changed

+1870
-1822
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

111 files changed

+1870
-1822
lines changed

Diff for: .github/ISSUE_TEMPLATE/bug_report.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: Bug report
22
description: Report a reproducible bug to help us improve
33
title: "Bug: TITLE"
4-
labels: ["bug", "triage"]
4+
labels: ["type/bug", "triage"]
55
body:
66
- type: markdown
77
attributes:
@@ -76,8 +76,8 @@ body:
7676
- type: textarea
7777
id: logs
7878
attributes:
79-
label: Debugging logs
80-
description: If available, please share [debugging logs](https://awslabs.github.io/aws-lambda-powertools-python/#debug-mode)
79+
label: Execution logs
80+
description: If available, please share some logs making sure to remove any sensitive data
8181
render: Shell
8282
validations:
8383
required: false

Diff for: .github/ISSUE_TEMPLATE/documentation_improvements.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: Documentation improvements
22
description: Suggest a documentation update to improve everyone's experience
33
title: "Docs: TITLE"
4-
labels: ["documentation", "triage"]
4+
labels: ["area/documentation", "triage"]
55
body:
66
- type: markdown
77
attributes:

Diff for: .github/ISSUE_TEMPLATE/feature_request.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: Feature request
22
description: Suggest an idea for Lambda Powertools
33
title: "Feature request: TITLE"
4-
labels: ["feature-request", "triage"]
4+
labels: ["type/feature-request", "triage"]
55
body:
66
- type: markdown
77
attributes:

Diff for: .github/ISSUE_TEMPLATE/maintenance.yml

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: Maintenance
22
description: Suggest an activity to help address tech debt, governance, and anything internal
33
title: "Maintenance: TITLE"
4-
labels: ["internal", "triage"]
4+
labels: ["type/internal", "triage"]
55
body:
66
- type: markdown
77
attributes:
@@ -32,7 +32,6 @@ body:
3232
- Automation
3333
- Governance
3434
- Tests
35-
- Types
3635
- Tracer
3736
- Logger
3837
- Metrics

Diff for: .github/ISSUE_TEMPLATE/rfc.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: Request for Comments (RFC)
22
description: Feature design and detailed proposals
33
title: "RFC: TITLE"
4-
labels: ["RFC", "triage"]
4+
labels: ["type/RFC", "triage"]
55
body:
66
- type: markdown
77
attributes:

Diff for: .github/PULL_REQUEST_TEMPLATE.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232

3333
## Checklist
3434

35-
- [ ] [My changes meet the tenets criteria](https://awslabs.github.io/aws-lambda-powertools-python/#tenets)
35+
- [ ] [My changes meet the tenets criteria](https://awslabs.github.io/aws-lambda-powertools-typescript/#tenets)
3636
- [ ] I have performed a *self-review* of my own code
3737
- [ ] I have *commented* my code where necessary, particularly in areas that should be flagged with a TODO, or hard-to-understand areas
3838
- [ ] I have made corresponding changes to the *documentation*
@@ -41,7 +41,7 @@
4141
- [ ] The *code coverage* hasn't decreased
4242
- [ ] I have *added tests* that prove my change is effective and works
4343
- [ ] New and existing *unit tests pass* locally and in Github Actions
44-
- [ ] Any *dependent changes have been merged and published* in downstream module
44+
- [ ] Any *dependent changes have been merged and published*
4545
- [ ] The PR title follows the [conventional commit semantics](https://github.com/awslabs/aws-lambda-powertools-typescript/blob/main/.github/semantic.yml#L2)
4646

4747
### Breaking change checklist

Diff for: .github/auto_assign-issues.yml

-6
This file was deleted.

Diff for: .github/release-drafter.yml

+9-10
Original file line numberDiff line numberDiff line change
@@ -2,28 +2,27 @@ change-template: "* $TITLE (#$NUMBER) by @$AUTHOR"
22
categories:
33
- title: '⚡ Breaking Changes'
44
labels:
5-
- 'breaking-change'
5+
- 'type/breaking-change'
66
- title: '🌟New features and non-breaking changes'
77
labels:
8-
- 'major'
9-
- 'feature'
8+
- 'type/feature'
109
- title: '🌟 Minor Changes'
1110
labels:
12-
- 'enhancement'
11+
- 'type/enhancement'
1312
- title: '📜 Documentation updates'
1413
labels:
15-
- 'documentation'
14+
- 'area/documentation'
1615
- title: '🐛 Bug and hot fixes'
1716
labels:
18-
- 'bug'
19-
- 'fix'
17+
- 'type/bug'
18+
- 'type/fix'
2019
- title: '🚒 Deprecations'
2120
labels:
22-
- 'deprecated'
21+
- 'type/deprecation'
2322
- title: '🔧 Maintenance'
2423
labels:
25-
- 'internal'
26-
- 'dependencies'
24+
- 'type/internal'
25+
- 'type/dependencies'
2726
exclude-labels:
2827
- 'skip-changelog'
2928
tag-template: 'v$NEXT_PATCH_VERSION'

Diff for: .github/scripts/constants.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,10 @@ module.exports = Object.freeze({
2525
"LABEL_BLOCK_REASON": "need-issue",
2626

2727
/** @type {string} */
28-
"LABEL_PENDING_RELEASE": "pending-release",
28+
"LABEL_PENDING_RELEASE": "status/pending-release",
29+
30+
/** @type {string} */
31+
"LABEL_RELEASED": "status/completed",
2932

3033
/** @type {string} */
3134
"HANDLE_MAINTAINERS_TEAM": "@awslabs/aws-lambda-powertools-typescript",

Diff for: .github/scripts/label_pr_based_on_title.js

+9-24
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,19 @@
1-
const { PR_NUMBER, PR_TITLE, AREAS } = require("./constants");
1+
const { PR_NUMBER, PR_TITLE } = require("./constants");
22

33
module.exports = async ({github, context, core}) => {
4-
const FEAT_REGEX = /feat(\((.+)\))?(:.+)/
54
const BUG_REGEX = /(fix|bug)(\((.+)\))?(:.+)/
5+
const FEAT_REFACTOR_REGEX = /(feat|refactor)(\((.+)\))?(:.+)/
66
const DOCS_REGEX = /(docs|doc)(\((.+)\))?(:.+)/
77
const CHORE_REGEX = /(chore)(\((.+)\))?(:.+)/
88
const DEPRECATED_REGEX = /(deprecated)(\((.+)\))?(:.+)/
9-
const REFACTOR_REGEX = /(refactor)(\((.+)\))?(:.+)/
10-
9+
1110
const labels = {
12-
"feature": FEAT_REGEX,
13-
"bug": BUG_REGEX,
14-
"documentation": DOCS_REGEX,
15-
"internal": CHORE_REGEX,
16-
"enhancement": REFACTOR_REGEX,
17-
"deprecated": DEPRECATED_REGEX,
18-
};
11+
"type/feature": FEAT_REFACTOR_REGEX,
12+
"type/bug": BUG_REGEX,
13+
"area/documentation": DOCS_REGEX,
14+
"type/internal": CHORE_REGEX,
15+
"type/deprecation": DEPRECATED_REGEX,
16+
}
1917

2018
// Maintenance: We should keep track of modified PRs in case their titles change
2119
let miss = 0;
@@ -33,19 +31,6 @@ module.exports = async ({github, context, core}) => {
3331
labels: [label]
3432
});
3533

36-
const area = matches[2]; // second capture group contains the area
37-
if (AREAS.indexOf(area) > -1) {
38-
core.info(`Auto-labeling PR ${PR_NUMBER} with area ${area}`);
39-
await github.rest.issues.addLabels({
40-
issue_number: PR_NUMBER,
41-
owner: context.repo.owner,
42-
repo: context.repo.repo,
43-
labels: [`area/${area}`],
44-
});
45-
} else {
46-
core.debug(`'${PR_TITLE}' didn't match any known area.`);
47-
}
48-
4934
return;
5035
} else {
5136
core.debug(`'${PR_TITLE}' didn't match '${label}' semantic.`);

Diff for: .github/scripts/label_related_issue.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const {
66
LABEL_PENDING_RELEASE,
77
HANDLE_MAINTAINERS_TEAM,
88
PR_IS_MERGED,
9-
} = require("./constants")
9+
} = require("./constants");
1010

1111
module.exports = async ({github, context, core}) => {
1212
if (IGNORE_AUTHORS.includes(PR_AUTHOR)) {

Diff for: .github/scripts/post_release.js

+113
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
const { LABEL_PENDING_RELEASE, LABEL_RELEASED } = require("./constants");
2+
3+
/**
4+
* Fetch issues using GitHub REST API
5+
*
6+
* @param {object} gh_client - Pre-authenticated REST client (Octokit)
7+
* @param {string} org - GitHub Organization
8+
* @param {string} repository - GitHub repository
9+
* @param {string} state - GitHub issue state (open, closed)
10+
* @param {string} label - Comma-separated issue labels to fetch
11+
* @return {Object[]} issues - Array of issues matching params
12+
* @see {@link https://octokit.github.io/rest.js/v18#usage|Octokit client}
13+
*/
14+
15+
const fetchIssues = async ({
16+
gh_client,
17+
org,
18+
repository,
19+
state = "all",
20+
label = LABEL_PENDING_RELEASE,
21+
}) => {
22+
try {
23+
const { data: issues } = await gh_client.rest.issues.listForRepo({
24+
owner: org,
25+
repo: repository,
26+
state: state,
27+
labels: label,
28+
});
29+
30+
return issues;
31+
} catch (error) {
32+
console.error(error);
33+
throw new Error("Failed to fetch issues");
34+
}
35+
36+
};
37+
38+
/**
39+
* Notify new release and close staged GitHub issue
40+
*
41+
* @param {object} gh_client - Pre-authenticated REST client (Octokit)
42+
* @param {string} owner - GitHub Organization
43+
* @param {string} repository - GitHub repository
44+
* @param {string} release_version - GitHub Release version
45+
* @see {@link https://octokit.github.io/rest.js/v18#usage|Octokit client}
46+
*/
47+
48+
const notifyRelease = async ({
49+
gh_client,
50+
owner,
51+
repository,
52+
release_version,
53+
}) => {
54+
const release_url = `https://github.com/${owner}/${repository}/releases/tag/v${release_version}`;
55+
56+
const issues = await fetchIssues({
57+
gh_client: gh_client,
58+
org: owner,
59+
repository: repository,
60+
});
61+
62+
issues.forEach(async (issue) => {
63+
console.info(`Updating issue number ${issue.number}`);
64+
65+
const comment = `This is now released under [${release_version}](${release_url}) version!`;
66+
try {
67+
await gh_client.rest.issues.createComment({
68+
owner: owner,
69+
repo: repository,
70+
body: comment,
71+
issue_number: issue.number,
72+
});
73+
} catch (error) {
74+
console.error(error);
75+
throw new Error(`Failed to update issue ${issue.number} about ${release_version} release`)
76+
}
77+
78+
79+
// Close issue and remove staged label; keep existing ones
80+
const labels = issue.labels
81+
.filter((label) => label.name != LABEL_PENDING_RELEASE)
82+
.map((label) => label.name);
83+
84+
try {
85+
await gh_client.rest.issues.update({
86+
repo: repository,
87+
owner: owner,
88+
issue_number: issue.number,
89+
state: "closed",
90+
labels: [...labels, LABEL_RELEASED],
91+
});
92+
} catch (error) {
93+
console.error(error);
94+
throw new Error("Failed to close issue")
95+
}
96+
97+
console.info(`Issue number ${issue.number} closed and updated`);
98+
});
99+
};
100+
101+
// context: https://github.com/actions/toolkit/blob/main/packages/github/src/context.ts
102+
103+
module.exports = async ({ github, context }) => {
104+
const { RELEASE_VERSION } = process.env;
105+
console.log(`Running post-release script for ${RELEASE_VERSION} version`);
106+
107+
await notifyRelease({
108+
gh_client: github,
109+
owner: context.repo.owner,
110+
repository: context.repo.repo,
111+
release_version: RELEASE_VERSION,
112+
});
113+
};

Diff for: .github/stale.yml

+4-5
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,10 @@ only: issues
22
daysUntilStale: 30
33
daysUntilClose: 7
44
exemptLabels:
5-
- bug
6-
- documentation
7-
- enhancement
8-
- feature-request
9-
- RFC
5+
- type/bug
6+
- type/bug-upstream
7+
- type/feature-request
8+
- type/RFC
109
staleLabel: pending-close-response-required
1110
markComment: >
1211
This issue has been automatically marked as stale because it has not had

Diff for: .github/workflows/reusable-run-linting-check-and-unit-tests.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,11 @@ jobs:
4242
if: steps.cache-node-modules.outputs.cache-hit == 'true'
4343
run: |
4444
npm run build -w packages/commons
45-
npm run build -w packages/logger & npm run build -w packages/tracer & npm run build -w packages/metrics & npm run build -w packages/idempotency
45+
npm run build -w packages/logger & npm run build -w packages/tracer & npm run build -w packages/metrics & npm run build -w packages/parameters & npm run build -w packages/idempotency
4646
- name: Run linting
47-
run: npm run lint -w packages/commons -w packages/logger -w packages/tracer -w packages/metrics -w packages/idempotency
47+
run: npm run lint -w packages/commons -w packages/logger -w packages/tracer -w packages/metrics -w packages/parameters -w packages/idempotency
4848
- name: Run unit tests
49-
run: npm t -w packages/commons -w packages/logger -w packages/tracer -w packages/metrics -w packages/idempotency
49+
run: npm t -w packages/commons -w packages/logger -w packages/tracer -w packages/metrics -w packages/parameters -w packages/idempotency
5050
check-examples:
5151
runs-on: ubuntu-latest
5252
env:

0 commit comments

Comments
 (0)