forked from aws/aws-cdk
-
Notifications
You must be signed in to change notification settings - Fork 0
46 lines (43 loc) · 1.42 KB
/
lock-issue-pr-with-message.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
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.
lock:
permissions:
pull-requests: write
issues: write
runs-on: ubuntu-latest
needs: auto_comment # only run after comment is complete
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