zapret4rocket/.github/workflows/update_recs.yml
IndeecFOX 602a566923
Рефакторинг (#11)
Глобальный рефакторинг
Если что-то не работает, виноват он: AloofLibra <87386304+AloofLibra@users.noreply.github.com> 😂
2026-01-04 18:11:38 +03:00

45 lines
1.7 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

name: Update Recommendations
on:
schedule:
- cron: '0 4 * * *' # Раз в сутки в 4 утра
workflow_dispatch: # Кнопка ручного запуска
jobs:
update:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Полная история для корректного merge
- name: Download Data
run: |
# Качаем CSV с листа Export_TXT
curl -L "https://docs.google.com/spreadsheets/d/e/2PACX-1vRuTn6FKfGYrs1p2fjUSRTelUDeA14bDjMePXQWfSUtQEzZ4NPJc5ZqNHtkx1OMUjJSvP6ER9kkDKaO/pub?gid=2004936343&single=true&output=csv" -o recommendations.txt
# Удаляем кавычки, если Google их добавил
sed -i 's/"//g' recommendations.txt
- name: Fetch and merge changes
run: |
git config user.name "Stats Bot"
git config user.email "bot@noreply.github.com"
# Fetch последних изменений
git fetch origin master
# Пытаемся слить изменения (игнорируем ошибки конфликтов)
git merge origin/master --no-commit --no-ff || true
- name: Force overwrite recommendations.txt
run: |
# Принудительно добавляем наш файл (игнорируя конфликты)
git add recommendations.txt --force
- name: Complete merge and push
run: |
# Завершаем merge/commit
git diff --cached --quiet || git commit -m "Update recommendations"
# Пушим изменения
git push origin master