generated from PartridgeRocks/package-skeleton-laravel
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Summary
Add comprehensive GitHub Actions workflow and CI analysis capabilities to enable programmatic debugging of test failures, workflow runs, and check results.
Motivation
Currently, debugging CI failures requires complex shell commands and manual log inspection. We need proper GitHub API integration to:
- Programmatically analyze test failures
- Get detailed error logs and annotations
- Monitor workflow health and performance
- Enable automated CI issue detection
Proposed Implementation
New ActionsResource Methods
// Workflow run analysis
Github::actions()->getRuns('owner', 'repo', ['status' => 'failure']);
Github::actions()->getRun('owner', 'repo', $runId);
Github::actions()->getRunJobs('owner', 'repo', $runId);
// Check run analysis
Github::actions()->getCheckRuns('owner', 'repo', 'commit-sha');
Github::actions()->getCheckRun('owner', 'repo', $checkRunId);
Github::actions()->getCheckAnnotations('owner', 'repo', $checkRunId);
// Log retrieval
Github::actions()->getRunLogs('owner', 'repo', $runId);
Github::actions()->getJobLogs('owner', 'repo', $jobId);
// Analysis helpers
Github::actions()->getFailedChecks('owner', 'repo', 'commit-sha');
Github::actions()->analyzeTestFailures('owner', 'repo', $runId);Required GitHub API Endpoints
GET /repos/{owner}/{repo}/actions/runs- List workflow runsGET /repos/{owner}/{repo}/actions/runs/{run_id}- Get specific runGET /repos/{owner}/{repo}/actions/runs/{run_id}/jobs- Get jobs for runGET /repos/{owner}/{repo}/actions/runs/{run_id}/logs- Download logsGET /repos/{owner}/{repo}/actions/jobs/{job_id}/logs- Download job logsGET /repos/{owner}/{repo}/commits/{ref}/check-runs- Check runs for commitGET /repos/{owner}/{repo}/check-runs/{check_run_id}- Specific check runGET /repos/{owner}/{repo}/check-runs/{check_run_id}/annotations- Failure details
New DTOs
WorkflowRunDTO- Workflow run data with status, timing, conclusionJobDTO- Individual job data with steps and logsCheckRunDTO- Check run data with annotations and detailsCheckAnnotationDTO- Specific failure/error annotationsCIAnalysisDTO- Aggregated analysis of CI health
Use Cases
// Debug current PR failures
$pr = Github::pullRequests()->detail('owner', 'repo', 80);
$failures = Github::actions()->getFailedChecks('owner', 'repo', $pr->head->sha);
foreach ($failures as $failure) {
echo "❌ {$failure->name}: {$failure->conclusion}\n";
$annotations = Github::actions()->getCheckAnnotations('owner', 'repo', $failure->id);
foreach ($annotations as $annotation) {
echo " 📍 {$annotation->path}:{$annotation->start_line} - {$annotation->message}\n";
}
}
// Monitor CI health over time
$recentRuns = Github::actions()->getRuns('owner', 'repo', [
'created' => '>2024-01-01',
'per_page' => 100
]);
$successRate = count(array_filter($recentRuns, fn($run) => $run->conclusion === 'success')) / count($recentRuns);
echo "CI Success Rate: " . ($successRate * 100) . "%\n";
// Automated failure analysis
$analysis = Github::actions()->analyzeTestFailures('owner', 'repo', $runId);
echo "Common Failures:\n";
foreach ($analysis->patterns as $pattern) {
echo "- {$pattern->type}: {$pattern->count} occurrences\n";
}Benefits
- Streamlined debugging: No more complex shell commands for CI analysis
- Automated monitoring: Programmatic CI health checks
- Better error reporting: Structured failure data with context
- Integration ready: Perfect for monitoring dashboards and alerts
- Developer experience: Easy CI debugging through clean PHP API
Implementation Priority
- High - This would significantly improve our ability to debug and monitor CI/CD pipeline health
- Scope: Medium - Requires new DTOs, requests, and resource methods
- Dependencies: None - uses existing GitHub API patterns
Related Issues
- This would have helped resolve the Laravel 10 test debugging we just encountered
- Enables better monitoring of package stability across environments
- Supports automated quality assurance workflows
Perfect for building CI monitoring dashboards, automated failure notifications, and streamlined debugging workflows! 🚀
Metadata
Metadata
Assignees
Labels
No labels