This commit is contained in:
2025-07-10 21:32:53 +03:00
parent dd524e1ffb
commit 9fa5dc8b47

View File

@@ -1,40 +1,44 @@
name: CI Pipeline name: CI Pipeline
# Triggers for the workflow
on: on:
schedule: schedule:
- cron: '0 0 * * *' # Runs daily at midnight - cron: '0 0 * * *' # Runs daily at midnight UTC
push: push:
branches: branches:
- main - main
pull_request: pull_request:
branches: branches:
- main - main
workflow_dispatch: # Добавлено для ручного запуска workflow_dispatch: # Allows manual triggering from GitHub UI
# Environment variables available to all jobs
env: env:
BRANCH_NAME: "update-submodules_${{ github.sha }}" BRANCH_NAME: "update-submodules_${{ github.sha }}"
REPO_URL: "github.com/root/limoka.git" REPO_URL: "github.com/MuRuLOSE/limoka.git" # Updated repository URL
GIT_DEPTH: 0 GIT_DEPTH: 0 # Fetch full history for Git operations
jobs: jobs:
before: before:
runs-on: ubuntu-latest runs-on: ubuntu-latest
# Run on schedule or manual dispatch
if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
steps: steps:
- uses: actions/checkout@v4 - name: Checkout repository
uses: actions/checkout@v4
with: with:
fetch-depth: ${{ env.GIT_DEPTH }} fetch-depth: ${{ env.GIT_DEPTH }}
- name: Set up Python - name: Set up Python 3.9
uses: actions/setup-python@v5 uses: actions/setup-python@v5
with: with:
python-version: '3.9' python-version: '3.9'
- name: Install dependencies - name: Install Python dependencies
run: pip install requests run: pip install requests
- name: Configure Git - name: Configure Git for github-actions[bot]
run: | run: |
git config --global user.email "github-actions[bot]@users.noreply.github.com" git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]" git config --global user.name "github-actions[bot]"
- name: Sync main branch - name: Sync main branch and create new branch
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: | run: |
@@ -53,14 +57,16 @@ jobs:
update: update:
runs-on: ubuntu-latest runs-on: ubuntu-latest
# Run on schedule or manual dispatch
if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
needs: before needs: before
steps: steps:
- uses: actions/checkout@v4 - name: Checkout repository
uses: actions/checkout@v4
with: with:
fetch-depth: ${{ env.GIT_DEPTH }} fetch-depth: ${{ env.GIT_DEPTH }}
ref: ${{ env.BRANCH_NAME }} ref: ${{ env.BRANCH_NAME }}
- name: Set up Python - name: Set up Python 3.9
uses: actions/setup-python@v5 uses: actions/setup-python@v5
with: with:
python-version: '3.9' python-version: '3.9'
@@ -78,16 +84,18 @@ jobs:
parse: parse:
runs-on: ubuntu-latest runs-on: ubuntu-latest
if: (github.event_name == 'push' && github.ref == 'refs/heads/main') || (github.event_name == 'pull_request' && github.event.action == 'closed' && github.event.pull_request.merged == true) || github.event_name == 'workflow_dispatch' # Run on push to main, merged PR, or manual dispatch
if: github.event_name == 'push' && github.ref == 'refs/heads/main' || github.event_name == 'pull_request' && github.event.action == 'closed' && github.event.pull_request.merged == true || github.event_name == 'workflow_dispatch'
steps: steps:
- uses: actions/checkout@v4 - name: Checkout repository
uses: actions/checkout@v4
with: with:
fetch-depth: ${{ env.GIT_DEPTH }} fetch-depth: ${{ env.GIT_DEPTH }}
- name: Set up Python - name: Set up Python 3.9
uses: actions/setup-python@v5 uses: actions/setup-python@v5
with: with:
python-version: '3.9' python-version: '3.9'
- name: Configure Git - name: Configure Git for github-actions[bot]
run: | run: |
git config --global user.email "github-actions[bot]@users.noreply.github.com" git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]" git config --global user.name "github-actions[bot]"
@@ -107,19 +115,21 @@ jobs:
python3 categories.py python3 categories.py
git add modules.json git add modules.json
git commit -m "Updated modules.json after merge $(date +'%Y-%m-%d %H:%M:%S')" || echo "No changes for modules.json" git commit -m "Updated modules.json after merge $(date +'%Y-%m-%d %H:%M:%S')" || echo "No changes for modules.json"
git remote set-url origin "https://x-access-token:${GGithub_TOKEN}@${REPO_URL}" git remote set-url origin "https://x-access-token:${GITHUB_TOKEN}@${REPO_URL}"
git push origin main git push origin main
commit: commit:
runs-on: ubuntu-latest runs-on: ubuntu-latest
# Run on schedule or manual dispatch
if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
needs: update needs: update
steps: steps:
- uses: actions/checkout@v4 - name: Checkout repository
uses: actions/checkout@v4
with: with:
fetch-depth: ${{ env.GIT_DEPTH }} fetch-depth: ${{ env.GIT_DEPTH }}
ref: ${{ env.BRANCH_NAME }} ref: ${{ env.BRANCH_NAME }}
- name: Configure Git - name: Configure Git for github-actions[bot]
run: | run: |
git config --global user.email "github-actions[bot]@users.noreply.github.com" git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]" git config --global user.name "github-actions[bot]"
@@ -135,10 +145,12 @@ jobs:
create_pr: create_pr:
runs-on: ubuntu-latest runs-on: ubuntu-latest
# Run on schedule or manual dispatch
if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
needs: commit needs: commit
steps: steps:
- uses: actions/checkout@v4 - name: Checkout repository
uses: actions/checkout@v4
with: with:
fetch-depth: ${{ env.GIT_DEPTH }} fetch-depth: ${{ env.GIT_DEPTH }}
- name: Create Pull Request - name: Create Pull Request
@@ -154,13 +166,15 @@ jobs:
backup: backup:
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: parse # Run on main branch or manual dispatch
if: github.ref == 'refs/heads/main' || github.event_name == 'workflow_dispatch' if: github.ref == 'refs/heads/main' || github.event_name == 'workflow_dispatch'
needs: parse
steps: steps:
- uses: actions/checkout@v4 - name: Checkout repository
uses: actions/checkout@v4
with: with:
fetch-depth: ${{ env.GIT_DEPTH }} fetch-depth: ${{ env.GIT_DEPTH }}
- name: Create and send backup - name: Create and send backup to Telegram
env: env:
TELEGRAM_BOT_TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN }} TELEGRAM_BOT_TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN }}
TELEGRAM_CHAT_ID: ${{ secrets.TELEGRAM_CHAT_ID }} TELEGRAM_CHAT_ID: ${{ secrets.TELEGRAM_CHAT_ID }}