Skip to content

Commit 404dae2

Browse files
authored
Add Github workflow to lock PR conversation on close (#6169)
* Add Github workflow to lock PR conversation on close * Address comments
1 parent 0af784d commit 404dae2

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Lock PR Conversation on Close
2+
3+
on:
4+
pull_request:
5+
types: [closed]
6+
7+
jobs:
8+
lock-conversation-closed-prs:
9+
if: github.repository == 'aws/aws-sdk-java-v2'
10+
name: Lock PR Conversation on Close
11+
runs-on: ubuntu-latest
12+
permissions:
13+
pull-requests: write
14+
steps:
15+
- name: Lock PR conversation on Close
16+
uses: actions/github-script@v7
17+
env:
18+
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
19+
with:
20+
script: |
21+
const prNumber = context.payload.pull_request.number;
22+
23+
await github.rest.issues.createComment({
24+
owner: context.repo.owner,
25+
repo: context.repo.repo,
26+
issue_number: prNumber,
27+
body: "This pull request has been closed and the conversation has been locked. Comments on closed PRs are hard for our team to see. If you need more assistance, please open a new issue that references this one."
28+
});
29+
30+
await github.rest.issues.lock({
31+
owner: context.repo.owner,
32+
repo: context.repo.repo,
33+
issue_number: prNumber,
34+
lock_reason: "resolved"
35+
});

0 commit comments

Comments
 (0)