-
Notifications
You must be signed in to change notification settings - Fork 2.9k
50 lines (45 loc) · 1.34 KB
/
check-issue.yaml
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
47
48
49
50
name: Add Comment for issue
on:
issues:
types: [opened]
jobs:
check_issue_title:
name: Check issue
runs-on: ubuntu-latest
env:
TITLE_PASSED: "T"
ISSUE_TITLE: ${{ github.event.issue.title }}
permissions:
issues: write
timeout-minutes: 20
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Check Issue
shell: bash
run: |
echo "Issue title: ${ISSUE_TITLE//\"/\\\"}"
cat >> check_title.py << EOF
import re
import sys
check_str = sys.argv[1]
pattern = re.compile(r'[\u4e00-\u9fa5]')
match = pattern.search(check_str)
if match:
print("TITLE_PASSED=F")
else:
print("TITLE_PASSED=T")
EOF
python3 check_title.py "${ISSUE_TITLE//\"/\\\"}" >> "$GITHUB_ENV"
cat $GITHUB_ENV
- name: Check env
shell: bash
run: |
echo ${{ env.TITLE_PASSED }}
- name: Add comment
if: ${{ env.TITLE_PASSED == 'F'}}
uses: peter-evans/create-or-update-comment@5f728c3dae25f329afbe34ee4d08eef25569d79f
with:
issue-number: ${{ github.event.issue.number }}
body: |
The title and description of this issue contains Chinese. Please use English to describe your issue.