-
Notifications
You must be signed in to change notification settings - Fork 29
88 lines (84 loc) · 3.49 KB
/
auto-dealrequest.yml
File metadata and controls
88 lines (84 loc) · 3.49 KB
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
80
81
82
83
84
85
86
87
88
name: Servers Request
on:
issues:
types:
- labeled
env:
TOKEN: ${{ secrets.GITHUB_TOKEN }}
jobs:
get-server-info:
permissions:
contents: write
issues: read
pull-requests: write
repository-projects: write
runs-on: ubuntu-latest
if: contains(github.event.label.name, 'Submit')
timeout-minutes: 2
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Issue Forms Body Parser
id: parse
uses: PSModule/Get-IssueFormData@v0
- name: Organize Inputs
id: organize-inputs
working-directory: ./.github/scripts/
run: |
server_name="${{ fromJSON(steps.parse.outputs.data)['Server Name'] }}"
server_icon="${{ fromJSON(steps.parse.outputs.data)['Server Icon Link'] }}"
server_type="${{ fromJSON(steps.parse.outputs.data)['Version'] }}"
server_version="${{ fromJSON(steps.parse.outputs.data)['Specific Client Version'] }}"
server_desc="${{ fromJSON(steps.parse.outputs.data)['Server Description'] }}"
server_link="${{ fromJSON(steps.parse.outputs.data)['Server Promotion Link'] }}"
if [ "$server_icon" == "_No response_" ]; then
server_icon="/logo2.webp"
fi
echo "- name: '$server_name'" >> server_info.yaml
echo " icon:" >> server_info.yaml
echo " src: $server_icon" >> server_info.yaml
echo " type: $server_type" >> server_info.yaml
echo " version: $server_version" >> server_info.yaml
echo " desc: |" >> server_info.yaml
echo " $server_desc" >> server_info.yaml
echo " link: $server_link" >> server_info.yaml
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: DataBase Input
working-directory: ./
run: |
echo --- Old DataBase
cat ./servers/${{ fromJSON(steps.parse.outputs.data)['Language'] }}/ServerList.yaml
echo --- New Data Input:
cat ./.github/scripts/server_info.yaml
- name: Data Processing...
working-directory: ./.github/scripts/
run: |
pip install -r requirements.txt
python Patch.py server_info.yaml ../../servers/${{ fromJSON(steps.parse.outputs.data)['Language'] }}/ServerList.yaml
echo --- Completed!
rm -rf ./server_info.yaml
- name: DataBase Output
working-directory: ./
run: |
echo --- New DataBase
cat ./servers/${{ fromJSON(steps.parse.outputs.data)['Language'] }}/ServerList.yaml
- name: Create Pull Request
uses: peter-evans/create-pull-request@v7
with:
token: ${{ env.TOKEN }}
branch: update-servers-links-from-issue
title: "feat: update servers links from issue(auto by bot)"
commit-message: |
feat: update servers links from issue(auto by bot)
--- New Servers ---
Name - ${{ fromJSON(steps.parse.outputs.data)['Server Name'] }}
Version - ${{ fromJSON(steps.parse.outputs.data)['Specific Client Version'] }}
Type - ${{ fromJSON(steps.parse.outputs.data)['Version'] }}
Desc - ${{ fromJSON(steps.parse.outputs.data)['Server Description'] }}
Icon - ${{ fromJSON(steps.parse.outputs.data)['Server Icon Link'] }}
Link - ${{ fromJSON(steps.parse.outputs.data)['Server Promotion Link'] }}
--- End of Servers ---
branch-suffix: timestamp