🤖 feat: complete gitea-client skill enhancements with new CI/CD monitoring commands
This commit is contained in:
@@ -40,6 +40,18 @@ Create a token in Gitea:
|
||||
|
||||
## Commands
|
||||
|
||||
### List Workflows
|
||||
|
||||
```bash
|
||||
skill gitea-client list-workflows <owner> <repo>
|
||||
```
|
||||
|
||||
List available workflows for a repository.
|
||||
|
||||
**Arguments:**
|
||||
- `owner`: Repository owner
|
||||
- `repo`: Repository name
|
||||
|
||||
### List Jobs
|
||||
|
||||
```bash
|
||||
@@ -151,6 +163,80 @@ gitea-client list-workflow-jobs arcodange dance-lessons-coach 351 | jq '.jobs[]
|
||||
gitea-client list-workflow-jobs arcodange dance-lessons-coach 350
|
||||
```
|
||||
|
||||
### Monitor Workflow Run
|
||||
|
||||
```bash
|
||||
skill gitea-client monitor-workflow <owner> <repo> <workflow_run_id> [interval_seconds]
|
||||
```
|
||||
|
||||
Monitor a workflow run until completion with automatic updates.
|
||||
|
||||
**Arguments:**
|
||||
- `owner`: Repository owner
|
||||
- `repo`: Repository name
|
||||
- `workflow_run_id`: Workflow run ID
|
||||
- `interval_seconds`: Update interval in seconds (default: 30)
|
||||
|
||||
**Example:**
|
||||
```bash
|
||||
# Monitor workflow run 415 with 30-second updates
|
||||
gitea-client monitor-workflow arcodange dance-lessons-coach 415 30
|
||||
|
||||
# Monitor with faster updates (10 seconds)
|
||||
gitea-client monitor-workflow arcodange dance-lessons-coach 415 10
|
||||
```
|
||||
|
||||
### Diagnose Failed Job
|
||||
|
||||
```bash
|
||||
skill gitea-client diagnose-job <owner> <repo> <job_id>
|
||||
```
|
||||
|
||||
Diagnose a failed job with automatic error analysis.
|
||||
|
||||
**Arguments:**
|
||||
- `owner`: Repository owner
|
||||
- `repo`: Repository name
|
||||
- `job_id`: Job ID
|
||||
|
||||
**Features:**
|
||||
- Shows job details (status, conclusion, timestamps)
|
||||
- Displays last 50 lines of logs
|
||||
- Automatically extracts and highlights error messages
|
||||
- Shows workflow run context
|
||||
|
||||
**Example:**
|
||||
```bash
|
||||
# Diagnose failed job 759
|
||||
gitea-client diagnose-job arcodange dance-lessons-coach 759
|
||||
```
|
||||
|
||||
### Get Recent Workflows Summary
|
||||
|
||||
```bash
|
||||
skill gitea-client recent-workflows <owner> <repo> [limit] [status_filter]
|
||||
```
|
||||
|
||||
Get a summary of recent workflow runs.
|
||||
|
||||
**Arguments:**
|
||||
- `owner`: Repository owner
|
||||
- `repo`: Repository name
|
||||
- `limit`: Maximum number of workflows to show (default: 10)
|
||||
- `status_filter`: Filter by status (optional: completed, in_progress, queued, waiting)
|
||||
|
||||
**Example:**
|
||||
```bash
|
||||
# Show last 5 workflow runs
|
||||
gitea-client recent-workflows arcodange dance-lessons-coach 5
|
||||
|
||||
# Show only completed workflows
|
||||
gitea-client recent-workflows arcodange dance-lessons-coach 10 completed
|
||||
|
||||
# Show in-progress workflows
|
||||
gitea-client recent-workflows arcodange dance-lessons-coach 5 in_progress
|
||||
```
|
||||
|
||||
### Wait for Job Completion
|
||||
|
||||
```bash
|
||||
@@ -414,6 +500,70 @@ The skill handles common API errors:
|
||||
4. **Logging**: Redirect output to files for debugging
|
||||
5. **Timeouts**: Use reasonable timeouts for wait operations
|
||||
|
||||
## Enhanced Workflow Monitoring with New Commands
|
||||
|
||||
### Complete CI Debugging Workflow with New Commands
|
||||
|
||||
```bash
|
||||
# 1. Get summary of recent workflows to identify issues
|
||||
gitea-client recent-workflows arcodange dance-lessons-coach 10
|
||||
|
||||
# 2. Monitor a specific workflow run until completion
|
||||
gitea-client monitor-workflow arcodange dance-lessons-coach 415 30
|
||||
|
||||
# 3. If workflow fails, automatically diagnose all failed jobs
|
||||
WORKFLOW_ID=415
|
||||
WORKFLOW_STATUS=$(gitea-client job-status arcodange dance-lessons-coach $WORKFLOW_ID | jq -r '.status')
|
||||
WORKFLOW_CONCLUSION=$(gitea-client job-status arcodange dance-lessons-coach $WORKFLOW_ID | jq -r '.conclusion')
|
||||
|
||||
if [ "$WORKFLOW_CONCLUSION" = "failure" ]; then
|
||||
echo "Workflow failed! Diagnosing all jobs..."
|
||||
|
||||
# Get all jobs in the workflow
|
||||
JOBS=$(gitea-client list-workflow-jobs arcodange dance-lessons-coach $WORKFLOW_ID | jq -r '.jobs[] | select(.conclusion == "failure") | .id')
|
||||
|
||||
# Diagnose each failed job
|
||||
for job_id in $JOBS; do
|
||||
echo "Diagnosing job $job_id:"
|
||||
gitea-client diagnose-job arcodange dance-lessons-coach $job_id
|
||||
echo "========================================"
|
||||
done
|
||||
fi
|
||||
|
||||
# 4. Advanced monitoring with automatic diagnosis
|
||||
WORKFLOW_ID=415
|
||||
TIMEOUT=300
|
||||
SECONDS_ELAPSED=0
|
||||
|
||||
while [ $SECONDS_ELAPSED -lt $TIMEOUT ]; do
|
||||
STATUS=$(gitea-client job-status arcodange dance-lessons-coach $WORKFLOW_ID | jq -r '.status')
|
||||
CONCLUSION=$(gitea-client job-status arcodange dance-lessons-coach $WORKFLOW_ID | jq -r '.conclusion')
|
||||
|
||||
echo "[$(date)] Status: $STATUS, Conclusion: ${CONCLUSION:-not completed}"
|
||||
|
||||
if [[ "$CONCLUSION" == "failure" ]]; then
|
||||
echo "Workflow failed! Running automatic diagnosis..."
|
||||
gitea-client diagnose-job arcodange dance-lessons-coach $WORKFLOW_ID
|
||||
|
||||
# Find PR and comment
|
||||
PR_NUMBER=$(gitea-client list-prs arcodange dance-lessons-coach | \
|
||||
jq -r '.[] | select(.head.ref == "feature/user-authentication-bdd") | .number')
|
||||
|
||||
if [ -n "$PR_NUMBER" ]; then
|
||||
gitea-client comment-pr arcodange dance-lessons-coach $PR_NUMBER \
|
||||
"⚠️ CI Workflow $WORKFLOW_ID failed. See diagnosis above for details."
|
||||
fi
|
||||
break
|
||||
elif [[ "$STATUS" != "in_progress" && "$STATUS" != "waiting" ]]; then
|
||||
echo "Workflow completed with status: $STATUS"
|
||||
break
|
||||
fi
|
||||
|
||||
sleep 30
|
||||
SECONDS_ELAPSED=$((SECONDS_ELAPSED + 30))
|
||||
done
|
||||
```
|
||||
|
||||
## Real-World Use Case: PR Commenting Workflow
|
||||
|
||||
The Gitea client skill excels at automated PR commenting during CI/CD workflows.
|
||||
|
||||
Reference in New Issue
Block a user