Skip to content

摸金丨撤离丨PVP丨PVE丨RPG养成 #249

摸金丨撤离丨PVP丨PVE丨RPG养成

摸金丨撤离丨PVP丨PVE丨RPG养成 #249

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