chore: enhance CI and deployment workflows with status checks and notifications

- Updated CI workflow to provide clearer notifications on test results and deployment readiness.
- Added a new job in the deployment workflow to check the status of the last CI run before proceeding with deployment, ensuring that only successful builds are deployed.
This commit is contained in:
2026-01-25 15:39:19 +03:00
parent 3ee72ec48a
commit 0944175807
2 changed files with 47 additions and 1 deletions

View File

@@ -4,9 +4,53 @@ on:
workflow_dispatch: # Только ручной запуск
jobs:
check-ci-status:
runs-on: ubuntu-latest
name: Check CI Status
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Check last CI run status
uses: actions/github-script@v7
with:
script: |
const { data: runs } = await github.rest.actions.listWorkflowRuns({
owner: context.repo.owner,
repo: context.repo.repo,
workflow_id: 'ci.yml',
branch: 'main',
per_page: 1
});
if (runs.workflow_runs.length === 0) {
core.setFailed('❌ No CI runs found. Please run CI first.');
return;
}
const lastRun = runs.workflow_runs[0];
const status = lastRun.status;
const conclusion = lastRun.conclusion;
console.log(`Last CI run: ${lastRun.id}`);
console.log(`Status: ${status}, Conclusion: ${conclusion}`);
if (status !== 'completed') {
core.setFailed(`❌ Last CI run is still ${status}. Please wait for it to complete.`);
return;
}
if (conclusion !== 'success') {
core.setFailed(`❌ Last CI run failed (${conclusion}). Please fix tests before deploying.`);
return;
}
console.log('✅ Last CI run passed successfully. Ready for deployment!');
deploy:
runs-on: ubuntu-latest
name: Deploy Infrastructure
needs: check-ci-status
steps:
- name: Checkout code