Skip to content

Commit 2a6c90d

Browse files
Merge branch 'develop' into feat/parameter-env-variable
2 parents 02d3254 + e5f538e commit 2a6c90d

File tree

10 files changed

+278
-140
lines changed

10 files changed

+278
-140
lines changed

.github/scripts/constants.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ module.exports = Object.freeze({
2424
/** @type {string} */
2525
"LABEL_BLOCK_REASON": "need-issue",
2626

27+
/** @type {string} */
28+
"LABEL_BLOCK_MISSING_LICENSE_AGREEMENT": "need-license-agreement-acknowledge",
29+
2730
/** @type {string} */
2831
"LABEL_PENDING_RELEASE": "pending-release",
2932

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
const {
2+
PR_ACTION,
3+
PR_AUTHOR,
4+
PR_BODY,
5+
PR_NUMBER,
6+
IGNORE_AUTHORS,
7+
LABEL_BLOCK,
8+
LABEL_BLOCK_MISSING_LICENSE_AGREEMENT
9+
} = require("./constants")
10+
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+
}
15+
16+
if (PR_ACTION != "opened") {
17+
return core.notice("Only newly open PRs are labelled to avoid spam; skipping")
18+
}
19+
20+
const RELATED_ACK_SECTION_REGEX = /By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice./;
21+
22+
const isMatch = RELATED_ACK_SECTION_REGEX.exec(PR_BODY);
23+
if (isMatch == null) {
24+
core.info(`No acknowledgement section found, maybe the author didn't use the template but there is one.`)
25+
26+
let msg = "No acknowledgement section found. Please make sure you used the template to open a PR and didn't remove the acknowledgment section. Check the template here: https://github.com/awslabs/aws-lambda-powertools-python/blob/develop/.github/PULL_REQUEST_TEMPLATE.md#acknowledgment";
27+
await github.rest.issues.createComment({
28+
owner: context.repo.owner,
29+
repo: context.repo.repo,
30+
body: msg,
31+
issue_number: PR_NUMBER,
32+
});
33+
34+
return await github.rest.issues.addLabels({
35+
issue_number: PR_NUMBER,
36+
owner: context.repo.owner,
37+
repo: context.repo.repo,
38+
labels: [LABEL_BLOCK, LABEL_BLOCK_MISSING_LICENSE_AGREEMENT]
39+
})
40+
}
41+
}

.github/workflows/on_opened_pr.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,20 @@ jobs:
3232
script: |
3333
const script = require('.github/scripts/label_missing_related_issue.js')
3434
await script({github, context, core})
35+
check_acknowledge_section:
36+
needs: get_pr_details
37+
runs-on: ubuntu-latest
38+
steps:
39+
- uses: actions/checkout@v3
40+
- name: "Ensure acknowledgement section is present"
41+
uses: actions/github-script@v6
42+
env:
43+
PR_BODY: ${{ needs.get_pr_details.outputs.prBody }}
44+
PR_NUMBER: ${{ needs.get_pr_details.outputs.prNumber }}
45+
PR_ACTION: ${{ needs.get_pr_details.outputs.prAction }}
46+
PR_AUTHOR: ${{ needs.get_pr_details.outputs.prAuthor }}
47+
with:
48+
github-token: ${{ secrets.GITHUB_TOKEN }}
49+
script: |
50+
const script = require('.github/scripts/label_missing_acknowledgement_section.js')
51+
await script({github, context, core})

.github/workflows/python_build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ jobs:
5353
- name: Complexity baseline
5454
run: make complexity-baseline
5555
- name: Upload coverage to Codecov
56-
uses: codecov/codecov-action@d9f34f8cd5cb3b3eb79b3e4b5dae3a16df499a70 # 3.1.1
56+
uses: codecov/codecov-action@40a12dcee2df644d47232dde008099a3e9e4f865 # 3.1.2
5757
with:
5858
file: ./coverage.xml
5959
env_vars: PYTHON

.github/workflows/reusable_update_v2_layer_arn_docs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ jobs:
4646
run: |
4747
HAS_CHANGE=$(git status --porcelain)
4848
test -z "${HAS_CHANGE}" && echo "Nothing to update" && exit 0
49-
git add docs/index.md
49+
git add docs/index.md docs/core/logger.md docs/core/tracer.md docs/core/metrics.md
5050
git commit -m "chore: update v2 layer ARN on documentation"
5151
git pull origin "${BRANCH}" # prevents concurrent branch update failing push
5252
git push origin HEAD:refs/heads/"${BRANCH}"

0 commit comments

Comments
 (0)