Skip to content

Commit

Permalink
Update update_exchange_rate.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
CookSleep authored Aug 4, 2024
1 parent 5d5b451 commit 8a0bf12
Showing 1 changed file with 5 additions and 17 deletions.
22 changes: 5 additions & 17 deletions .github/workflows/update_exchange_rate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand All @@ -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

0 comments on commit 8a0bf12

Please sign in to comment.