Skip to content

Commit e184a8e

Browse files
committed
* 'develop' of https://github.com/awslabs/aws-lambda-powertools-python: chore(ci): add workflow to suggest splitting large PRs (#1480)
2 parents ad29807 + 62a976f commit e184a8e

File tree

2 files changed

+50
-0
lines changed

2 files changed

+50
-0
lines changed

Diff for: .github/scripts/comment_on_large_pr.js

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
const {
2+
PR_NUMBER,
3+
IGNORE_AUTHORS,
4+
} = require("./constants")
5+
6+
module.exports = async ({github, context, core}) => {
7+
if (IGNORE_AUTHORS.includes(PR_AUTHOR)) {
8+
return core.notice("Author in IGNORE_AUTHORS list; skipping...")
9+
}
10+
11+
core.info(`Commenting on PR ${PR_NUMBER}`)
12+
13+
let msg = `
14+
### ⚠️Large PR detected⚠️.
15+
16+
Please consider breaking into smaller PRs to avoid significant review delays. Ignore if this PR has naturally grown to this size after reviews.
17+
`;
18+
19+
await github.rest.issues.createComment({
20+
owner: context.repo.owner,
21+
repo: context.repo.repo,
22+
body: msg,
23+
issue_number: PR_NUMBER,
24+
});
25+
}

Diff for: .github/workflows/on_label_added.yml

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: On Label added
2+
3+
on:
4+
pull_request:
5+
types:
6+
- labeled
7+
8+
jobs:
9+
split-large-pr:
10+
if: github.event.label.name == 'size/XXL'
11+
runs-on: ubuntu-latest
12+
permissions:
13+
issues: write
14+
pull-requests: write
15+
steps:
16+
- uses: actions/checkout@v3
17+
- name: "Suggest split large Pull Request"
18+
uses: actions/github-script@v6
19+
env:
20+
PR_NUMBER: ${{ github.event.issue.number }}
21+
with:
22+
github-token: ${{ secrets.GITHUB_TOKEN }}
23+
script: |
24+
const script = require('.github/scripts/comment_on_large_pr.js')
25+
await script({github, context, core})

0 commit comments

Comments
 (0)