Skip to content

.github/workflows/check.yml #6

.github/workflows/check.yml

.github/workflows/check.yml #6

Workflow file for this run

name: Check and Deploy Discord Bot
on:
schedule:
- cron: '*/10 * * * *'
workflow_dispatch:
jobs:
check-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Check running jobs
id: check_jobs
run: |
# Получаем список запущенных рабочих процессов
RUNNING_JOBS=$(gh api /repos/${{ github.repository }}/actions/runs \
--jq '.workflow_runs[] | select(.name=="Deploy Discord Bot" and .status=="in_progress") | .id')
if [ -z "$RUNNING_JOBS" ]; then
echo "Deployment is not running."
echo "needs_deploy=true" >> $GITHUB_ENV
else
echo "Deployment is already running."
echo "needs_deploy=false" >> $GITHUB_ENV
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Deploy
if: env.needs_deploy == 'true'
uses: ./.github/workflows/deploy.yml