diff --git a/.github/workflows/update_exchange_rate.yml b/.github/workflows/update_exchange_rate.yml index 3b38309..799f44b 100644 --- a/.github/workflows/update_exchange_rate.yml +++ b/.github/workflows/update_exchange_rate.yml @@ -14,14 +14,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v4 - with: - node-version: '20' - - - name: Setup Python - uses: actions/setup-python@v4 - with: - python-version: '3.x' + uses: actions/checkout@v3 # 更新到 v3 - name: Install dependencies run: | @@ -33,17 +26,12 @@ jobs: run: | python update_exchange_rate.py - - name: Check for changes - id: check_changes - run: | - git fetch - git diff --exit-code > /dev/null || echo "has_changes=true" >> $GITHUB_ENV - - name: Commit and push changes - if: env.has_changes == 'true' + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | git config --local user.email "action@github.com" git config --local user.name "GitHub Action" git add exchange_rate.json - git commit -m "Update exchange rate" - git push + git diff-index --quiet HEAD || git commit -m "Update exchange rate" + git push origin HEAD:main