Skip to content

Commit 2ec7418

Browse files
committed
* 'develop' of https://github.com/heitorlessa/aws-lambda-powertools-python: chore(ci): test upstream job skip fix(ci): cond doesnt support two expr w/ env chore(ci): test env expr fix(ci): only event is resolved in cond chore(ci): test default env fix(ci): remove unsupported env in workflow_call fix(ci): unexpected symbol due to double quotes... chore(ci): experiment hardening origin chore(ci): experiment hardening origin chore: debug full event chore: print full workflow event depth chore: print full event depth chore: dummy for PR test
2 parents 59d0309 + 8d1744a commit 2ec7418

File tree

2 files changed

+42
-0
lines changed

2 files changed

+42
-0
lines changed

Diff for: .github/scripts/enforce_acknowledgment.js

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
const {
2+
PR_ACTION,
3+
PR_AUTHOR,
4+
PR_BODY,
5+
PR_NUMBER,
6+
IGNORE_AUTHORS,
7+
LABEL_BLOCK,
8+
LABEL_BLOCK_REASON
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_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.`)
24+
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+
});
32+
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+
}

Diff for: .github/workflows/on_opened_pr.yml

+2
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ jobs:
2020
runs-on: ubuntu-latest
2121
steps:
2222
- uses: actions/checkout@v3
23+
- name: "Debug workflow_run event"
24+
run: echo "${{ github }}"
2325
- name: "Ensure related issue is present"
2426
uses: actions/github-script@v6
2527
env:

0 commit comments

Comments
 (0)