Skip to content

Commit

Permalink
chore: lock conversations on closed issues and PRs with message (#30941)
Browse files Browse the repository at this point in the history
### 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*
  • Loading branch information
GavinZZ authored Jul 24, 2024
1 parent e7af8f8 commit 64afa72
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 21 deletions.
21 changes: 0 additions & 21 deletions .github/workflows/closed-issue-message.yml

This file was deleted.

47 changes: 47 additions & 0 deletions .github/workflows/lock-issue-pr-with-message.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Lock Closed Issues and PRs with message

on:
pull_request_target:
types: [closed]
issues:
types: [closed]

jobs:
auto_comment:
permissions:
pull-requests: write
issues: write
runs-on: ubuntu-latest
steps:
- uses: aws-actions/closed-issue-message@v1
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
message: |
Comments on closed issues and PRs are hard for our team to see.
If you need help, please open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.
lock:
permissions:
pull-requests: write
issues: write
runs-on: ubuntu-latest
needs: auto_comment
steps:
- name: Lock closed issue or PR
run: |
if [ "${{ github.event_name }}" == "issues" ]; then
ISSUE_NUMBER=${{ github.event.issue.number }}
ISSUE_URL=https://api.github.com/repos/${{ github.repository }}/issues/${ISSUE_NUMBER}/lock
else
ISSUE_NUMBER=${{ github.event.pull_request.number }}
ISSUE_URL=https://api.github.com/repos/${{ github.repository }}/issues/${ISSUE_NUMBER}/lock
fi
curl -s -X PUT -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-H "Accept: application/vnd.github.v3+json" \
${ISSUE_URL} \
-d @- <<EOF
{
"lock_reason": "resolved"
}
EOF

0 comments on commit 64afa72

Please sign in to comment.