Skip to content

Commit 64afa72

Browse files
authored
chore: lock conversations on closed issues and PRs with message (#30941)
### Issue # (if applicable) ### Reason for this change Lock conversations on closed issues and PRs to make sure important comments are not left on closed items and no one would be able to see it. Force people to create new issues instead. ### Description of changes Lock conversations. ### Description of how you validated changes Tested in a forked repo and it works correctly. ### Checklist - [ ] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md) ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
1 parent e7af8f8 commit 64afa72

File tree

2 files changed

+47
-21
lines changed

2 files changed

+47
-21
lines changed

.github/workflows/closed-issue-message.yml

Lines changed: 0 additions & 21 deletions
This file was deleted.
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Lock Closed Issues and PRs with message
2+
3+
on:
4+
pull_request_target:
5+
types: [closed]
6+
issues:
7+
types: [closed]
8+
9+
jobs:
10+
auto_comment:
11+
permissions:
12+
pull-requests: write
13+
issues: write
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: aws-actions/closed-issue-message@v1
17+
with:
18+
repo-token: "${{ secrets.GITHUB_TOKEN }}"
19+
message: |
20+
Comments on closed issues and PRs are hard for our team to see.
21+
If you need help, please open a new issue that references this one.
22+
If you wish to keep having a conversation with other community members under this issue feel free to do so.
23+
lock:
24+
permissions:
25+
pull-requests: write
26+
issues: write
27+
runs-on: ubuntu-latest
28+
needs: auto_comment
29+
steps:
30+
- name: Lock closed issue or PR
31+
run: |
32+
if [ "${{ github.event_name }}" == "issues" ]; then
33+
ISSUE_NUMBER=${{ github.event.issue.number }}
34+
ISSUE_URL=https://api.github.com/repos/${{ github.repository }}/issues/${ISSUE_NUMBER}/lock
35+
else
36+
ISSUE_NUMBER=${{ github.event.pull_request.number }}
37+
ISSUE_URL=https://api.github.com/repos/${{ github.repository }}/issues/${ISSUE_NUMBER}/lock
38+
fi
39+
40+
curl -s -X PUT -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
41+
-H "Accept: application/vnd.github.v3+json" \
42+
${ISSUE_URL} \
43+
-d @- <<EOF
44+
{
45+
"lock_reason": "resolved"
46+
}
47+
EOF

0 commit comments

Comments
 (0)