mirror of
https://github.com/sysadminsmedia/homebox.git
synced 2025-12-21 21:33:02 +01:00
Refactor update-currencies workflow with enhancements
Update currencies workflow to fix errors and introduce improvements
This commit is contained in:
22
.github/workflows/update-currencies.yml
vendored
22
.github/workflows/update-currencies.yml
vendored
@@ -5,18 +5,22 @@ on:
|
|||||||
branches: [ main ]
|
branches: [ main ]
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
pull-requests: write
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
update-currencies:
|
update-currencies:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Set up Python
|
- name: Set up Python
|
||||||
uses: actions/setup-python@v4
|
uses: actions/setup-python@v5
|
||||||
with:
|
with:
|
||||||
python-version: '3.8'
|
python-version: '3.8'
|
||||||
cache: 'pip'
|
cache: 'pip'
|
||||||
@@ -25,15 +29,14 @@ jobs:
|
|||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: |
|
run: |
|
||||||
python -m pip install --upgrade pip
|
python -m pip install --upgrade pip
|
||||||
pip install requests
|
pip install -r .github/workflows/update-currencies/requirements.txt
|
||||||
|
|
||||||
- name: Run currency update script
|
- name: Run currency update script
|
||||||
run: python .github/scripts/update_currencies.py
|
run: python .github/scripts/update_currencies.py
|
||||||
|
|
||||||
- name: Check for file changes
|
- name: Check for currencies.json changes
|
||||||
id: changes
|
|
||||||
run: |
|
run: |
|
||||||
if git diff --quiet; then
|
if git diff --quiet -- backend/internal/core/currencies/currencies.json; then
|
||||||
echo "changed=false" >> $GITHUB_ENV
|
echo "changed=false" >> $GITHUB_ENV
|
||||||
else
|
else
|
||||||
echo "changed=true" >> $GITHUB_ENV
|
echo "changed=true" >> $GITHUB_ENV
|
||||||
@@ -41,16 +44,17 @@ jobs:
|
|||||||
|
|
||||||
- name: Create Pull Request
|
- name: Create Pull Request
|
||||||
if: env.changed == 'true'
|
if: env.changed == 'true'
|
||||||
uses: peter-evans/create-pull-request@v7.0.7
|
uses: peter-evans/create-pull-request@v7
|
||||||
with:
|
with:
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
branch: update-currencies
|
branch: update-currencies
|
||||||
base: main
|
base: main
|
||||||
title: "Update currencies.json"
|
title: "Update currencies.json"
|
||||||
commit-message: "chore: update currencies.json"
|
commit-message: "chore: update currencies.json"
|
||||||
path: backend/internal/core/currencies/currencies.json
|
path: .
|
||||||
|
add-paths: |
|
||||||
|
backend/internal/core/currencies/currencies.json
|
||||||
|
|
||||||
- name: No updates needed
|
- name: No updates needed
|
||||||
if: env.changed == 'false'
|
if: env.changed == 'false'
|
||||||
run: echo "✅ currencies.json is already up-to-date"
|
run: echo "✅ currencies.json is already up-to-date"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user