mirror of
https://github.com/samsonjs/vibetunnel.git
synced 2026-04-05 11:15:57 +00:00
68 lines
No EOL
2.2 KiB
YAML
68 lines
No EOL
2.2 KiB
YAML
name: Monitor CI Status
|
|
|
|
on:
|
|
workflow_run:
|
|
workflows: ["CI"]
|
|
types:
|
|
- completed
|
|
|
|
permissions:
|
|
contents: read
|
|
pull-requests: write
|
|
issues: write
|
|
|
|
jobs:
|
|
report-status:
|
|
name: Report CI Status
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Check CI Status
|
|
uses: actions/github-script@v7
|
|
with:
|
|
script: |
|
|
const workflow_run = context.payload.workflow_run;
|
|
|
|
console.log(`Workflow ${workflow_run.name} completed with status: ${workflow_run.conclusion}`);
|
|
console.log(`Run ID: ${workflow_run.id}`);
|
|
console.log(`Run URL: ${workflow_run.html_url}`);
|
|
|
|
// Get workflow jobs
|
|
const jobs = await github.rest.actions.listJobsForWorkflowRun({
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo,
|
|
run_id: workflow_run.id
|
|
});
|
|
|
|
console.log('\nJob Summary:');
|
|
for (const job of jobs.data.jobs) {
|
|
console.log(`- ${job.name}: ${job.conclusion || 'in progress'}`);
|
|
if (job.conclusion === 'failure') {
|
|
console.log(` Failed at step: ${job.steps.find(s => s.conclusion === 'failure')?.name}`);
|
|
}
|
|
}
|
|
|
|
// Report failures in PR comment if applicable
|
|
if (workflow_run.conclusion === 'failure' && workflow_run.pull_requests.length > 0) {
|
|
const pr = workflow_run.pull_requests[0];
|
|
const failedJobs = jobs.data.jobs.filter(j => j.conclusion === 'failure');
|
|
|
|
let comment = '## ❌ CI Failed\n\n';
|
|
comment += `[View failed run](${workflow_run.html_url})\n\n`;
|
|
comment += '### Failed Jobs:\n';
|
|
|
|
for (const job of failedJobs) {
|
|
comment += `- **${job.name}**\n`;
|
|
const failedStep = job.steps.find(s => s.conclusion === 'failure');
|
|
if (failedStep) {
|
|
comment += ` - Failed at: ${failedStep.name}\n`;
|
|
}
|
|
}
|
|
|
|
await github.rest.issues.createComment({
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo,
|
|
issue_number: pr.number,
|
|
body: comment
|
|
});
|
|
} |