Gift-Code-Web/.github/workflows/add.yml
2023-06-10 22:54:40 +08:00

69 lines
1.9 KiB
YAML

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 or 2023-06-10:12:00:00'
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'