Skip to content

Commit

Permalink
测试action
Browse files Browse the repository at this point in the history
  • Loading branch information
NagaResst committed Nov 23, 2024
1 parent c307b36 commit 59a238d
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 22 deletions.
47 changes: 30 additions & 17 deletions .github/workflows/auto-update.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,37 +2,50 @@ name: Auto Check and Update Patch Data

on:
workflow_dispatch:
inputs:
Patch_version:
description: 'Please input the version of FF14 Patch'
required: true
schedule:
- cron: '0 15 * * 2'

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3
with:
# 指定要检出的仓库,默认为当前仓库
repository: thewakingsands/ffxiv-datamining-cn
# 指定要检出的分支,默认为默认分支
ref: master

- name: List files in the repository
run: git tag --list 'patch-.*'

- name: Setup Python
if: steps.changes.outputs.version == 'true'
uses: actions/setup-python@v4
with:
python-version: '3.8'

- name: Check FFXIX CN Patch Code Version
id: check_version
run: |
output=$(git ls-remote https://github.com/thewakingsands/ffxiv-datamining-cn |grep "patch" |awk -F "-" '{print $2}'| tail -1)
echo "::set-output name=patch_version::$output"
- name: Install dependencies
if: steps.changes.outputs.version == 'true'
run: |
python -m pip install --upgrade pip
pip install requests
- name: Run Python script
run: |
python format_item.py
path: ./Paissa/Data
env:
FFXIV_PATCH_VERSION: {{step.check_version.outputs.patch_version}}

- name: Configure Git user
run: |
git config --global user.name 'Naga Resst'
git config --global user.email '[email protected]'
- name: Add and commit changes
run: |
git add .
git commit -m 'Update Patch Data'
- name: Push changes
run: |
git push
env:
GITHUB_TOKEN: ${{ secrets.GIT_KEY }}

6 changes: 3 additions & 3 deletions Data/format_item.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
"""
下载数据文件到本地
"""
patch_version = os.popen("git tag --list 'patch-.*'|tail -1")
patch_version = os.environ['FFXIV_PATCH_VERSION']

Download_addres = f'https://raw.githubusercontent.com/thewakingsands/ffxiv-datamining-cn/patch-{patch_version}/Item.csv'
Download_addres = f'https://raw.githubusercontent.com/thewakingsands/ffxiv-datamining-cn/master/Item.csv'
item_data = requests.get(Download_addres, timeout=9, verify=False)
print('拆包数据下载成功,准备保存到本地')
with open("Item.csv", "w", encoding='UTF-8') as code:
Expand Down Expand Up @@ -94,7 +94,7 @@ def get_item_details(item_id):
"""
数据写入磁盘
"""
version = {'data-version': '7.0'}
version = {'data-version': patch_version}
version.update(item_out_list)

with open('item.Pdt', 'w', encoding='utf8') as item_data:
Expand Down
4 changes: 2 additions & 2 deletions Paissa.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
data_version = data_json['data-version']
logger.info("本地数据版本 {}".format(data_version))
except:
data_version = None
data_version = 0
logger.error("本地数据版本检查失败")

if version_online['program'] != program_version:
Expand All @@ -62,7 +62,7 @@
except:
logger.warning("主程序更新失败")

if version_online['data'] != data_version:
if float(version_online['data']) > float(data_version):
market_filter = False
try:
data_zip = get('https://paissa-data.oss-cn-hongkong.aliyuncs.com/item.zip', timeout=7, proxies=proxies).content
Expand Down

0 comments on commit 59a238d

Please sign in to comment.