Support add new custom code

This commit is contained in:
xtaodada 2023-06-10 22:43:11 +08:00
parent 4c19a00b66
commit 323c1e5124
Signed by: xtaodada
GPG Key ID: 4CBB3F4FA8C85659

68
.github/workflows/add.yml vendored Normal file
View File

@ -0,0 +1,68 @@
name: Add new custom code
on:
workflow_dispatch:
inputs:
code_type:
description: 'code type'
required: true
type: choice
options: ['main', 'over']
code:
description: 'gift code'
required: true
expire:
description: 'expire date, format: 2023-6-10'
required: true
rewards:
description: 'rewards, format: 星琼:60 信用点:1000'
required: true
jobs:
build:
runs-on: ubuntu-latest
steps:
# 此步骤使用 GitHub 的 https://github.com/actions/checkout
- name: checkout actions
uses: actions/checkout@v3
# 设置python环境
# 此步骤使用 GitHub 的 https://github.com/actions/setup-python
- name: Set up Python 3.9
uses: actions/setup-python@v3
with:
python-version: 3.9
# 安装依赖
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
# 添加 code
- name: Update over code
run: |
python add.py ${{ github.event.inputs.code_type }} ${{ github.event.inputs.code }} ${{ github.event.inputs.expire }} ${{ github.event.inputs.rewards }}
python main.py
# Auto commit
- name: Commit changes
uses: EndBug/add-and-commit@v9
with:
author_name: github-actions[bot]
author_email: github-actions[bot]@users.noreply.github.com
message: ':sparkles: Add new code'
add: |
'data/custom.json'
# Auto commit
- name: Commit changes
uses: EndBug/add-and-commit@v9
with:
author_name: github-actions[bot]
author_email: github-actions[bot]@users.noreply.github.com
push: 'origin remote --force'
new_branch: 'remote'
message: ':sparkles: Update Codes'
add: |
'data'