-
Notifications
You must be signed in to change notification settings - Fork 1
79 lines (77 loc) · 2.1 KB
/
connect.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
75
76
77
78
79
name: ZZZBotris Connect To the Room
on:
workflow_dispatch:
inputs:
os:
description: "Runnning OS"
required: true
type: choice
options:
- macos
- ubuntu
- windows
default: "ubuntu"
token:
description: "BotrisBattle API token"
required: true
type: string
master_key:
description: "BotrisBattle Room Master Key"
required: true
type: string
next_count:
description: "Next count"
required: false
type: number
default: 6
level:
description: "Level"
required: false
type: number
default: 8
bpm:
description: "BPM"
required: false
type: number
default: 200
jobs:
connect:
runs-on: ${{ inputs.os }}-latest
env:
OUTPUT_FOLDER: ./build
PROJECT_NAME: ZZZTOJ.Botris
steps:
- name: Hide sensitive inputs
uses: levibostian/action-hide-sensitive-inputs@v1
with:
exclude_inputs: os, next_count, level, bpm
- uses: actions/checkout@v4
- name: Build Project
uses: ./.github/actions/build_dotnet
with:
output_folder: ${{ env.OUTPUT_FOLDER }}
project_name: ${{ env.PROJECT_NAME }}
- name: Get tetris_ai_runner
uses: ./.github/actions/get_tetris_ai
with:
os: ${{ inputs.os }}
output_folder: ${{ env.OUTPUT_FOLDER }}
- name: Generate bot config
shell: python3 {0}
run: |
import json
config = {
"NextCnt": ${{ inputs.next_count }},
"Level": ${{ inputs.level }},
"BPM": ${{ inputs.bpm }},
"Token": "${{ inputs.token }}",
"RoomKey": "${{ inputs.master_key }}",
"Quiet": True
}
json.dump(config, open("${{ env.OUTPUT_FOLDER }}/botconfig.json", "w"))
- name: Run bot
shell: bash
run: |
pushd ${{ env.OUTPUT_FOLDER }}
chmod +x ${{ env.PROJECT_NAME }}
./${{ env.PROJECT_NAME }}