Skip to content

玛丽贴贴

玛丽贴贴 #65

Workflow file for this run

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 }}