Update main.yml #5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Randomizer Workflow | ||
on: | ||
pull_request: | ||
jobs: | ||
lint_and_run: | ||
runs-on: ubuntu-latest | ||
steps: | ||
# 1. Checkout репозитория | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
# 2. Установка Python | ||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: 3.14.0-alpha.3 | ||
# 3. Установка зависимостей (flake8 для линтинга) | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install flake8 | ||
# 4. Линтинг main.py | ||
- name: Run linter | ||
run: flake8 main.py | ||
# 5. Запуск randomizer.py | ||
- name: Run randomizer | ||
id: randomizer | ||
run: python randomizer.py | ||
continue-on-error: false # Прерывание, если рандомайзер вернет ошибку | ||
# Шаг 6: Условные действия на основе уровня риска | ||
- name: Action for Low Risk | ||
if: ${{ steps.predict-risk.outcome == 'success' && steps.predict-risk.conclusion == 0 }} | ||
run: echo "Низкий риск. Выполняем действия для низкого риска." | ||
- name: Action for Medium Risk | ||
if: ${{ steps.predict-risk.outcome == 'success' && steps.predict-risk.conclusion == 1 }} | ||
run: echo "Средний риск. Выполняем действия для среднего риска." | ||
- name: Action for High Risk | ||
if: ${{ steps.predict-risk.outcome == 'success' && steps.predict-risk.conclusion == 2 }} | ||
run: echo "Высокий риск. Выполняем действия для высокого риска." |