generated from InvoluteHell/Scoring
-
Notifications
You must be signed in to change notification settings - Fork 26
74 lines (58 loc) · 1.93 KB
/
auto_reply.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
name: Cyber Referee
on:
pull_request_target:
jobs:
auto_reply:
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- name: Self-introduction
uses: thollander/actions-comment-pull-request@v2
with:
message: "啾啾啾!裁判来咯!"
comment_tag: "Self-introduction"
reactions: laugh
- name: Check out code
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v37
- name: Scoring
id: scoring
run: |
echo Changes: ${{ steps.changed-files.outputs.all_changed_files }}
comment=$(python .github/scoring.py ${{ steps.changed-files.outputs.all_changed_files }})
echo "$comment"
echo "$comment" > comment.txt
if [[ $comment == *"No valid file"* ]]; then
echo valid=False | tee -a $GITHUB_OUTPUT
else
echo valid=True | tee -a $GITHUB_OUTPUT
fi
- name: Post Score
uses: thollander/actions-comment-pull-request@v2
with:
filePath: comment.txt
reactions: rocket
- name: Post Invalid
if: steps.scoring.outputs.valid != 'True'
uses: thollander/actions-comment-pull-request@v2
with:
message: "这瓜保熟吗?"
reactions: eyes
- name: Post Valid
if: steps.scoring.outputs.valid == 'True'
uses: thollander/actions-comment-pull-request@v2
with:
message: "你的代码写的也忒好咧!"
reactions: hooray
# - name: Auto Merge
# if: steps.scoring.outputs.valid == 'True'
# uses: pascalgn/automerge-action@v0.15.6
# env:
# MERGE_LABELS: ""
# GITHUB_TOKEN: ${{ secrets.MISTEOPAT }}