name: Pipeline Status Dashboard
on:
workflow_run:
workflows: ["CI/CD Pipeline", "Quick Validation", "MCP Evaluations", "Security Scanning", "Docker Build"]
types: [completed]
schedule:
- cron: '0 */6 * * *' # Every 6 hours
workflow_dispatch:
jobs:
update-dashboard:
runs-on: ubuntu-latest
permissions:
actions: read
contents: write
issues: write
steps:
- name: Checkout code
uses: actions/checkout@v5
- name: Generate pipeline status
uses: actions/github-script@v7
with:
script: |
const workflows = [
'CI/CD Pipeline',
'Quick Validation',
'MCP Evaluations',
'Security Scanning',
'Docker Build'
];
let statusReport = '## đ CI/CD Pipeline Status Dashboard\n\n';
statusReport += `**Last Updated**: ${new Date().toISOString()}\n\n`;
statusReport += '| Workflow | Status | Last Run | Duration |\n';
statusReport += '|----------|--------|----------|----------|\n';
for (const workflowName of workflows) {
try {
const { data: workflowRuns } = await github.rest.actions.listWorkflowRuns({
owner: context.repo.owner,
repo: context.repo.repo,
workflow_id: workflowName.toLowerCase().replace(/[^a-z0-9-]/g, '-') + '.yml',
per_page: 1
});
if (workflowRuns.workflow_runs.length > 0) {
const run = workflowRuns.workflow_runs[0];
const status = run.conclusion === 'success' ? 'â
Passing' :
run.conclusion === 'failure' ? 'â Failing' :
run.conclusion === 'cancelled' ? 'âšī¸ Cancelled' :
'đĄ Running';
const duration = run.run_started_at && run.updated_at ?
Math.round((new Date(run.updated_at) - new Date(run.run_started_at)) / 60000) + 'm' : 'N/A';
statusReport += `| ${workflowName} | ${status} | ${run.created_at.split('T')[0]} | ${duration} |\n`;
} else {
statusReport += `| ${workflowName} | đ No runs | N/A | N/A |\n`;
}
} catch (error) {
statusReport += `| ${workflowName} | â ī¸ Error | N/A | N/A |\n`;
}
}
statusReport += '\n### đ Pipeline Health Score\n';
statusReport += 'Pipeline health is calculated based on success rate of last 10 runs across all workflows.\n';
// Save status to file
require('fs').writeFileSync('PIPELINE_STATUS.md', statusReport);
console.log('Pipeline status dashboard updated');
- name: Commit status dashboard
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
if git diff --quiet PIPELINE_STATUS.md; then
echo "No changes to pipeline status"
else
git add PIPELINE_STATUS.md
git commit -m "docs: update pipeline status dashboard
đ¤ Auto-generated pipeline health report"
git push
echo "â
Pipeline status dashboard updated"
fi