Skip to content

Check Futu OpenD Version Update #363

Check Futu OpenD Version Update

Check Futu OpenD Version Update #363

# This workflow is used to check if there is a new version of Futu OpenD
# and update the version in the Dockerfile
name: Check Futu OpenD Version Update
on:
schedule:
- cron: "0 0 * * *"
workflow_dispatch:
permissions:
pull-requests: read
contents: read
issues: read
jobs:
check-version:
name: Check Version
runs-on: ubuntu-latest
# Note: contents: write permission is required to push code changes and create PRs
# This is a legitimate use case for automated version updates
permissions:
pull-requests: write
contents: write
issues: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install node
uses: actions/setup-node@v4
with:
node-version: "20"
cache: "npm"
- name: Install dependencies
run: |
npm ci
- name: Check Futu OpenD Version
run: |
node script/check_version.js
- name: Create Pull Request if needed
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
if [ -f opend_version.json ] && [ -s opend_version.json ]; then
# 检查是否有新的版本更新
if git diff --quiet opend_version.json; then
echo "No version update needed"
else
# 创建新分支并提交更改
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
# 关闭已存在的 PR
gh pr list --search "Update Futu OpenD version" --json number --jq ".[].number" | xargs -I {} gh pr close {} || true
# 创建新分支
git checkout -b update-futu-opend-version
git add opend_version.json
git commit -m "Update Futu OpenD version"
# 推送更改
git push origin update-futu-opend-version
# 创建新的 PR
gh pr create --title "Update Futu OpenD version" --body "Update Futu OpenD version"
fi
else
echo "No version file found or file is empty"
fi